From: Roland Häder Date: Sat, 25 Feb 2023 12:39:13 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4fc7b52c4eb7287dbfd78bd4bdc8adaea03f7d5c;p=core.git Continued: - RegistryIterator was still looking for SubRegistry, maybe later further expansion needed? - commented-out debug lines --- diff --git a/framework/main/classes/iterator/registry/class_RegistryIterator.php b/framework/main/classes/iterator/registry/class_RegistryIterator.php index 2e94bcf9..94640bac 100644 --- a/framework/main/classes/iterator/registry/class_RegistryIterator.php +++ b/framework/main/classes/iterator/registry/class_RegistryIterator.php @@ -7,9 +7,9 @@ use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Iterator\BaseIterator; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Registry\Register; use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Registry\Sub\SubRegistry; use Org\Mxchange\CoreFramework\Traits\Registry\RegisterTrait; // Import SPL stuff @@ -85,12 +85,14 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { */ public final static function createRegistryIterator (Register $registryInstance) { // Get new instance + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR: registryInstance=%s - CALLED!', $registryInstance->__toString())); $iteratorInstance = new RegistryIterator(); // Set registry here $iteratorInstance->setRegistryInstance($registryInstance); // Return the prepared instance + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR: iteratorInstance=%s - EXIT!', $iteratorInstance->__toString())); return $iteratorInstance; } @@ -114,14 +116,14 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { */ public function initIterator (array $onlyRegistries = []) { // Set it in this registry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR: onlyRegistries()=%d - CALLED!', count($onlyRegistries))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR: onlyRegistries()=%d - CALLED!', count($onlyRegistries))); $this->setOnlyRegistries($onlyRegistries); // Get generic registry entries from it $entries = $this->getRegistryInstance()->getGenericRegistry(); // Anything in there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[generic]: entries()=%d', count($entries))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: entries()=%d', count($entries))); if (count($entries) > 0) { // Debugging: /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: UNFINISHED: entries=%s', __METHOD__, __LINE__, print_r($entries, TRUE))); @@ -131,39 +133,39 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { $entries = $this->getRegistryInstance()->getInstanceRegistry(); // Anything in there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: entries()=%d', count($entries))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: entries()=%d', count($entries))); if (count($entries) > 0) { // Then run over all foreach ($entries as $key => $entry) { // Is an unwanted registry found? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: key=%s,entry[]=%s', $key, gettype($entry))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: key=%s,entry[%s]=%s', $key, gettype($entry), $entry->__toString())); if (substr($key, -8, 8) == 'registry') { // Skip this! - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: key=%s is a registry key, skipping ...', $key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: key=%s is a registry key, skipping ...', $key)); continue; } // Is it an instance of a sub-registry? if (count($onlyRegistries) > 0 && !in_array($key, $onlyRegistries, TRUE)) { // Not in requested registries - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: key=%s is not wanted, skipping ...', $key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: key=%s is not wanted, skipping ...', $key)); continue; - } elseif ($entry instanceof SubRegistry) { + } elseif ($entry instanceof ObjectRegistry) { // Get iterator from this instance - $subRegistryInstances = $entry->getInstanceRegistry(); + $objectRegistryInstances = $entry->getInstanceRegistry(); // Add all sub-registry keys to this registry keys array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: subRegistryInstances()=%d', count($subRegistryInstances))); - //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: key=%s,subRegistryInstances=%s', __METHOD__, __LINE__, $key, print_r($subRegistryInstances, TRUE))); - foreach (array_keys($subRegistryInstances) as $subKey) { + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: objectRegistryInstances()=%d', count($objectRegistryInstances))); + //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: key=%s,objectRegistryInstances=%s', __METHOD__, __LINE__, $key, print_r($objectRegistryInstances, TRUE))); + foreach (array_keys($objectRegistryInstances) as $subKey) { // Add it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: Adding key=%s,subKey=%s ...', $key, $subKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: Adding key=%s,subKey=%s ...', $key, $subKey)); array_push($this->registryKeys['instance'], $subKey); // Is the current key set? if (is_null($this->key)) { // Init key - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: Setting subKey=%s as first key ...', $subKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: Setting this->key=%s as first key (subKey) ...', $subKey)); $this->key = $subKey; } } @@ -178,19 +180,19 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { // Is the current key set? if (is_null($this->key)) { // Init key - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: Setting key=%s as first key ...', $key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: Setting this->key=%s as first key (key) ...', $key)); $this->key = $key; } // Add key to array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[instance]: key=%s - Adding ...', $key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: key=%s - Adding ...', $key)); //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: key=%s,entry=%s', __METHOD__, __LINE__, $key, print_r($entry, TRUE))); array_push($this->registryKeys['instance'], $key); } } // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('REGISTRY-ITERATOR: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('REGISTRY-ITERATOR: EXIT!'); } /** @@ -211,7 +213,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { */ public function current () { // Default is null - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this->key(%d)[%s]=%s,this->valid=%d,this->registryKeys=%s', __METHOD__, __LINE__, strlen($this->key()), gettype($this->key()), $this->key(), intval($this->valid()), print_r($this->registryKeys, TRUE))); $current = NULL; $entries = []; @@ -220,39 +222,39 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { $allRegistries = $this->getRegistryInstance()->getInstanceRegistry(); // Loop through all sub-sets - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: allRegistries()=%d', $this->key(), count($allRegistries))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: allRegistries()=%d', $this->key(), count($allRegistries))); foreach ($allRegistries as $registryKey => $registryInstance) { // Is this key wanted? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s', $this->key(), $registryKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s', $this->key(), $registryKey)); if (count($this->onlyRegistries) == 0 || in_array($registryKey, $this->onlyRegistries)) { // Yes, then loop through them only + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s,this->onlyRegistries()=%d', $this->key(), $registryKey, count($this->onlyRegistries))); $instances = $registryInstance->getInstanceRegistry(); // The key should be there - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: Handling registryKey=%s ...', $this->key(), $registryKey)); - //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: instances=%s', __METHOD__, __LINE__, print_r($instances, TRUE))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: Handling instances()=%d,registryKey=%s ...', $this->key(), count($instances), $registryKey)); if (!isset($instances[$this->key()])) { - // Skip below code - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s has no this->key=%s, skipping ...', $this->key(), $registryKey, $this->key())); + // Not found + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s has no this->key=%s - CONTINUE!', $this->key(), $registryKey, $this->key())); continue; } - // Set as current element and leave loop + // Set as current $current = $instances[$this->key()]; - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s,current=%s found. - BREAK!', $this->key(), $registryKey, $current->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: current=%s', $this->key(), $current->__toString())); break; } } // Is current still NULL? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s,current[]=%s', $this->key(), $registryKey, gettype($current))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: registryKey=%s,current[]=%s', $this->key(), $registryKey, gettype($current))); if (is_null($current)) { // This cannot happen and indicates a logic error throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: current[%s]=%s - EXIT!', $this->key(), gettype($current), $current)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: current[%s]=%s - EXIT!', $this->key(), gettype($current), $current)); return $current; } @@ -263,7 +265,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { */ public function key () { // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR: this->key=%s EXIT!', $this->key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR: this->key=%s EXIT!', $this->key)); return $this->key; } @@ -276,7 +278,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { */ public function next () { // Is valid() still TRUE? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this->key(%d)[%s]=%s,this->valid=%d,this->registryKeys=%s', __METHOD__, __LINE__, strlen($this->key()), gettype($this->key()), $this->key(), intval($this->valid()), print_r($this->registryKeys, TRUE))); if (!$this->valid()) { // Bad method call! @@ -292,7 +294,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { $registryType = 'invalid'; // Get first array element ... - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: this->registryKeys[generic]()=%d,this->registryKeys[instance]()=%d', $this->key(), count($this->registryKeys['generic']), count($this->registryKeys['instance']))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: this->registryKeys[generic]()=%d,this->registryKeys[instance]()=%d', $this->key(), count($this->registryKeys['generic']), count($this->registryKeys['instance']))); if (count($this->registryKeys['generic']) > 0) { // First generic array /* UNFINISHED */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this->key(%d)[%s]=%s,this->valid=%d,this->registryKeys=%s', __METHOD__, __LINE__, strlen($this->key()), gettype($this->key()), $this->key(), intval($this->valid()), print_r($this->registryKeys, TRUE))); @@ -304,7 +306,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { } // Is it still valid? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: isNextValid=%d', $this->key(), intval($isNextValid))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: isNextValid=%d', $this->key(), intval($isNextValid))); if (!$isNextValid) { // Throw exception throw new BadMethodCallException(sprintf('this->key=%s is last key in this iteration. Forgot to invoke valid() before?', $this->key()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL); @@ -314,11 +316,11 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { } // Yes, then advance to that entry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: Setting this->key from this->registryKeys[%s][%d] ...', $registryType, $nextIndex)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR: Setting this->key from this->registryKeys[%s][%d] ...', $registryType, $nextIndex)); $this->key = $this->registryKeys[$registryType][$nextIndex]; // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: EXIT!', $this->key())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: EXIT!', $this->key())); } /** @@ -329,7 +331,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { */ public function rewind () { // Is current key first key? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this->key(%d)[%s]=%s,this->valid=%d,this->registryKeys=%s', __METHOD__, __LINE__, strlen($this->key()), gettype($this->key()), $this->key(), intval($this->valid()), print_r($this->registryKeys, TRUE))); if (array_search($this->key(), $this->getRegistryKeys()) === 0) { // rewind() cannot rewind first entry! @@ -340,18 +342,18 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { } // Get first array element ... - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: this->registryKeys[generic]()=%d,this->registryKeys[instance]()=%d', $this->key(), count($this->registryKeys['generic']), count($this->registryKeys['instance']))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('REGISTRY-ITERATOR[%s]: this->registryKeys[generic]()=%d,this->registryKeys[instance]()=%d', $this->key(), count($this->registryKeys['generic']), count($this->registryKeys['instance']))); if (count($this->registryKeys['generic']) > 0) { // First generic array /* UNFINISHED */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this->key(%d)[%s]=%s,this->valid=%d,this->registryKeys=%s', __METHOD__, __LINE__, strlen($this->key()), gettype($this->key()), $this->key(), intval($this->valid()), print_r($this->registryKeys, TRUE))); } elseif (count($this->registryKeys['instance']) > 0) { // Second instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('REGISTRY-ITERATOR: Setting this->key from this->registryKeys[instance][0] ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('REGISTRY-ITERATOR: Setting this->key from this->registryKeys[instance][0] ...'); $this->key = $this->registryKeys['instance'][0]; } // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: EXIT!', $this->key())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: EXIT!', $this->key())); } /** @@ -361,12 +363,12 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { */ public function valid () { // Is the element there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: CALLED!', $this->key())); //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this->key(%d)[%s]=%s,this->registryKeys=%s', __METHOD__, __LINE__, strlen($this->key()), gettype($this->key()), $this->key(), print_r($this->registryKeys, TRUE))); $valid = (in_array($this->key(), $this->registryKeys['instance']) || in_array($this->key(), $this->registryKeys['generic'])); // Return flag - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: valid=%d - EXIT!', $this->key(), intval($valid))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('REGISTRY-ITERATOR[%s]: valid=%d - EXIT!', $this->key(), intval($valid))); return $valid; } diff --git a/framework/main/classes/registry/class_BaseRegistry.php b/framework/main/classes/registry/class_BaseRegistry.php index f877026b..b334bfae 100644 --- a/framework/main/classes/registry/class_BaseRegistry.php +++ b/framework/main/classes/registry/class_BaseRegistry.php @@ -135,7 +135,7 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg */ public final function getEntries (string $key = NULL) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: key=%s,value[]=%s - CALLED!', $key, gettype($value))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: key[%s]=%s - CALLED!', gettype($key), $key)); if (!is_null($key) && empty($key)) { // Throw IAE throw new InvalidArgumentExeption('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); diff --git a/framework/main/classes/registry/object/class_ObjectRegistry.php b/framework/main/classes/registry/object/class_ObjectRegistry.php index 13b55b8d..102a26e2 100644 --- a/framework/main/classes/registry/object/class_ObjectRegistry.php +++ b/framework/main/classes/registry/object/class_ObjectRegistry.php @@ -46,15 +46,15 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister { */ private function __construct () { // Call parent constructor - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: CONSTRUCTED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: CONSTRUCTED!'); parent::__construct(__CLASS__); // Init own array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: Invoking this->initGenericArrayGroup(registry,instance) ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: Invoking this->initGenericArrayGroup(registry,instance) ...'); $this->initGenericArrayGroup('registry', 'instance'); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: EXIT!'); } /** @@ -67,21 +67,21 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister { */ public static final function getRegistry (string $key) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key)); if (empty($key)) { // Throw IAE throw new InvalidArgumentException('Parameter "key" is empty'); } // Is an instance there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s]?=%d', $key, intval(isset(self::$registryInstances[$key])))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s]?=%d', $key, intval(isset(self::$registryInstances[$key])))); if (!isset(self::$registryInstances[$key])) { // Not yet, so create one self::$registryInstances[$key] = new ObjectRegistry(); } // Return the instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s]=%s - EXIT!', $key, self::$registryInstances[$key]->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s]=%s - EXIT!', $key, self::$registryInstances[$key]->__toString())); return self::$registryInstances[$key]; } @@ -94,18 +94,18 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister { */ public function instanceExists (string $instanceKey) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); if (empty($instanceKey)) { // Throw IAE throw new InvalidArgumentException('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Does this key exists? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->isGenericArrayKeySet(registry, instance, %s) ...', $instanceKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->isGenericArrayKeySet(registry, instance, %s) ...', $instanceKey)); $exists = $this->isGenericArrayKeySet('registry', 'instance', $instanceKey); // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: exists=%d - EXIT!', intval($exists))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: exists=%d - EXIT!', intval($exists))); return $exists; } @@ -128,18 +128,18 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister { */ public function addInstance (string $instanceKey, Registerable $objectInstance) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s,objectInstance=%s - CALLED!', $instanceKey, $objectInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s,objectInstance=%s - CALLED!', $instanceKey, $objectInstance->__toString())); if (empty($instanceKey)) { // Throw IAE throw new InvalidArgumentExeption('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Set entry in generic array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->setGenericArrayKey(registry,instance,%s,%s) ...', $instanceKey, $objectInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->setGenericArrayKey(registry,instance,%s,%s) ...', $instanceKey, $objectInstance->__toString())); $this->setGenericArrayKey('registry', 'instance', $instanceKey, $objectInstance); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: EXIT!'); } /** @@ -152,25 +152,25 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister { */ public function getInstance (string $instanceKey) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); if (empty($instanceKey)) { // Throw IAE throw new InvalidArgumentException('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is the instance there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->instanceExists(%s) ...', $instanceKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->instanceExists(%s) ...', $instanceKey)); if (!$this->instanceExists($instanceKey)) { // This might happen if a non-registered key was requested throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } // Get the instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->getGenericArrayKey(registry,instance,%s) ...', $instanceKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->getGenericArrayKey(registry,instance,%s) ...', $instanceKey)); $objectInstance = $this->getGenericArrayKey('registry', 'instance', $instanceKey); // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: objectInstance=%s - EXIT!', $objectInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: objectInstance=%s - EXIT!', $objectInstance->__toString())); return $objectInstance; }