]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 18 Feb 2023 02:10:06 +0000 (03:10 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 18 Feb 2023 02:10:06 +0000 (03:10 +0100)
- changed to generic exceptions
- introduced EXCEPTION_BAD_METHOD_CALL exception code

12 files changed:
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/criteria/class_BaseCriteria.php
framework/main/classes/feature/class_FrameworkFeature.php
framework/main/classes/helper/class_BaseHelper.php
framework/main/classes/iterator/file/class_FileIterator.php
framework/main/classes/iterator/registry/class_RegistryIterator.php
framework/main/classes/stacker/class_BaseStacker.php
framework/main/classes/stacker/fifo/class_FiFoStacker.php
framework/main/classes/stacker/file/class_BaseFileStack.php
framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php
framework/main/classes/stacker/filo/class_FiLoStacker.php
framework/main/interfaces/stacker/class_Stackable.php

index a22be776047b4fd5dac3ffffe534344297d79302..b4e203a076bd3964f4b39e4ebc1907b1a16c8063 100644 (file)
@@ -1124,7 +1124,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isGenericArrayGroupSet($keyGroup, $subGroup)) {
                        // No, then abort here
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s not found.', $keyGroup, $subGroup));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s not found.', $keyGroup, $subGroup), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Return it
@@ -1283,7 +1283,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (($forceInit === false) && ($this->isGenericArrayGroupSet($keyGroup, $subGroup))) {
                        // Already initialized
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s already initialized.', $keyGroup, $subGroup));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s already initialized.', $keyGroup, $subGroup), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Initialize it
@@ -1315,7 +1315,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (($forceInit === false) && ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key))) {
                        // Already initialized
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s already initialized.', $keyGroup, $subGroup, gettype($key), $key));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s already initialized.', $keyGroup, $subGroup, gettype($key), $key), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Initialize it
@@ -1351,7 +1351,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (($forceInit === false) && ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element))) {
                        // Already initialized
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s,element[%s]=%s already initialized.', $keyGroup, $subGroup, gettype($key), $key, gettype($element), $element));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s,element[%s]=%s already initialized.', $keyGroup, $subGroup, gettype($key), $key, gettype($element), $element), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Initialize it
@@ -1458,7 +1458,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
                        // Not found
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Then "pop" it
@@ -1494,7 +1494,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
                        // Not found
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Then "shift" it
@@ -1522,7 +1522,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!isset($this->genericArray[$keyGroup])) {
                        // Not found
-                       throw new BadMethodCallException(sprintf('keyGroup=%s not found.', $keyGroup));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s not found.', $keyGroup), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Then count it
@@ -1553,7 +1553,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isGenericArrayGroupSet($keyGroup, $subGroup)) {
                        // Abort here
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s not found.', $keyGroup, $subGroup));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s not found.', $keyGroup, $subGroup), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Then count it
@@ -1588,10 +1588,10 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
                        // Abort here
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif (!$this->isValidGenericArrayGroup($keyGroup, $subGroup)) {
                        // Not valid
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s is not a valid key/sub group.', $keyGroup, $subGroup));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s is not a valid key/sub group.', $keyGroup, $subGroup), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Then count it
@@ -1618,7 +1618,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!isset($this->genericArray[$keyGroup])) {
                        // Then abort here
-                       throw new BadMethodCallException(sprintf('keyGroup=%s not found', $keyGroup));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s not found', $keyGroup), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Return it
@@ -1650,7 +1650,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isValidGenericArrayGroup($keyGroup, $subGroup)) {
                        // Then abort here
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s not found', $keyGroup));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s not found', $keyGroup), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Set value here
@@ -1681,7 +1681,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
                        // Then abort here
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Return it
@@ -1751,7 +1751,7 @@ Loaded includes:
                        throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) {
                        // Then abort here
-                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s,element[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key, gettype($element), $element));
+                       throw new BadMethodCallException(sprintf('keyGroup=%s,subGroup=%s,key[%s]=%s,element[%s]=%s not found.', $keyGroup, $subGroup, gettype($key), $key, gettype($element), $element), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Return it
index b9e860659dcde77095ba2654cbffdd625e8060dc..4c59aef6357916ee53af8fda887f44d750825f0a 100644 (file)
@@ -670,7 +670,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                        throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType));
                } elseif (!$this->isValidGenericArrayGroup('criteria', $criteriaType)) {
                        // Not intialized yet
-                       throw new BadMethodCallException(sprintf('Method cannot be invoked before criteriaType=%s is initialized!', $criteriaType));
+                       throw new BadMethodCallException(sprintf('Method cannot be invoked before criteriaType=%s is initialized!', $criteriaType), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Initialize the key
index f3597d2de15d930295d36591b76c45c85879b85c..58610e4082649beacdc3cf438e33cb7e2e49665b 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
 
 // Import SPL stuff
+use \BadMethodCallException;
 use \InvalidArgumentException;
 
 /**
@@ -164,15 +165,23 @@ class FrameworkFeature extends BaseFrameworkSystem {
         * @param       $featureMethod  Method name of the feature's class
         * @param       $args                   Any arguments that should be handled over
         * @return      $return                 Anything the feature's method has returned
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
+        * @throws      BadMethodCallException  If this method has been invoked but the feature isn't available
         * @throws      FeatureMethodNotCallableException       If the requested method cannot be called
         */
-       public static function callFeature ($featureName, $featureMethod, array $args = NULL) {
-               /*
-                * Please make sure that isFeatureAvailable() has been called and it has
-                * returned true before calling this method.
-                */
+       public static function callFeature (string $featureName, string $featureMethod, array $args = NULL) {
+               // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s,featureMethod=%s,args[]=%s - CALLED!', $featureName, $featureMethod, gettype($args)));
-               assert(self::isFeatureAvailable($featureName));
+               if (empty($featureName)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "featureName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               } elseif (empty($featureMethod)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "featureMethod" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               } elseif (!self::isFeatureAvailable($featureName)) {
+                       // Throw BMCE
+                       throw new BadMethodCallException(sprintf('Feature "%s" is not available but method "%s" should be invoked.', $featureName, $featureMethod), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
+               }
 
                // Array for call-back
                $callable = array(
index 413655db6ab6bc2c06b991aeb7d35f61f8406c43..055420e0743e50aa910ac3fc700204655ee67219 100644 (file)
@@ -78,11 +78,10 @@ abstract class BaseHelper extends BaseFrameworkSystem {
        private $totalCounter = 0;
 
        // Exception constants
-       const EXCEPTION_GROUP_NOT_OPENED             = 0x1e3;
-       const EXCEPTION_GROUP_ALREADY_FOUND          = 0x1e4;
-       const EXCEPTION_SUB_GROUP_ALREADY_FOUND      = 0x1e5;
-       const EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED = 0x1e6;
-       const EXCEPTION_NO_PREVIOUS_GROUP_OPENED     = 0x1e7;
+       const EXCEPTION_GROUP_NOT_OPENED             = 0x1e0;
+       const EXCEPTION_SUB_GROUP_ALREADY_FOUND      = 0x1e1;
+       const EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED = 0x1e2;
+       const EXCEPTION_NO_PREVIOUS_GROUP_OPENED     = 0x1e3;
 
        /**
         * Protected constructor
@@ -315,7 +314,7 @@ abstract class BaseHelper extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "groupId" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (isset($this->groups[$groupId])) {
                        // Then throw an exception here
-                       throw new BadMethodCallException(sprintf('[%s:%d]: groupId=%s is already opened.', $this->__toString(), $groupId), self::EXCEPTION_GROUP_ALREADY_FOUND);
+                       throw new BadMethodCallException(sprintf('[%s:%d]: groupId=%s is already opened.', $this->__toString(), $groupId), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif (empty($content)) {
                        // Throw IAE
                        throw new InvalidArgumentException('Parameter "content" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
index 7ebae5f0dc949c8daac41e5277b7dcf4aea793b8..da4ca9b3f7b666eb848487acbaef43cbd4340746 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Iterator\File;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Iterator\BaseIterator;
 use Org\Mxchange\CoreFramework\Traits\File\BinaryFileTrait;
 
@@ -79,7 +80,7 @@ class FileIterator extends BaseIterator implements SeekableIterator {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
                if (!$this->valid()) {
                        // Throw BMCE
-                       throw new BadMethodCallException('Current key cannot be valid, forgot to invoke valid()?');
+                       throw new BadMethodCallException('Current key cannot be valid, forgot to invoke valid()?', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Call file instance
@@ -101,7 +102,7 @@ class FileIterator extends BaseIterator implements SeekableIterator {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
                if (!$this->valid()) {
                        // Throw BMCE
-                       throw new BadMethodCallException('Current key cannot be valid, forgot to invoke valid()?');
+                       throw new BadMethodCallException('Current key cannot be valid, forgot to invoke valid()?', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Get key from file instance
index f8762d9aa25825f3b8e2e480bbbe0aacef24870d..6efdb0f4b15ec00a87a940445eb6625a5a573051 100644 (file)
@@ -278,10 +278,10 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry {
                //* 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!
-                       throw new BadMethodCallException(sprintf('this->key[%s]=%s is no longer valid, but method was called.', gettype($this->key()), $this->key()));
+                       throw new BadMethodCallException(sprintf('this->key[%s]=%s is no longer valid, but method was called.', gettype($this->key()), $this->key()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif ((count($this->registryKeys['generic']) == 0) && (count($this->registryKeys['instance']) == 0)) {
                        // Both arrays are empty
-                       throw new BadMethodCallException('No array elements in "generic" and "instance" found but method called.');
+                       throw new BadMethodCallException('No array elements in "generic" and "instance" found but method called.', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Default is not valid
@@ -305,7 +305,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(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()));
+                       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);
                } elseif ($registryType == 'invalid') {
                        // Not changed!
                        throw new UnexpectedValueException('registryType has not been changed.');
@@ -330,10 +330,10 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry {
                //* 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!
-                       throw new BadMethodCallException(sprintf('this->key=%s is already first element, but method was called.', $this->key()));
+                       throw new BadMethodCallException(sprintf('this->key=%s is already first element, but method was called.', $this->key()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif ((count($this->registryKeys['generic']) == 0) && (count($this->registryKeys['instance']) == 0)) {
                        // Both arrays are empty
-                       throw new BadMethodCallException('No array elements in "generic" and "instance" found but method called.');
+                       throw new BadMethodCallException('No array elements in "generic" and "instance" found but method called.', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Get first array element ...
index 3480ddb7b616f8a9c3ec0f2384f3ab03d4c700fd..8bbb1a8fafea9073c909c7b3b95753c9bd075cc8 100644 (file)
@@ -34,12 +34,6 @@ use \InvalidArgumentException;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseStacker extends BaseFrameworkSystem {
-       // Exception codes
-       const EXCEPTION_STACKER_ALREADY_INITIALIZED = 0x050;
-       const EXCEPTION_STACKER_IS_FULL             = 0x051;
-       const EXCEPTION_NO_STACKER_FOUND            = 0x052;
-       const EXCEPTION_STACKER_IS_EMPTY            = 0x053;
-
        /**
         * Array "caches" configuration entries for saving "expensive" method
         * invocations
@@ -74,7 +68,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (($forceReInit === false) && ($this->isStackInitialized($stackerName))) {
                        // Then throw the exception
-                       throw new BadMethodCallException(array($this, $stackerName, $forceReInit), self::EXCEPTION_STACKER_ALREADY_INITIALIZED);
+                       throw new BadMethodCallException(array($this, $stackerName, $forceReInit), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Initialize the given stack and "cache" configuration entry
@@ -149,7 +143,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // So, is the stack full?
@@ -176,7 +170,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // So, is the stack empty?
@@ -203,7 +197,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now, count the array of entries
@@ -232,10 +226,10 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif ($this->isStackFull($stackerName)) {
                        // Stacker is full
-                       throw new FullStackerException([$this, $stackerName, $value], self::EXCEPTION_STACKER_IS_FULL);
+                       throw new BadMethodCallException(sprintf('stackerName=%s is full but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now add the value to the stack
@@ -262,10 +256,10 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Calculate last index
@@ -296,10 +290,10 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now get the first value
@@ -327,10 +321,10 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException(sprintf('stackerName=%s is empty but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now, remove the last entry, we don't care about the return value here, see elseif() block above
@@ -358,10 +352,10 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (!$this->isStackInitialized($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now, remove the last entry, we don't care about the return value here, see elseif() block above
index c19b614a43b5a22a5101d2d8907d885c3b465129..0e5fa9cd632e52ac1dfda23257f9d07591b96bab 100644 (file)
@@ -64,7 +64,7 @@ class FiFoStacker extends BaseStacker implements Stackable {
         * @param       $value                  Value to push on it
         * @return      void
         * @throws      InvalidArgumentException        If a parameter is invalid
-        * @throws      StackerFullException    If the stack is full
+        * @throws      BadMethodCallException  If the stack is full
         */
        public function pushNamed (string $stackerName, $value) {
                // Validate parameter
index 5a0fd38c7f3ae4ed13f26148f3727010c3822e10..ac3c6051c4937de27b9d0b5f5a381eef9d2eb4ea 100644 (file)
@@ -322,7 +322,7 @@ abstract class BaseFileStack extends BaseStacker {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($this->isStackFull($stackerName)) {
                        // Stacker is full
-                       throw new FullStackerException([$this, $stackerName, $value], self::EXCEPTION_STACKER_IS_FULL);
+                       throw new BadMethodCallException(sprintf('stackerName=%s is full but method call.', $stackerName), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                } elseif (is_resource($value) || is_object($value)) {
                        // Not wanted type
                        throw new InvalidArgumentException(sprintf('value[]=%s is not supported', gettype($value)));
@@ -360,7 +360,7 @@ abstract class BaseFileStack extends BaseStacker {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException([$this, $stackerName], self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException([$this, $stackerName], FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now get the last value
@@ -388,7 +388,7 @@ abstract class BaseFileStack extends BaseStacker {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException([$this, $stackerName], self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException([$this, $stackerName], FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now get the first value
@@ -416,7 +416,7 @@ abstract class BaseFileStack extends BaseStacker {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException([$this, $stackerName], self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException([$this, $stackerName], FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now, remove the last entry, we don't care about the return value here, see elseif() block above
@@ -440,7 +440,7 @@ abstract class BaseFileStack extends BaseStacker {
                        throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($this->isStackEmpty($stackerName)) {
                        // Throw an exception
-                       throw new BadMethodCallException([$this, $stackerName], self::EXCEPTION_STACKER_IS_EMPTY);
+                       throw new BadMethodCallException([$this, $stackerName], FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
                }
 
                // Now, remove the last entry, we don't care about the return value here, see elseif() block above
index 30344ab8433d7854eab88f2a3f092b3c25c86cb0..8d581e42562e1e4f46abe3a5aade47e0d609ba19 100644 (file)
@@ -82,7 +82,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable
         * @param       $value                  Value to push on it
         * @return      void
         * @throws      InvalidArgumentException        If a parameter is invalid
-        * @throws      StackerFullException    If the stack is full
+        * @throws      BadMethodCallException  If the stack is full
         */
        public function pushNamed (string $stackerName, $value) {
                // Validate parameter
index 79db994417a977ba3bfd70ad76f41b536a570c2e..16e78b02e6831c284b28dddf9a5f4d6c3b354078 100644 (file)
@@ -63,7 +63,7 @@ class FiLoStacker extends BaseStacker implements Stackable {
         * @param       $value                  Value to push on it
         * @return      void
         * @throws      InvalidArgumentException If a parameter is invalid
-        * @throws      StackerFullException    If the stack is full
+        * @throws      BadMethodCallException  If the stack is full
         */
        public function pushNamed (string $stackerName, $value) {
                // Validate parameter
index 7e61eb42cf9e212d6272b08e2ce4f9aba0a45c2c..a282544c40952871f63666dd151c2bfad88f7318 100644 (file)
@@ -34,7 +34,7 @@ interface Stackable extends FrameworkInterface {
         * @param       $stackerName    Name of the stacker
         * @param       $value                  Value to push on it
         * @return      void
-        * @throws      StackerFullException    If the stacker is full
+        * @throws      BadMethodCallException  If the stacker is full
         */
        function pushNamed (string $stackerName, $value);