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
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
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
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
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
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
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
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
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
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
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
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
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
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
use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
// Import SPL stuff
+use \BadMethodCallException;
use \InvalidArgumentException;
/**
* @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(
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
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);
// 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;
//* 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
//* 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
//* 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
//* 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.');
//* 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 ...
* 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
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
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?
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?
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
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
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
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
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
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
* @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
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)));
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
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
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
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
* @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
* @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
* @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);