X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fclass_BaseFrameworkSystem.php;h=7d5ac4a8578bd043d1b3ccc55c79b264b1657b8d;hp=6cc07b23a42816073734a0df3b6d8adb36966fe4;hb=a6ec0211ffb9b65e7c8efd81abdbb925774264ff;hpb=fde621572cc9737972c2305644a6e847562b6140 diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 6cc07b23..7d5ac4a8 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -78,6 +78,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $rngInstance = null; + /** + * Instance of a crypto helper + */ + private $cryptoInstance = null; + /** * Instance of an Iterator class */ @@ -219,9 +224,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Set real class $this->setRealClass($className); - // Set configuration instance if no registry + // Set configuration instance if no registry ... if (!$this instanceof Register) { - // Because registries doesn't need to be configured + // ... because registries doesn't need to be configured $this->setConfigInstance(FrameworkConfiguration::getInstance()); } // END - if } @@ -230,7 +235,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * Destructor reached... * * @return void - * @todo This is old code. Do we still need this old lost code? */ public function __destruct() { // Flush any updated entries to the database @@ -250,8 +254,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } /** - * The call method where all non-implemented methods end up + * The __call() method where all non-implemented methods end up * + * @param $methodName Name of the missing method + * @args $args Arguments passed to the method * @return void */ public final function __call ($methodName, $args) { @@ -267,7 +273,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $argsString .= $this->replaceControlCharacters($arg) . ' (' . gettype($arg); // Add length if type is string - if (gettype($arg) == 'string') $argsString .= ', '.strlen($arg); + if (is_string($arg)) { + $argsString .= ', '.strlen($arg); + } // END - if // Closing bracket $argsString .= '), '; @@ -293,6 +301,42 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return null; } + /** + * Getter for $realClass + * + * @return $realClass The name of the real class (not BaseFrameworkSystem) + */ + public function __toString () { + return $this->realClass; + } + + /** + * Magic function to catch setting of missing but set class fields/attributes + * + * @param $name Name of the field/attribute + * @param $value Value to store + * @return void + */ + public final function __set ($name, $value) { + $this->debugOutput(sprintf("Tried to set a missing field. name=%s, value[%s]=%s", + $name, + gettype($value), + $value + )); + } + + /** + * Magic function to catch getting of missing fields/attributes + * + * @param $name Name of the field/attribute + * @return void + */ + public final function __get ($name) { + $this->debugOutput(sprintf("Tried to get a missing field. name=%s", + $name + )); + } + /** * Setter for database result instance * @@ -554,15 +598,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return $this->responseInstance; } - /** - * Getter for $realClass - * - * @return $realClass The name of the real class (not BaseFrameworkSystem) - */ - public function __toString () { - return $this->realClass; - } - /** * Setter for the real class name * @@ -1182,6 +1217,25 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return $this->rngInstance; } + /** + * Setter for Cryptable instance + * + * @param $cryptoInstance An instance of a Cryptable class + * @return void + */ + protected final function setCryptoInstance (Cryptable $cryptoInstance) { + $this->cryptoInstance = $cryptoInstance; + } + + /** + * Getter for Cryptable instance + * + * @return $cryptoInstance An instance of a Cryptable class + */ + public final function getCryptoInstance () { + return $this->cryptoInstance; + } + /** * Setter for Iterator instance *