From: Roland Häder <roland@mxchange.org>
Date: Thu, 29 Oct 2020 15:35:52 +0000 (+0100)
Subject: Continued:
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cd4ba5256a2b12e69dd95d8d4489f70e1ec5343f;p=core.git

Continued:
- rewrote debug lines, __METHOD__/__LINE__ is no longer needed

Signed-off-by: Roland Häder <roland@mxchange.org>
---

diff --git a/framework/main/classes/feature/class_FrameworkFeature.php b/framework/main/classes/feature/class_FrameworkFeature.php
index 15637716..6310f98e 100644
--- a/framework/main/classes/feature/class_FrameworkFeature.php
+++ b/framework/main/classes/feature/class_FrameworkFeature.php
@@ -98,10 +98,8 @@ class FrameworkFeature extends BaseFrameworkSystem {
 	 * @return	$isAvailable	Whether the given feature is available
 	 */
 	public static function isFeatureAvailable ($featureName) {
-		// Debug message
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: featureName=%s - CALLED!', __METHOD__, __LINE__, $featureName));
-
 		// Is the cache set?
+		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName));
 		if (!isset(self::$enabledFeatures[$featureName]['is_available'])) {
 			// Default is not available
 			self::$enabledFeatures[$featureName]['is_available'] = false;
@@ -110,17 +108,15 @@ class FrameworkFeature extends BaseFrameworkSystem {
 			// Is the feature enabled?
 			if (!self::isFeatureEnabled($featureName)) {
 				// Then it can't be available
-				self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: Feature "%s"is not enabled.', __METHOD__, __LINE__, $featureName));
+				self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: Feature "%s"is not enabled.', $featureName));
 				return false;
 			} // END - if
 
 			// Create config key (for feature class lookup)
 			$configKey = sprintf('feature_%s_class', $featureName);
 
-			// Debug message
-			//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: configKey=%s', __METHOD__, __LINE__, $configKey));
-
 			// Now try to get the instance
+			//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: configKey=%s', $configKey));
 			try {
 				// Try to get an instance
 				self::$enabledFeatures[$featureName]['instance'] = ObjectFactory::createObjectByConfiguredName($configKey);
@@ -129,14 +125,12 @@ class FrameworkFeature extends BaseFrameworkSystem {
 				self::$enabledFeatures[$featureName]['is_available'] = self::$enabledFeatures[$featureName]['instance']->isFeatureAvailable();
 			} catch (NoClassException $e) {
 				// Feature class not found
-				self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: Feature "%s"is not available due to missing feature class. Disabling feature ...', __METHOD__, __LINE__, $featureName));
+				self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: Feature "%s"is not available due to missing feature class. Disabling feature ...', $featureName));
 			}
 		} // END - if
 
-		// Debug message
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: featureName=%s,isAvailable=%d - EXIT!', __METHOD__, __LINE__, $featureName, intval(self::$enabledFeatures[$featureName]['is_available'])));
-
 		// Return "cached" status
+		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s,isAvailable=%d - EXIT!', $featureName, intval(self::$enabledFeatures[$featureName]['is_available'])));
 		return self::$enabledFeatures[$featureName]['is_available'];
 	}
 
@@ -156,10 +150,14 @@ class FrameworkFeature extends BaseFrameworkSystem {
 		 * Please make sure that isFeatureAvailable() has been called and it has
 		 * returned true before calling this method.
 		 */
+		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s,featureMethod=%s,args[]=%s - CALLED!', $featureName, $featureMethod, gettype($args)));
 		assert(self::isFeatureAvailable($featureName));
 
 		// Array for call-back
-		$callable = array(self::$enabledFeatures[$featureName]['instance'], 'featureMethod' . self::convertToClassName($featureMethod));
+		$callable = array(
+			self::$enabledFeatures[$featureName]['instance'],
+			sprintf('featureMethod%s', self::convertToClassName($featureMethod))
+		);
 
 		// So is the feature's method callable?
 		if (!is_callable($callable)) {
@@ -171,6 +169,7 @@ class FrameworkFeature extends BaseFrameworkSystem {
 		$return = call_user_func_array($callable, $args);
 
 		// Return any returned value
+		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: return[]=%s - EXIT!', gettype($return)));
 		return $return;
 	}