]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/lists/class_BaseList.php
Continued:
[core.git] / framework / main / classes / lists / class_BaseList.php
index 02b588d4cb4e69fb1bae8d370a94489ef2ebb301..08d60de88167a0d48da4e269b983e8dc52424830 100644 (file)
@@ -43,17 +43,17 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
        /**
         * List groups array
         */
-       private $listGroups = array();
+       private $listGroups = [];
 
        /**
         * List entries array
         */
-       private $listEntries = array();
+       private $listEntries = [];
 
        /**
         * List index array
         */
-       private $listIndex = array();
+       private $listIndex = [];
 
        /**
         * Protected constructor
@@ -61,7 +61,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @param       $className      Name of the class
         * @return      void
         */
-       protected function __construct ($className) {
+       protected function __construct (string $className) {
                // Call parent constructor
                parent::__construct($className);
        }
@@ -95,7 +95,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @return      $isset          Whether the group is valid
         */
        public function isGroupSet ($groupName) {
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName);
                return isset($this->listGroups[$groupName]);
        }
 
@@ -107,7 +107,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @throws      ListGroupAlreadyAddedException  If the given group is already added
         */
        public function addGroup ($groupName) {
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
                // Is the group already added?
                if ($this->isGroupSet($groupName)) {
                        // Throw the exception here
@@ -116,7 +116,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
 
                // Add the group which is a simple array
                $this->listGroups[$groupName] = ObjectFactory::createObjectByConfiguredName('list_group_class');
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!');
        }
 
        /**
@@ -130,7 +130,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         */
        public function addInstance ($groupName, $subGroup, Visitable $visitableInstance) {
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
 
                // Is the group there?
                if (!$this->isGroupSet($groupName)) {
@@ -148,7 +148,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                $hash = $this->generateHash($groupName, $subGroup, $visitableInstance);
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',this->listGroups[' . $groupName . ']=' . $this->listGroups[$groupName]->__toString());
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',this->listGroups[' . $groupName . ']=' . $this->listGroups[$groupName]->__toString());
 
                // Add the hash to the index
                array_push($this->listIndex, $hash);
@@ -157,7 +157,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                $this->listEntries[$hash] = $visitableInstance;
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ' - EXIT!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ' - EXIT!');
        }
 
        /**
@@ -169,7 +169,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         */
        public final function getArrayFromList ($list) {
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',list[' . gettype($list) . ']=' . $list . ' - CALLED!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',list[' . gettype($list) . ']=' . $list . ' - CALLED!');
 
                // Is the group there?
                if ((!is_null($list)) && (!$this->isGroupSet($list))) {
@@ -178,7 +178,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                } // END - if
 
                // Init array
-               $array = array();
+               $array = [];
 
                // Is there another list?
                if (!is_null($list)) {
@@ -189,18 +189,18 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                // Walk through all entries
                foreach ($this->listIndex as $hash) {
                        // Debug message
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash);
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: hash=' . $hash);
 
                        // Is the list entry set?
                        if ($this->isHashValid($hash)) {
                                // Add it
                                array_push($array, $this->listEntries[$hash]);
-                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash . ',array(' . count($array) . ')=' . print_r($array, true) . ' - ADDED!');
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: hash=' . $hash . ',array(' . count($array) . ')=' . print_r($array, true) . ' - ADDED!');
                        } // END - if
                } // END - foreach
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',list[' . gettype($list) . ']=' . $list . ',array()=' . count($array) . ' - EXIT!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',list[' . gettype($list) . ']=' . $list . ',[]=' . count($array) . ' - EXIT!');
 
                // Return it
                return $array;
@@ -216,7 +216,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         */
        public function addEntry ($groupName, $entry) {
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
 
                // Is the group already added?
                if (!$this->isGroupSet($groupName)) {
@@ -228,19 +228,19 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                $hash = $this->generateHash($groupName, $groupName, $entry);
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . print_r($entry, true) . ', hash=' . $hash);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . print_r($entry, true) . ', hash=' . $hash);
 
                // Add the hash to the index
                array_push($this->listIndex, $hash);
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries));
 
                // Now add the entry to the list
                $this->listEntries[$hash] = $entry;
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries) . ' - EXIT!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries) . ' - EXIT!');
        }
 
        /**
@@ -253,7 +253,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         */
        public function removeEntry ($groupName, $entry) {
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
 
                // Is the group already added?
                if (!$this->isGroupSet($groupName)) {
@@ -265,7 +265,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                $hash = $this->generateHash($groupName, $groupName, $entry);
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . $entry . ', hash=' . $hash);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . $entry . ', hash=' . $hash);
 
                // Remove it from the list ...
                unset($this->listEntries[$hash]);
@@ -274,7 +274,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                unset($this->listIndex[array_search($hash, $this->listIndex)]);
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!');
        }
 
        /**
@@ -309,7 +309,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                        $entry2 = $this->getCallbackInstance()->generateListHashFromEntry($entry);
                } else {
                        // Unsupported type detected
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST[' . __METHOD__ . ':' . __LINE__ . ']: Entry type ' . gettype($entry) . ' is unsupported (this->callbackInstance=' . $this->getCallbackInstance() . ').');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: Entry type ' . gettype($entry) . ' is unsupported (this->callbackInstance=' . $this->getCallbackInstance() . ').');
 
                        // At least take all keys from array
                        $entry2 = gettype($entry) . ':' . implode(':', array_keys($entry));
@@ -356,8 +356,8 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                $this->listGroups[$groupName]->clearList();
 
                // Clear this list
-               $this->listIndex = array();
-               $this->listEntries = array();
+               $this->listIndex = [];
+               $this->listEntries = [];
        }
        
        /**
@@ -436,7 +436,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                } // END - if
 
                // Init the entries' array
-               $entries = array();
+               $entries = [];
 
                // Get an iterator
                $iteratorInstance = $this->listGroups[$groupName]->getIterator();