X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fclass_BaseFrameworkSystem.php;h=da54f83abacc82a7339912022a82e635adaaf7d9;hp=63ba260e0abee10cbdd9861196d86455a0252d8b;hb=0088a32f8609875b6151dfa516f7c2d92fa3a5a8;hpb=010c49b9284dc5353ec50a746f3b0aab03df7776 diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 63ba260e..da54f83a 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -328,7 +328,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * * @return void */ - public function __destruct() { + public function __destruct () { // Flush any updated entries to the database $this->flushPendingUpdates(); @@ -338,7 +338,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->setRealClass('DestructedObject'); } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { // Already destructed object - $this->debugOutput(sprintf("[%s:] The object %s is already destroyed.", + self::createDebugInstance(__CLASS__)->debugOutput(sprintf("[%s:] The object %s is already destroyed.", __CLASS__, $this->__toString() )); @@ -353,6 +353,17 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function __call ($methodName, $args) { + return self::__callStatic($methodName, $args); + } + + /** + * The __callStatic() method where all non-implemented static methods end up + * + * @param $methodName Name of the missing method + * @args $args Arguments passed to the method + * @return void + */ + public static final function __callStatic ($methodName, $args) { // Implode all given arguments $argsString = ''; if (empty($args)) { @@ -373,10 +384,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { if (is_string($arg)) { // Add length for strings - $argsString .= ', '.strlen($arg); + $argsString .= ', ' . strlen($arg); } elseif (is_array($arg)) { // .. or size if array - $argsString .= ', '.count($arg); + $argsString .= ', ' . count($arg); } elseif ($arg === true) { // ... is boolean 'true' $argsString .= ', true'; @@ -399,8 +410,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // Output stub message - $this->debugOutput(sprintf("[%s->%s] Stub! Args: %s", - $this->__toString(), + // @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class + self::createDebugInstance(__CLASS__)->debugOutput(sprintf("[unknown::%s:] Stub! Args: %s", $methodName, $argsString )); @@ -1004,7 +1015,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function setSocketResource ($socketResource) { - //* NOISY-DEBUG: */ $this->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': socketResource=' . $socketResource . ',previous[' . gettype($this->socketResource) . ']=' . $this->socketResource); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': socketResource=' . $socketResource . ',previous[' . gettype($this->socketResource) . ']=' . $this->socketResource); $this->socketResource = $socketResource; } @@ -1014,7 +1025,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $socketResource A valid socket resource */ public final function getSocketResource () { - //* NOISY-DEBUG: */ $this->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': socketResource[' . gettype($this->socketResource) . ']=' . $this->socketResource); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': socketResource[' . gettype($this->socketResource) . ']=' . $this->socketResource); return $this->socketResource; } @@ -1305,7 +1316,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ); // Output it - ApplicationEntryPoint::app_die(sprintf("
'.print_r($fieldArray, true).''); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.':
'.print_r($fieldArray, true).''); // Convert dashes to underscore $fieldName = $this->convertDashesToUnderscores($fieldName); @@ -1648,7 +1684,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $fieldValue = $fieldArray[$fieldName]; } else { // Missing field entry, may require debugging - $this->debugOutput($this->__toString() . ':fieldname=' . $fieldName . ' not found!'); + self::createDebugInstance(__CLASS__)->debugOutput($this->__toString() . ':fieldname=' . $fieldName . ' not found!'); } // Return it @@ -1690,7 +1726,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Debug instance is there? if (!is_null($this->getDebugInstance())) { // Output stub message - $this->debugOutput($message); + self::createDebugInstance(__CLASS__)->debugOutput($message); } else { // Trigger an error trigger_error($message . "