From 24389037cb2694cf37afac2e5991d5fbeef3f719 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 20 Dec 2020 12:22:12 +0100 Subject: [PATCH] Continued: - NULL is no longer allowed as "empty" strings for $groupName are not allowed - this whole thing was a bit complicated core and now still is buth with no NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../main/classes/lists/class_BaseList.php | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/framework/main/classes/lists/class_BaseList.php b/framework/main/classes/lists/class_BaseList.php index acad90d5..6ec8ac4e 100644 --- a/framework/main/classes/lists/class_BaseList.php +++ b/framework/main/classes/lists/class_BaseList.php @@ -101,7 +101,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate */ public function isGroupSet (string $groupName) { // Validate parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName); if (empty($groupName)) { // Throw IAE throw new InvalidArgumentException('Parameter "groupName" is empty'); @@ -120,7 +120,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate */ public function addGroup (string $groupName) { // Validate parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ' - CALLED!'); if (empty($groupName)) { // Throw IAE throw new InvalidArgumentException('Parameter "groupName" is empty'); @@ -131,7 +131,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('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ' - EXIT!'); } /** @@ -145,7 +145,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate */ public function addInstance (string $groupName, string $subGroup, Visitable $visitableInstance) { // Validate parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',subGroup=' . $subGroup . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ',subGroup=' . $subGroup . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!'); if (empty($groupName)) { // Throw IAE throw new InvalidArgumentException('Parameter "groupName" is empty'); @@ -167,7 +167,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate $hash = $this->generateHash($groupName, $subGroup, $visitableInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',this->listGroups[' . $groupName . ']=' . $this->listGroups[$groupName]->__toString()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this->listGroups[' . $groupName . ']=' . $this->listGroups[$groupName]->__toString()); // Add the hash to the index array_push($this->listIndex, $hash); @@ -176,7 +176,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate $this->listEntries[$hash] = $visitableInstance; // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',subGroup=' . $subGroup . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ',subGroup=' . $subGroup . ' - EXIT!'); } /** @@ -186,13 +186,13 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate * @return $array The requested array * @throws NoListGroupException If the given group is not found */ - public final function getArrayFromList ($groupName) { + public final function getArrayFromList (string $groupName) { // Is the group there? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName[' . gettype($groupName) . ']=' . $groupName . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName[' . gettype($groupName) . ']=' . $groupName . ' - CALLED!'); if (empty($groupName)) { // Throw IAE throw new InvalidArgumentException('Parameter "groupName" is empty'); - } elseif ((!is_null($groupName)) && (!$this->isGroupSet($groupName))) { + } elseif (!$this->isGroupSet($groupName)) { // Throw the exception here throw new NoListGroupException(array($this, $groupName), self::EXCEPTION_GROUP_NOT_FOUND); } @@ -203,7 +203,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate // Is there another list? if (!is_null($groupName)) { // Then get it as well - $array = $this->listGroups[$groupName]->getArrayFromList(NULL); + $array = $this->listGroups[$groupName]->getArrayFromList('__'); } // Walk through all entries @@ -218,7 +218,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate } // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName[' . gettype($groupName) . ']=' . $groupName . ',[]=' . count($array) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName[' . gettype($groupName) . ']=' . $groupName . ',[]=' . count($array) . ' - EXIT!'); return $array; } @@ -232,7 +232,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate */ public function addEntry (string $groupName, $entry) { // Is the group already added? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ' - CALLED!'); if (empty($groupName)) { // Throw IAE throw new InvalidArgumentException('Parameter "groupName" is empty'); @@ -245,19 +245,19 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate $hash = $this->generateHash($groupName, $groupName, $entry); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . print_r($entry, true) . ', hash=' . $hash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: 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('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: 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('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ',listEntries()=' . count($this->listEntries) . ' - EXIT!'); } /** @@ -270,7 +270,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate */ public function removeEntry (string $groupName, $entry) { // Is the group already added? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ' - CALLED!'); if (empty($groupName)) { // Throw IAE throw new InvalidArgumentException('Parameter "groupName" is empty'); @@ -283,7 +283,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate $hash = $this->generateHash($groupName, $groupName, $entry); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . $entry . ', hash=' . $hash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ',entry=' . $entry . ', hash=' . $hash); // Remove it from the list ... unset($this->listEntries[$hash]); @@ -292,7 +292,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('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ' - EXIT!'); } /** -- 2.39.5