From 287198e6942b1a08c760c92d83b52105d10a11cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 17 Feb 2023 03:57:40 +0100 Subject: [PATCH] Continued: - introduced exception code for InvalidArgumentException --- .../bootstrap/class_FrameworkBootstrap.php | 3 +- .../config/class_FrameworkConfiguration.php | 10 +- framework/loader/class_ClassLoader.php | 7 +- .../classes/class_BaseFrameworkSystem.php | 156 +++++++++--------- .../classes/criteria/class_BaseCriteria.php | 45 ++--- .../dataset/class_DataSetCriteria.php | 3 +- .../criteria/search/class_SearchCriteria.php | 5 +- .../class_CachedLocalFileDatabase.php | 8 +- .../result/class_CachedDatabaseResult.php | 2 +- .../classes/factories/class_BaseFactory.php | 5 +- .../index/class_FileStackIndexFactory.php | 3 +- .../factories/objects/class_ObjectFactory.php | 3 +- .../stacks/class_FileStackFactory.php | 5 +- .../xml/class_XmlTemplateEngineFactory.php | 3 +- .../feature/class_FrameworkFeature.php | 5 +- .../binary/class_BaseBinaryFile.php | 9 +- .../binary/index/class_IndexFile.php | 5 +- .../binary/stack/class_StackFile.php | 5 +- .../class_FrameworkDirectoryPointer.php | 3 +- .../class_FrameworkFileInputOutputPointer.php | 5 +- .../class_FrameworkRawFileOutputPointer.php | 5 +- .../class_FrameworkTextFileOutputPointer.php | 5 +- .../text/input/csv/class_CsvInputFile.php | 3 +- .../handler/tasks/class_TaskHandler.php | 2 +- .../main/classes/helper/class_BaseHelper.php | 6 +- .../index/file/class_BaseFileIndex.php | 3 +- .../index/file/stack/class_FileStackIndex.php | 3 +- .../classes/language/class_LanguageSystem.php | 3 +- .../main/classes/lists/class_BaseList.php | 22 +-- .../classes/parser/xml/class_XmlParser.php | 3 +- .../classes/registry/class_BaseRegistry.php | 3 +- .../action/class_BaseActionResolver.php | 5 +- .../action/html/class_HtmlActionResolver.php | 3 +- .../command/class_BaseCommandResolver.php | 9 +- .../console/class_ConsoleCommandResolver.php | 5 +- .../html/class_HtmlCommandResolver.php | 3 +- .../image/class_ImageCommandResolver.php | 3 +- .../class_BaseControllerResolver.php | 5 +- .../class_ConsoleControllerResolver.php | 5 +- .../html/class_HtmlControllerResolver.php | 5 +- .../image/class_ImageControllerResolver.php | 5 +- .../classes/stacker/class_BaseStacker.php | 23 +-- .../stacker/fifo/class_FiFoStacker.php | 9 +- .../stacker/file/class_BaseFileStack.php | 23 +-- .../stacker/file/fifo/class_FiFoFileStack.php | 9 +- .../stacker/filo/class_FiLoStacker.php | 9 +- .../template/class_BaseTemplateEngine.php | 3 +- .../xml/class_BaseXmlTemplateEngine.php | 3 +- .../tools/console/class_ConsoleTools.php | 7 +- .../main/classes/user/guest/class_Guest.php | 5 +- .../main/classes/user/member/class_Member.php | 5 +- .../classes/utils/arrays/class_ArrayUtils.php | 5 +- .../utils/crypto/class_CryptoUtils.php | 3 +- .../utils/strings/class_StringUtils.php | 5 +- .../interfaces/class_FrameworkInterface.php | 3 + .../database/class_DatabaseConnection.php | 7 +- .../class_TestsConsoleCommandResolver.php | 3 +- .../class_TestsConsoleControllerResolver.php | 3 +- 58 files changed, 289 insertions(+), 232 deletions(-) diff --git a/framework/bootstrap/class_FrameworkBootstrap.php b/framework/bootstrap/class_FrameworkBootstrap.php index 92dca68e..de4aac3d 100644 --- a/framework/bootstrap/class_FrameworkBootstrap.php +++ b/framework/bootstrap/class_FrameworkBootstrap.php @@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Connector\Database\DatabaseConnector; use Org\Mxchange\CoreFramework\Console\Tools\ConsoleTools; use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Localization\ManageableLanguage; @@ -483,7 +484,7 @@ final class FrameworkBootstrap { // Is it set? if (empty($timezone)) { // Entry is empty - throw new InvalidArgumentException('timezone is empty'); + throw new InvalidArgumentException('Parameter "timezone" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Default success diff --git a/framework/config/class_FrameworkConfiguration.php b/framework/config/class_FrameworkConfiguration.php index f5d60c17..b9c549aa 100644 --- a/framework/config/class_FrameworkConfiguration.php +++ b/framework/config/class_FrameworkConfiguration.php @@ -90,7 +90,7 @@ class FrameworkConfiguration implements Registerable { //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey); if (empty($configKey)) { // Entry is empty - throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('Parameter "configKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is it set? @@ -114,7 +114,7 @@ class FrameworkConfiguration implements Registerable { //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey); if (empty($configKey)) { // Entry is empty - throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('Parameter "configKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Convert dashes to underscore @@ -146,7 +146,7 @@ class FrameworkConfiguration implements Registerable { //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s,configValue[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey, gettype($configValue)); if (empty($configKey)) { // Entry is empty - throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('Parameter "configKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((is_array($configValue)) || (is_object($configValue)) || (is_resource($configValue))) { // These cannot be set as this is not intended for configuration values, please use FrameworkArrayObject instead. throw new InvalidArgumentException(sprintf('configValue[]=%s for configKey=%s is not supported.', gettype($configValue), $configKey), self::EXCEPTION_CONFIG_VALUE_TYPE_UNSUPPORTED); @@ -201,7 +201,7 @@ class FrameworkConfiguration implements Registerable { //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey); if (empty($configKey)) { // Entry is empty - throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('Parameter "configKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Convert dashes to underscore @@ -235,7 +235,7 @@ class FrameworkConfiguration implements Registerable { //* NOISY-DEBUG: */ printf('[%s:%d]: keyPart=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $keyPart); if (empty($keyPart)) { // Entry is empty - throw new InvalidArgumentException('Parameter "keyPart" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('Parameter "keyPart" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Construct final config key diff --git a/framework/loader/class_ClassLoader.php b/framework/loader/class_ClassLoader.php index 7764cb3d..b31d21fb 100644 --- a/framework/loader/class_ClassLoader.php +++ b/framework/loader/class_ClassLoader.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Loader; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; // Import SPL stuff use \InvalidArgumentException; @@ -347,7 +348,7 @@ final class ClassLoader { // Validate parameter if (empty($relativePath)) { // Should not be empty - throw new InvalidArgumentException('Parameter "relativePath" is empty'); + throw new InvalidArgumentException('Parameter "relativePath" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // "Register" it @@ -370,7 +371,7 @@ final class ClassLoader { //* NOISY-DEBUG: */ printf('[%s:%d] className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className); if (empty($className)) { // Should not be empty - throw new InvalidArgumentException('Parameter "className" is empty'); + throw new InvalidArgumentException('Parameter "className" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // The class name MUST be at least Tld\Domain\Project\Package\SomeFooBar so split at them @@ -446,7 +447,7 @@ final class ClassLoader { //* NOISY-DEBUG: */ printf('[%s:%d] basePath=%s,ignoreList()=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $basePath, count($ignoreList)); if (empty($basePath)) { // Throw IAE - throw new InvalidArgumentException('Parameter "basePath" is empty'); + throw new InvalidArgumentException('Parameter "basePath" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($this->listCached === true) { // Abort here //* NOISY-DEBUG: */ printf('[%s:%d] this->listCache=true - EXIT!' . PHP_EOL, __METHOD__, __LINE__); diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index 63f0ae60..822debf9 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -602,7 +602,7 @@ Loaded includes: // Validate parameter if (empty($className)) { // Throw IAE - throw new InvalidArgumentException('Parameter "className" is empty'); + throw new InvalidArgumentException('Parameter "className" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!GenericRegistry::getRegistry()->instanceExists('debug')) { // Init debug instance $debugInstance = NULL; @@ -799,7 +799,7 @@ Loaded includes: // Check parameter if (empty($fieldName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "fieldName" is empty'); + throw new InvalidArgumentException('Parameter "fieldName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // This method is deprecated @@ -852,7 +852,7 @@ Loaded includes: // Check parameter if (empty($fieldName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "fieldName" is empty'); + throw new InvalidArgumentException('Parameter "fieldName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get result instance @@ -914,7 +914,7 @@ Loaded includes: // Check parameter if (empty($phpExtension)) { // Throw IAE - throw new InvalidArgumentException('Parameter "phpExtension" is empty'); + throw new InvalidArgumentException('Parameter "phpExtension" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is it loaded? @@ -984,7 +984,7 @@ Loaded includes: // Check parameter if (empty($encodedData)) { // Throw IAE - throw new InvalidArgumentException('Parameter "encodedData" is empty'); + throw new InvalidArgumentException('Parameter "encodedData" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Determine it @@ -1030,16 +1030,16 @@ Loaded includes: // Check parameter if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($element === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "element" is empty'); + throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is it there? @@ -1062,13 +1062,13 @@ Loaded includes: // Check parameter if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is it there? @@ -1092,10 +1092,10 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is it there? @@ -1119,10 +1119,10 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + 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)); @@ -1146,13 +1146,13 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Remove it @@ -1174,16 +1174,16 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($element === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "element" is empty'); + throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Remove it @@ -1205,13 +1205,13 @@ Loaded includes: //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is it already there? @@ -1240,16 +1240,16 @@ Loaded includes: //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($element === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "element" is empty'); + throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is it already there? @@ -1278,10 +1278,10 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',forceInit=' . intval($forceInit)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + 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)); @@ -1307,13 +1307,13 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',forceInit=' . intval($forceInit)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + 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)); @@ -1340,16 +1340,16 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',forceInit=' . intval($forceInit)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($element === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "element" is empty'); + 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)); @@ -1374,13 +1374,13 @@ Loaded includes: //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Initialize array $this->initGenericArrayKey($keyGroup, $subGroup, $key); @@ -1411,16 +1411,16 @@ Loaded includes: //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($element === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "element" is empty'); + throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { // Initialize array $this->initGenericArrayElement($keyGroup, $subGroup, $key, $element); @@ -1450,13 +1450,13 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + 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)); @@ -1486,13 +1486,13 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + 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)); @@ -1520,7 +1520,7 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + 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)); @@ -1548,10 +1548,10 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + 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)); @@ -1580,13 +1580,13 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + 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)); @@ -1616,7 +1616,7 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + 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)); @@ -1642,13 +1642,13 @@ Loaded includes: //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + 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)); @@ -1673,13 +1673,13 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + 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)); @@ -1705,16 +1705,16 @@ Loaded includes: //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true)); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($element === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "element" is empty'); + throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { // Initialize array $this->initGenericArrayElement($keyGroup, $subGroup, $key, $element); @@ -1740,16 +1740,16 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($element === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "element" is empty'); + 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)); @@ -1772,10 +1772,10 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Determine it @@ -1798,13 +1798,13 @@ Loaded includes: //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); if (empty($keyGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "keyGroup" is empty'); + throw new InvalidArgumentException('Parameter "keyGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Determine it diff --git a/framework/main/classes/criteria/class_BaseCriteria.php b/framework/main/classes/criteria/class_BaseCriteria.php index 0931688f..b9e86065 100644 --- a/framework/main/classes/criteria/class_BaseCriteria.php +++ b/framework/main/classes/criteria/class_BaseCriteria.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Criteria; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Criteria\Search\SearchCriteria; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; @@ -80,7 +81,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType)); if (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaType=%s is not supported', $criteriaType)); @@ -105,13 +106,13 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaType=%s,criteriaKey=%s - CALLED!', strtoupper($criteriaType), $criteriaType, $criteriaKey)); if (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); } elseif (empty($criteriaKey)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -138,7 +139,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey)); if (empty($criteriaKey)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Invoke inner method @@ -158,7 +159,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey)); if (empty($criteriaKey)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Invoke inner method @@ -198,7 +199,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType)); if (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); @@ -240,7 +241,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey)); if (empty($criteriaKey)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -277,7 +278,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType)); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -286,7 +287,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { throw new InvalidArgumentException(sprintf('value[]=%s is not supported', gettype($criteriaValue))); } elseif (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); @@ -319,7 +320,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s$criteriaValue,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType)); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -328,7 +329,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { throw new InvalidArgumentException(sprintf('value[]=%s is not supported', gettype($criteriaValue))); } elseif (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); @@ -360,7 +361,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[]=%s - CALLED!', $criteriaKey, gettype($criteriaValue))); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -391,7 +392,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s - CALLED!', $criteriaKey, gettype($criteriaValue), $criteriaValue)); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -422,16 +423,16 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,configEntry=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $configEntry, $criteriaType)); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); } elseif (empty($configEntry)) { // Throw it again - throw new InvalidArgumentException('Parameter "configEntry" is empty'); + throw new InvalidArgumentException('Parameter "configEntry" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); @@ -462,13 +463,13 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $criteriaType)); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); } elseif (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); @@ -505,7 +506,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey)); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -528,7 +529,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey)); if (empty($criteriaKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "criteriaKey" is empty'); + throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); @@ -556,7 +557,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { throw new InvalidArgumentException('entryArray cannot be an empty array'); } elseif (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); @@ -663,7 +664,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: onlyKeys()=%d,criteriaType=%s - CALLED!', strtoupper($criteriaType), count($onlyKeys), $criteriaType)); if (empty($criteriaType)) { // Throw it again - throw new InvalidArgumentException('Parameter "criteriaType" is empty'); + throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!in_array($criteriaType, self::$CRITERIA_TYPES)) { // Throw it again throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType)); diff --git a/framework/main/classes/criteria/dataset/class_DataSetCriteria.php b/framework/main/classes/criteria/dataset/class_DataSetCriteria.php index d05befee..e5f8621b 100644 --- a/framework/main/classes/criteria/dataset/class_DataSetCriteria.php +++ b/framework/main/classes/criteria/dataset/class_DataSetCriteria.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Criteria\BaseCriteria; use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria; use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria; use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; // Import SPL stuff use \InvalidArgumentException; @@ -80,7 +81,7 @@ class DataSetCriteria extends BaseCriteria implements StoreableCriteria { // Validate parameter if (empty($tableName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "tableName" is empty'); + throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get a new instance diff --git a/framework/main/classes/criteria/search/class_SearchCriteria.php b/framework/main/classes/criteria/search/class_SearchCriteria.php index eab26c60..87dd7156 100644 --- a/framework/main/classes/criteria/search/class_SearchCriteria.php +++ b/framework/main/classes/criteria/search/class_SearchCriteria.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Criteria\Search; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Criteria\BaseCriteria; use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; // Import SPL stuff use \InvalidArgumentException; @@ -140,13 +141,13 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SEARCH-CRITERIA: key=%s,value[]=%s,separator=%s - CALLED!', $key, gettype($value), $separator)); if (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (is_array($value) || is_bool($value) || is_bool($value) || is_object($value) || is_resource($value)) { // Throw it again throw new InvalidArgumentException(sprintf('value[]=%s is not supported/valid', gettype($value))); } elseif (empty($separator)) { // Throw IAE - throw new InvalidArgumentException('Parameter "separator" is empty'); + throw new InvalidArgumentException('Parameter "separator" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // "Explode" value diff --git a/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php b/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php index a4ef4ffc..67b5f95b 100644 --- a/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php +++ b/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php @@ -369,7 +369,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CACHED-LFDB: tableName=%s,searchInstance=%s - CALLED!', $tableName, $searchInstance->__toString())); if (empty($tableName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "tableName" is empty'); + throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!isset($this->pathNames[$tableName])) { // "Cache" is not present, so create and assign it $this->pathNames[$tableName] = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('local_database_path') . $tableName . DIRECTORY_SEPARATOR; @@ -540,7 +540,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac // Is "cache" there? if (empty($tableName)) { // Should never be an empty string - throw new UnexpectedValueException('Class field dataSetInstance->tableName is empty'); + throw new UnexpectedValueException('Class field dataSetInstance->tableName is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!isset($this->pathNames[$tableName])) { // "Cache" is not present, so create and assign it $this->pathNames[$tableName] = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('local_database_path') . $tableName . DIRECTORY_SEPARATOR; @@ -655,7 +655,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac // Validate parameter if (empty($tableName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "tableName" is empty'); + throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Default key is null @@ -699,7 +699,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CACHED-LFDB: tableName=' . $tableName . ' - CALLED!'); if (empty($tableName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "tableName" is empty'); + throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!isset($this->pathNames[$tableName])) { // "Cache" is not present, so create and assign it $this->pathNames[$tableName] = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('local_database_path') . $tableName . DIRECTORY_SEPARATOR; diff --git a/framework/main/classes/database/result/class_CachedDatabaseResult.php b/framework/main/classes/database/result/class_CachedDatabaseResult.php index 0e6b9fe8..95a1400a 100644 --- a/framework/main/classes/database/result/class_CachedDatabaseResult.php +++ b/framework/main/classes/database/result/class_CachedDatabaseResult.php @@ -95,7 +95,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul // Misses an element? if (count($resultArray) == 0) { // Cannot be empty - throw new InvalidArgumentException('Array "resultArray" is empty'); + throw new InvalidArgumentException('Array "resultArray" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!array_key_exists(BaseDatabaseResult::RESULT_NAME_ROWS, $resultArray)) { // Yes, then abort here throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), BaseDatabaseResult::RESULT_NAME_ROWS)); diff --git a/framework/main/classes/factories/class_BaseFactory.php b/framework/main/classes/factories/class_BaseFactory.php index 73f534d2..09f240ce 100644 --- a/framework/main/classes/factories/class_BaseFactory.php +++ b/framework/main/classes/factories/class_BaseFactory.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Factory; // Import framework stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; // Import SPL stuff @@ -63,7 +64,7 @@ abstract class BaseFactory extends BaseFrameworkSystem { // Is the parameter valid? if (empty($fullClassName)) { // No empty class name - throw new InvalidArgumentException('fullClassName is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('fullClassName is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Count it up in total sum @@ -109,7 +110,7 @@ abstract class BaseFactory extends BaseFrameworkSystem { // Is the parameter valid? if (empty($fullClassName)) { // No empty class name - throw new InvalidArgumentException('fullClassName is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('fullClassName is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Return isset() result diff --git a/framework/main/classes/factories/index/class_FileStackIndexFactory.php b/framework/main/classes/factories/index/class_FileStackIndexFactory.php index 8e144c30..af2bd401 100644 --- a/framework/main/classes/factories/index/class_FileStackIndexFactory.php +++ b/framework/main/classes/factories/index/class_FileStackIndexFactory.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Stack\File; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; // Import SPL stuff @@ -55,7 +56,7 @@ class FileStackIndexFactory extends BaseFactory { // If there is no handler? if (empty($type)) { // Throw IAE - throw new InvalidArgumentException('Parameter "type" is empty'); + throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (GenericRegistry::getRegistry()->instanceExists($type . '_index')) { // Get handler from registry $indexInstance = GenericRegistry::getRegistry()->getInstance($type . '_index'); diff --git a/framework/main/classes/factories/objects/class_ObjectFactory.php b/framework/main/classes/factories/objects/class_ObjectFactory.php index 000f4b26..94a85019 100644 --- a/framework/main/classes/factories/objects/class_ObjectFactory.php +++ b/framework/main/classes/factories/objects/class_ObjectFactory.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Object; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\BaseFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Loader\NoClassException; // Import SPL stuff @@ -59,7 +60,7 @@ class ObjectFactory extends BaseFactory { // Is the class name valid and is the class there? if (empty($fullClassName)) { // Throw an exception here - throw new InvalidArgumentException('Parameter "fullClassName" is empty'); + throw new InvalidArgumentException('Parameter "fullClassName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!self::isClassCounted($fullClassName) && !class_exists($fullClassName)) { // First get an instance of this factory $factoryInstance = new ObjectFactory(); diff --git a/framework/main/classes/factories/stacks/class_FileStackFactory.php b/framework/main/classes/factories/stacks/class_FileStackFactory.php index dcb22f62..5590785f 100644 --- a/framework/main/classes/factories/stacks/class_FileStackFactory.php +++ b/framework/main/classes/factories/stacks/class_FileStackFactory.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Stack; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; // Import SPL stuff @@ -57,10 +58,10 @@ class FileStackFactory extends BaseFactory { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-FACTORY: prefix=%s,stackName=%s - CALLED!', $prefix, $stackName)); if (empty($prefix)) { // Throw IAE - throw new InvalidArgumentException('Parameter "prefix" is empty'); + throw new InvalidArgumentException('Parameter "prefix" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($stackName)) { // Throw it again - throw new InvalidArgumentException('Paramter "stackName" is empty'); + throw new InvalidArgumentException('Paramter "stackName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Construct file stack name diff --git a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php index b9eddb49..4f51b923 100644 --- a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php +++ b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Template; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; // Import SPL stuff @@ -58,7 +59,7 @@ class XmlTemplateEngineFactory extends BaseFactory { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-TEMPLATE-ENGINE-FACTORY: configKey=%s - CALLED!', $configKey)); if (empty($configKey)) { // Throw IAE - throw new InvalidArgumentException('Paramter "configKey" is empty'); + throw new InvalidArgumentException('Paramter "configKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Do we have an instance in the registry? diff --git a/framework/main/classes/feature/class_FrameworkFeature.php b/framework/main/classes/feature/class_FrameworkFeature.php index db57e5cc..f3597d2d 100644 --- a/framework/main/classes/feature/class_FrameworkFeature.php +++ b/framework/main/classes/feature/class_FrameworkFeature.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Feature; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Loader\NoClassException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; @@ -83,7 +84,7 @@ class FrameworkFeature extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName)); if (empty($featureName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "featureName" is empty'); + throw new InvalidArgumentException('Parameter "featureName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is the cache set? @@ -116,7 +117,7 @@ class FrameworkFeature extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName)); if (empty($featureName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "featureName" is empty'); + throw new InvalidArgumentException('Parameter "featureName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is the cache set? diff --git a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php index 3f0ff4b6..9518bd5e 100644 --- a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php +++ b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php @@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\File\BaseAbstractFile; use Org\Mxchange\CoreFramework\Filesystem\FilePointer; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Traits\Index\IndexableTrait; use Org\Mxchange\CoreFramework\Traits\Stack\StackableTrait; @@ -458,7 +459,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: str=%s - CALLED!', $str)); if (empty($str)) { // Throw IAE - throw new InvalidArgumentException('Parameter "str" is empty'); + throw new InvalidArgumentException('Parameter "str" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Determine it @@ -487,7 +488,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { throw new OutOfBoundsException(sprintf('seekPosition=%d is not valid', $seekPosition)); } elseif (empty($data)) { // Empty data is invalid, too - throw new InvalidArgumentException('Parameter "data" is empty'); + throw new InvalidArgumentException('Parameter "data" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Write data at given position @@ -535,7 +536,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { throw new OutOfBoundsException(sprintf('seekPosition=%d is not valid.', $seekPosition)); } elseif (empty($dataStream)) { // Empty dataStream - throw new InvalidArgumentException('Parameter "dataStream" is empty'); + throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call pointer's method @@ -897,7 +898,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: type=%s,minimumBlockLength=%d - CALLED!', $type, $minimumBlockLength)); if (empty($type)) { // Empty type - throw new InvalidArgumentException('Parameter "type" is empty'); + throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($minimumBlockLength < 1) { // Invalid block length throw new InvalidArgumentException(sprintf('Parameter minimumBlockLength=%d is not valid', $minimumBlockLength)); diff --git a/framework/main/classes/file_directories/binary/index/class_IndexFile.php b/framework/main/classes/file_directories/binary/index/class_IndexFile.php index 10bc8520..78dac38e 100644 --- a/framework/main/classes/file_directories/binary/index/class_IndexFile.php +++ b/framework/main/classes/file_directories/binary/index/class_IndexFile.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Index; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile; use Org\Mxchange\CoreFramework\Filesystem\Index\IndexableFile; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Index\Indexable; use Org\Mxchange\CoreFramework\Utils\Crypto\CryptoUtils; @@ -112,7 +113,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('INDEX-FILE: type=%s - CALLED!', $type)); if (empty($type)) { // Empty type - throw new InvalidArgumentException('Parameter "type" is empty'); + throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!($this->getIndexInstance() instanceof Indexable)) { // Index instance not set throw new BadMethodCallException('this->indexInstance[] is not properly set.'); @@ -208,7 +209,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('INDEX-FILE: stackName=%s,value[]=%s - CALLED!', $stackName, gettype($value))); if (empty($stackName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "stackName" is empty'); + throw new InvalidArgumentException('Parameter "stackName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (is_object($value) || is_resource($value)) { // Not wanted here throw new InvalidArgumentException(sprintf('value[]=%s is not stackable in files', gettype($value))); diff --git a/framework/main/classes/file_directories/binary/stack/class_StackFile.php b/framework/main/classes/file_directories/binary/stack/class_StackFile.php index 13991972..f93dd769 100644 --- a/framework/main/classes/file_directories/binary/stack/class_StackFile.php +++ b/framework/main/classes/file_directories/binary/stack/class_StackFile.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Stack\File; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filesystem\Stack\FileStacker; use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Stack\File\StackableFile; use Org\Mxchange\CoreFramework\Utils\Crypto\CryptoUtils; @@ -110,7 +111,7 @@ class StackFile extends BaseBinaryFile implements FileStacker { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STACK-FILE: type=%s - CALLED!', $type)); if (empty($type)) { // Empty type - throw new InvalidArgumentException('Parameter "type" is empty'); + throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!($this->getStackInstance() instanceof StackableFile) && !($this->getStackInstance() instanceof StackableFile)) { // Index instance not set throw new BadMethodCallException('this->stackInstance[] and this->pointerInstance are not properly set.'); @@ -206,7 +207,7 @@ class StackFile extends BaseBinaryFile implements FileStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STACK-FILE: stackName=%s,value[]=%s - CALLED!', $stackName, gettype($value))); if (empty($stackName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "stackName" is empty'); + throw new InvalidArgumentException('Parameter "stackName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (is_object($value) || is_resource($value)) { // Not wanted here throw new InvalidArgumentException(sprintf('value[]=%s is not stackable in files', gettype($value))); diff --git a/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php b/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php index b4f79334..efc3e0d2 100644 --- a/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php +++ b/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Filesytem\Pointer; // Import framework stuff use Org\Mxchange\CoreFramework\Filesystem\FrameworkDirectory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; @@ -84,7 +85,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem implements Framework // Some pre-sanity checks... if (empty($pathName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "pathName" is empty'); + throw new InvalidArgumentException('Parameter "pathName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!is_dir($pathName)) { // Not a directory throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME); diff --git a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php index dc326cfa..54a18ac7 100644 --- a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php +++ b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php @@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Filesystem\FileIoException; use Org\Mxchange\CoreFramework\Filesystem\FileReadProtectedException; use Org\Mxchange\CoreFramework\Filesystem\FileWriteProtectedException; use Org\Mxchange\CoreFramework\Filesystem\PathWriteProtectedException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; @@ -128,7 +129,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: dataStream(%d)=%s - CALLED!', strlen($dataStream), $dataStream)); if (empty($dataStream)) { // Empty dataStream - throw new InvalidArgumentException('Parameter "dataStream" is empty'); + throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get length @@ -160,7 +161,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP throw new OutOfBoundsException(sprintf('seekPosition=%d is not valid.', $seekPosition)); } elseif (empty($dataStream)) { // Empty dataStream - throw new InvalidArgumentException('Parameter "dataStream" is empty'); + throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (($this->getFileSize() > 0 || $seekPosition > 0) && $this->seek($seekPosition) === -1) { // Could not seek throw new InvalidArgumentException(sprintf('Could not seek to seekPosition=%d', $seekPosition)); diff --git a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php index c6e47128..9c242a11 100644 --- a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Pointer\Output; use Org\Mxchange\CoreFramework\Filesystem\BaseFileIo; use Org\Mxchange\CoreFramework\Filesystem\FileIoException; use Org\Mxchange\CoreFramework\Filesystem\Pointer\OutputPointer; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; // Import SPL stuff @@ -61,7 +62,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-FILE-OUTPUT-POINTER: fileInstance=%s,mode=%s - CALLED!', $fileInstance->__toString(), $mode)); if (empty($mode)) { // No fileInstance given - throw new InvalidArgumentException('Parameter "mode" is empty'); + throw new InvalidArgumentException('Parameter "mode" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Try to open a handler @@ -102,7 +103,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-FILE-OUTPUT-POINTER: dataStream(%d)=%s (trimmed) - CALLED!', strlen($dataStream), trim($dataStream))); if (empty($dataStream)) { // Empty data stream - throw new InvalidArgumentException('Parameter "dataStream" is empty'); + throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (is_null($this->getFileObject())) { // Pointer not initialized throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); diff --git a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php index 51562b21..0df017c4 100644 --- a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Pointer\Text; use Org\Mxchange\CoreFramework\Filesystem\BaseFileIo; use Org\Mxchange\CoreFramework\Filesystem\FileIoException; use Org\Mxchange\CoreFramework\Filesystem\Pointer\OutputPointer; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; @@ -62,7 +63,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TEXT-FILE-OUTPUT-POINTER: fileInstance[%s]=%s,mode=%s - CALLED!', get_class($fileInstance), $fileInstance->__toString(), $mode)); if (empty($mode)) { // No filename given - throw new InvalidArgumentException('Parameter "mode" is empty'); + throw new InvalidArgumentException('Parameter "mode" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Try to open a handler @@ -99,7 +100,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TEXT-FILE-OUTPUT-POINTER: dataStream=%s - CALLED!', $dataStream)); if (empty($dataStream)) { // Invalid parameter - throw new InvalidArgumentException('Parameter "dataStream" is empty'); + throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (is_null($this->getFileObject())) { // Pointer not initialized throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); diff --git a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php index 22244314..85771a7f 100644 --- a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php +++ b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Input\Csv; // Import framework stuff use Org\Mxchange\CoreFramework\Filesystem\Text\BaseInputTextFile; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Stream\Filesystem\CsvInputStreamer; // Import SPL stuff @@ -77,7 +78,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] columnSeparator=%s,expectedMatches=%d - CALLED!', __METHOD__, __LINE__, $columnSeparator, $expectedMatches)); if (strlen($columnSeparator) === 0) { // No empty column separator - throw new InvalidArgumentException('Parameter "columnSeparator" is empty'); + throw new InvalidArgumentException('Parameter "columnSeparator" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($expectedMatches < 0) { // Below zero is not valid throw new InvalidArgumentException(sprintf('expectedMatches=%d is below zero', $expectedMatches)); diff --git a/framework/main/classes/handler/tasks/class_TaskHandler.php b/framework/main/classes/handler/tasks/class_TaskHandler.php index c8801b7d..9d23725f 100644 --- a/framework/main/classes/handler/tasks/class_TaskHandler.php +++ b/framework/main/classes/handler/tasks/class_TaskHandler.php @@ -240,7 +240,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Is the parameter valid if (empty($taskName)) { // Task name cannot be empty - throw new InvalidArgumentException('Parameter "taskName" is empty'); + throw new InvalidArgumentException('Parameter "taskName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get interval delay, startup delay and max runs diff --git a/framework/main/classes/helper/class_BaseHelper.php b/framework/main/classes/helper/class_BaseHelper.php index 35138c32..451cab9c 100644 --- a/framework/main/classes/helper/class_BaseHelper.php +++ b/framework/main/classes/helper/class_BaseHelper.php @@ -218,7 +218,7 @@ abstract class BaseHelper extends BaseFrameworkSystem { //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('O:'.$registryKey.'/'.$extraKey); if (empty($registryKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "registryKey" is empty'); + throw new InvalidArgumentException('Parameter "registryKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } try { @@ -265,7 +265,7 @@ abstract class BaseHelper extends BaseFrameworkSystem { //* DEBUG: */ echo "OPEN:groupId={$groupId},content=
".htmlentities($content)."
\n"; if (empty($groupId)) { // Throw IAE - throw new InvalidArgumentException('Parameter "groupId" is empty'); + throw new InvalidArgumentException('Parameter "groupId" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (isset($this->groups[$groupId])) { // Then throw an exception here throw new HelperGroupAlreadyCreatedException(array($this, $groupId), self::EXCEPTION_GROUP_ALREADY_FOUND); @@ -355,7 +355,7 @@ abstract class BaseHelper extends BaseFrameworkSystem { // Is the group already there? if (empty($subGroupId)) { // Throw IAE - throw new InvalidArgumentException('Parameter "subGroupId" is empty'); + throw new InvalidArgumentException('Parameter "subGroupId" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (isset($this->subGroups[$subGroupId])) { // Then throw an exception here throw new HelperSubGroupAlreadyCreatedException(array($this, $subGroupId), self::EXCEPTION_SUB_GROUP_ALREADY_FOUND); diff --git a/framework/main/classes/index/file/class_BaseFileIndex.php b/framework/main/classes/index/file/class_BaseFileIndex.php index 39f1cbff..b0a24772 100644 --- a/framework/main/classes/index/file/class_BaseFileIndex.php +++ b/framework/main/classes/index/file/class_BaseFileIndex.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile; use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Index\BaseIndex; use Org\Mxchange\CoreFramework\Index\Indexable; use Org\Mxchange\CoreFramework\Utils\Arrays\ArrayUtils; @@ -315,7 +316,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { throw new OutOfBoundsException(sprintf('seekPosition=%d is not valid.', $seekPosition)); } elseif (empty($dataStream)) { // Empty dataStream - throw new InvalidArgumentException('Parameter "dataStream" is empty'); + throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call iterated object's method diff --git a/framework/main/classes/index/file/stack/class_FileStackIndex.php b/framework/main/classes/index/file/stack/class_FileStackIndex.php index 4bea7db9..6cf2742f 100644 --- a/framework/main/classes/index/file/stack/class_FileStackIndex.php +++ b/framework/main/classes/index/file/stack/class_FileStackIndex.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Index\File\Stack; // Import framework stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Index\File\BaseFileIndex; use Org\Mxchange\CoreFramework\Index\File\Stack\IndexableStack; use Org\Mxchange\CoreFramework\Index\Indexable; @@ -80,7 +81,7 @@ class FileStackIndex extends BaseFileIndex implements IndexableStack, Registerab /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: stackName=%s,data()=%d - CALLED!', $stackName, count($data))); if (empty($stackName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "stackName" is empty'); + throw new InvalidArgumentException('Parameter "stackName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (count($data) == 0) { // Throw it again throw new InvalidArgumentException('Parameter "data" is an empty array'); diff --git a/framework/main/classes/language/class_LanguageSystem.php b/framework/main/classes/language/class_LanguageSystem.php index ee41676a..bc4b3673 100644 --- a/framework/main/classes/language/class_LanguageSystem.php +++ b/framework/main/classes/language/class_LanguageSystem.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Localization; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Localization\ManageableLanguage; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; use Org\Mxchange\CoreFramework\ObjectArray\FrameworkArrayObject; @@ -100,7 +101,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage, // Is the base path valid? if (empty($languageBasePath)) { // Language path is empty - throw new InvalidArgumentException('languageBasePath is still empty'); + throw new InvalidArgumentException('languageBasePath is still empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!is_dir($languageBasePath)) { // Is not a path throw new InvalidArgumentException(sprintf('languageBasePath=%s not found', $languageBasePath), self::EXCEPTION_INVALID_PATH_NAME); diff --git a/framework/main/classes/lists/class_BaseList.php b/framework/main/classes/lists/class_BaseList.php index 0e581e8a..22aba2d3 100644 --- a/framework/main/classes/lists/class_BaseList.php +++ b/framework/main/classes/lists/class_BaseList.php @@ -113,7 +113,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-LIST: groupName=%s - CALLED!', $groupName)); if (empty($groupName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "groupName" is empty'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Check on existence ... @@ -132,7 +132,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-LIST: groupName=%s - CALLED!', $groupName)); if (empty($groupName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "groupName" is empty'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($this->isGroupSet($groupName)) { // Throw the exception here throw new BadMethodCallException(sprintf('groupName=%s is already set', $groupName), self::EXCEPTION_GROUP_ALREADY_ADDED); @@ -157,10 +157,10 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate //* 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'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($subGroup)) { // Throw it again - throw new InvalidArgumentException('Parameter "subGroup" is empty'); + throw new InvalidArgumentException('Parameter "subGroup" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGroupSet($groupName)) { // Throw the exception here throw new BadMethodCallException(sprintf('groupName=%s is not a valid group', $groupName), self::EXCEPTION_GROUP_NOT_FOUND); @@ -198,7 +198,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate //* 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'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGroupSet($groupName)) { // Throw the exception here throw new BadMethodCallException(sprintf('groupName=%s is not a valid group', $groupName), self::EXCEPTION_GROUP_NOT_FOUND); @@ -243,7 +243,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ' - CALLED!'); if (empty($groupName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "groupName" is empty'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGroupSet($groupName)) { // Throw the exception here throw new BadMethodCallException(sprintf('groupName=%s is not a valid group', $groupName), self::EXCEPTION_GROUP_NOT_FOUND); @@ -281,7 +281,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: groupName=' . $groupName . ' - CALLED!'); if (empty($groupName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "groupName" is empty'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGroupSet($groupName)) { // Throw the exception here throw new BadMethodCallException(sprintf('groupName=%s is not a valid group', $groupName), self::EXCEPTION_GROUP_NOT_FOUND); @@ -377,7 +377,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate // Does this group exist? if (empty($groupName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "groupName" is empty'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGroupSet($groupName)) { // Throw the exception here throw new BadMethodCallException(sprintf('groupName=%s is not a valid group', $groupName), self::EXCEPTION_GROUP_NOT_FOUND); @@ -410,7 +410,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate // Validate parameter if (empty($hash)) { // Throw IAE - throw new InvalidArgumentException('Parameter "hash" is empty'); + throw new InvalidArgumentException('Parameter "hash" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!isset($this->cache['is_valid'][$hash])) { // Check it $this->cache['is_valid'][$hash] = ((in_array($hash, $this->listIndex)) && (isset($this->listEntries[$hash]))); @@ -470,7 +470,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-LIST: groupName=%s - CALLED!', $groupName)); if (empty($groupName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "groupName" is empty'); + throw new InvalidArgumentException('Parameter "groupName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isGroupSet($groupName)) { // Throw the exception here throw new BadMethodCallException(sprintf('groupName=%s is not a valid group', $groupName), self::EXCEPTION_GROUP_NOT_FOUND); @@ -517,7 +517,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate // Is the hash valid? if (empty($hash)) { // Throw IAE - throw new InvalidArgumentException('Parameter "hash" is empty'); + throw new InvalidArgumentException('Parameter "hash" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$this->isHashValid($hash)) { // Throw an exception here, hashIndex is unknown at this point throw new InvalidListHashException(array($this, $hash, -999), self::EXCEPTION_INVALID_HASH); diff --git a/framework/main/classes/parser/xml/class_XmlParser.php b/framework/main/classes/parser/xml/class_XmlParser.php index 79da56da..ce764424 100644 --- a/framework/main/classes/parser/xml/class_XmlParser.php +++ b/framework/main/classes/parser/xml/class_XmlParser.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Parser\Xml; // Import framework stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Parser\BaseParser; use Org\Mxchange\CoreFramework\Parser\Parseable; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; @@ -71,7 +72,7 @@ class XmlParser extends BaseParser implements Parseable { // Convert all to UTF8 if (empty($content)) { // No empty content - throw new InvalidArgumentException('content is empty'); + throw new InvalidArgumentException('content is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (function_exists('recode')) { // Recode found, so use it $content = recode('html..utf8', $content); diff --git a/framework/main/classes/registry/class_BaseRegistry.php b/framework/main/classes/registry/class_BaseRegistry.php index 1cedaab0..edbbfb13 100644 --- a/framework/main/classes/registry/class_BaseRegistry.php +++ b/framework/main/classes/registry/class_BaseRegistry.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Registry; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait; @@ -109,7 +110,7 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg // Validate parameter if (empty($instanceKey)) { // Throw IAE - throw new InvalidArgumentExeption('Parameter "instanceKey" is empty'); + throw new InvalidArgumentExeption('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Set entry in generic array diff --git a/framework/main/classes/resolver/action/class_BaseActionResolver.php b/framework/main/classes/resolver/action/class_BaseActionResolver.php index 2832256d..b66a5ace 100644 --- a/framework/main/classes/resolver/action/class_BaseActionResolver.php +++ b/framework/main/classes/resolver/action/class_BaseActionResolver.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Action; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\BaseResolver; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; @@ -80,10 +81,10 @@ abstract class BaseActionResolver extends BaseResolver { // Is a action set? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($actionName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "actionName" is empty'); + throw new InvalidArgumentException('Parameter "actionName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Create class name diff --git a/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php b/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php index 2c36a2cc..3c08e1a6 100644 --- a/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php +++ b/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Action; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Request\Requestable; // Import SPL stuff @@ -65,7 +66,7 @@ class HtmlActionResolver extends BaseActionResolver implements ActionResolver { // Is the variable $actionName set and the action is valid? if (empty($actionName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "actionName" is empty'); + throw new InvalidArgumentException('Parameter "actionName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isActionValid($actionName) === false) { // Invalid action found throw new InvalidActionException(array($resolverInstance, $actionName), self::EXCEPTION_INVALID_ACTION); diff --git a/framework/main/classes/resolver/command/class_BaseCommandResolver.php b/framework/main/classes/resolver/command/class_BaseCommandResolver.php index a49cd88b..01f13597 100644 --- a/framework/main/classes/resolver/command/class_BaseCommandResolver.php +++ b/framework/main/classes/resolver/command/class_BaseCommandResolver.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Command\InvalidCommandException; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\BaseResolver; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; @@ -167,10 +168,10 @@ abstract class BaseCommandResolver extends BaseResolver { // Is a action set? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($commandName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "commandName" is empty'); + throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Initiate the instance variable @@ -211,10 +212,10 @@ abstract class BaseCommandResolver extends BaseResolver { // Is namespace and command name set? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($commandName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "commandName" is empty'); + throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // By default nothing shall be valid diff --git a/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php b/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php index 46095e2c..15233a63 100644 --- a/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php +++ b/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Command; // Import framework stuff use Org\Mxchange\CoreFramework\Command\BaseCommand; use Org\Mxchange\CoreFramework\Command\InvalidCommandException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; // Import SPL stuff @@ -62,10 +63,10 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol // Is the variable $commandName set and the command is valid? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($commandName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "commandName" is empty'); + throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!$resolverInstance->isCommandValid($namespace, $commandName)) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); diff --git a/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php b/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php index 78229a10..086af0a3 100644 --- a/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php +++ b/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Command; // Import framework stuff use Org\Mxchange\CoreFramework\Command\InvalidCommandException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; // Import SPL stuff @@ -65,7 +66,7 @@ class HtmlCommandResolver extends BaseCommandResolver implements CommandResolver // Is the variable $commandName set and the command is valid? if (empty($commandName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "commandName" is empty'); + throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isCommandValid($commandName) === false) { // Invalid command found // @TODO Missing namespace! diff --git a/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php b/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php index c799155e..d5ced68a 100644 --- a/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php +++ b/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Command; // Import framework stuff use Org\Mxchange\CoreFramework\Command\InvalidCommandException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; // Import SPL stuff @@ -65,7 +66,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve // Is the variable $commandName set and the command is valid? if (empty($commandName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "commandName" is empty'); + throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isCommandValid($commandName) === false) { // @TODO Missing namespace! // Invalid command found diff --git a/framework/main/classes/resolver/controller/class_BaseControllerResolver.php b/framework/main/classes/resolver/controller/class_BaseControllerResolver.php index 91676a07..db8991ee 100644 --- a/framework/main/classes/resolver/controller/class_BaseControllerResolver.php +++ b/framework/main/classes/resolver/controller/class_BaseControllerResolver.php @@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Controller\DefaultControllerException; use Org\Mxchange\CoreFramework\Controller\InvalidControllerException; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Resolver\BaseResolver; @@ -163,10 +164,10 @@ abstract class BaseControllerResolver extends BaseResolver { // Is a action set? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($controllerName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "controllerName" is empty'); + throw new InvalidArgumentException('Parameter "controllerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // By default nothing shall be valid diff --git a/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php b/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php index 83125935..31ade31e 100644 --- a/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php +++ b/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Controller; // Import framework stuff use Org\Mxchange\CoreFramework\Controller\BaseController; use Org\Mxchange\CoreFramework\Controller\InvalidControllerException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver; use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver; @@ -63,10 +64,10 @@ class ConsoleControllerResolver extends BaseControllerResolver implements Contro // Is the variable $controllerName set and the controller is valid? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($controllerName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "controllerName" is empty'); + throw new InvalidArgumentException('Parameter "controllerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === false) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); diff --git a/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php b/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php index 4b359d61..32876c9b 100644 --- a/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php +++ b/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Controller; // Import framework stuff use Org\Mxchange\CoreFramework\Controller\BaseController; use Org\Mxchange\CoreFramework\Controller\InvalidControllerException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver; use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver; @@ -63,10 +64,10 @@ class HtmlControllerResolver extends BaseControllerResolver implements Controlle // Are all parameter set and the controller is valid? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($controllerName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "controllerName" is empty'); + throw new InvalidArgumentException('Parameter "controllerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === false) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); diff --git a/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php b/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php index a18464e0..0b0421d3 100644 --- a/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php +++ b/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Controller; // Import framework stuff use Org\Mxchange\CoreFramework\Controller\BaseController; use Org\Mxchange\CoreFramework\Controller\InvalidControllerException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver; use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver; @@ -63,10 +64,10 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll // Are all parameter set and the controller is valid? if (empty($namespace)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "namespace" is empty'); + throw new InvalidArgumentException('Parameter "namespace" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($controllerName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "controllerName" is empty'); + throw new InvalidArgumentException('Parameter "controllerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === false) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); diff --git a/framework/main/classes/stacker/class_BaseStacker.php b/framework/main/classes/stacker/class_BaseStacker.php index cb44bb8f..6526f0a4 100644 --- a/framework/main/classes/stacker/class_BaseStacker.php +++ b/framework/main/classes/stacker/class_BaseStacker.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Stack; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; // Import SPL stuff @@ -70,7 +71,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s,forceReInit=%d - CALLED!', $stackerName, intval($forceReInit))); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + 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); @@ -95,7 +96,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stacks()=%d,forceReInit=%d - CALLED!', count($stacks), intval($forceReInit))); if (count($stacks) == 0) { // No empty stack name - throw new InvalidArgumentException('Array "stacks" is empty'); + throw new InvalidArgumentException('Array "stacks" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // "Walk" through all (more will be added as needed @@ -121,7 +122,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is is there? @@ -145,7 +146,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); @@ -172,7 +173,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); @@ -199,7 +200,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); @@ -228,7 +229,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s,value[]=%s - CALLED!', $stackerName, gettype($value))); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); @@ -258,7 +259,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); @@ -292,7 +293,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); @@ -323,7 +324,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); @@ -354,7 +355,7 @@ abstract class BaseStacker extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is 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); diff --git a/framework/main/classes/stacker/fifo/class_FiFoStacker.php b/framework/main/classes/stacker/fifo/class_FiFoStacker.php index 4aab590e..32574ee7 100644 --- a/framework/main/classes/stacker/fifo/class_FiFoStacker.php +++ b/framework/main/classes/stacker/fifo/class_FiFoStacker.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Mxchange\CoreFramework\Stack; +// Import framework-specific stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; + // Import SPL stuff use \InvalidArgumentException; @@ -68,7 +71,7 @@ class FiFoStacker extends BaseStacker implements Stackable { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s,value[]=%s - CALLED!', $stackerName, gettype($value))); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call the protected method @@ -93,7 +96,7 @@ class FiFoStacker extends BaseStacker implements Stackable { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get the value @@ -123,7 +126,7 @@ class FiFoStacker extends BaseStacker implements Stackable { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call the protected method diff --git a/framework/main/classes/stacker/file/class_BaseFileStack.php b/framework/main/classes/stacker/file/class_BaseFileStack.php index ef8a7c8a..e5f1ce72 100644 --- a/framework/main/classes/stacker/file/class_BaseFileStack.php +++ b/framework/main/classes/stacker/file/class_BaseFileStack.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Factory\Stack\File\FileStackIndexFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile; use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Stack\BaseStacker; use Org\Mxchange\CoreFramework\Traits\Index\IndexableTrait; @@ -226,7 +227,7 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: fileInfoInstance[%s]=%s,type=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance, $type)); if (empty($type)) { // Invalid parameter - throw new InvalidArgumentException('Parameter "type" is empty'); + throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get a stack file instance @@ -318,7 +319,7 @@ abstract class BaseFileStack extends BaseStacker { //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s,value[%s]=%s', $stackerName, gettype($value), print_r($value, true))); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + 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); @@ -355,7 +356,7 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + 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); @@ -383,7 +384,7 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + 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); @@ -411,7 +412,7 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + 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); @@ -435,7 +436,7 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + 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); @@ -458,7 +459,7 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // @TODO Please implement this, returning false @@ -483,7 +484,7 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // So, is the stack empty? @@ -712,13 +713,13 @@ abstract class BaseFileStack extends BaseStacker { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash{}=0x%s,encoded()=%d - CALLED!', $stackName, bin2hex($hash), strlen($encoded))); if (empty($stackName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "stackName" is empty'); + throw new InvalidArgumentException('Parameter "stackName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($hash)) { // Throw IAE - throw new InvalidArgumentException('Parameter "hash" is empty'); + throw new InvalidArgumentException('Parameter "hash" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (empty($encoded)) { // Throw IAE - throw new InvalidArgumentException('Parameter "encoded" is empty'); + throw new InvalidArgumentException('Parameter "encoded" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Raw data been written to the file diff --git a/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php b/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php index ab0e6928..15723e28 100644 --- a/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php +++ b/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Stack\File; // Import framework stuff use Org\Mxchange\CoreFramework\Filesystem\Block\CalculatableBlock; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Stack\File\BaseFileStack; use Org\Mxchange\CoreFramework\Stack\File\StackableFile; @@ -59,7 +60,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: fileInfoInstance[%s]=%s,type=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance, $type)); if (empty($type)) { // No empty type - throw new InvalidArgumentException('Parameter "type" is empty'); + throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get new instance @@ -88,7 +89,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: stackerName=%s,value[]=%s - CALLED!', $stackerName, gettype($value))); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (is_object($value) || is_resource($value)) { // Those types for $value are not allowed throw new InvalidArgumentException(sprintf('value[]=%s is not valid', gettype($value))); @@ -116,7 +117,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get the value @@ -145,7 +146,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call the protected method diff --git a/framework/main/classes/stacker/filo/class_FiLoStacker.php b/framework/main/classes/stacker/filo/class_FiLoStacker.php index 090e721b..d27c1c20 100644 --- a/framework/main/classes/stacker/filo/class_FiLoStacker.php +++ b/framework/main/classes/stacker/filo/class_FiLoStacker.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Mxchange\CoreFramework\Stack; +// Import framework-specific stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; + /** * A FiLo Stacker class * @@ -67,7 +70,7 @@ class FiLoStacker extends BaseStacker implements Stackable { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILO-FILE-STACK: stackerName=%s,value[]=%s - CALLED!', $stackerName, gettype($value))); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call the protected method @@ -92,7 +95,7 @@ class FiLoStacker extends BaseStacker implements Stackable { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILO-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get the value @@ -122,7 +125,7 @@ class FiLoStacker extends BaseStacker implements Stackable { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILO-FILE-STACK: stackerName=%s - CALLED!', $stackerName)); if (empty($stackerName)) { // No empty stack name - throw new InvalidArgumentException('Parameter "stackerName" is empty'); + throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call the protected method diff --git a/framework/main/classes/template/class_BaseTemplateEngine.php b/framework/main/classes/template/class_BaseTemplateEngine.php index c8b2e199..6e541737 100644 --- a/framework/main/classes/template/class_BaseTemplateEngine.php +++ b/framework/main/classes/template/class_BaseTemplateEngine.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; @@ -1112,7 +1113,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem { // Validate parameter if (empty($variableName)) { // Throw an exception - throw new InvalidArgumentException('Parameter "variableName" is empty'); + throw new InvalidArgumentException('Parameter "variableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Replace all dashes to underscores to match variables with configuration entries diff --git a/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php b/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php index 6175b9c7..f2be3e21 100644 --- a/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php +++ b/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine\Xml; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; @@ -256,7 +257,7 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine implements Compi /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: key=%s - CALLED!', $key)); if (empty($key)) { // Throw exception - throw new InvalidArgumentException('Parameter key is empty'); + throw new InvalidArgumentException('Parameter key is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Read the variable diff --git a/framework/main/classes/tools/console/class_ConsoleTools.php b/framework/main/classes/tools/console/class_ConsoleTools.php index a390e2ff..5d33e69c 100644 --- a/framework/main/classes/tools/console/class_ConsoleTools.php +++ b/framework/main/classes/tools/console/class_ConsoleTools.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException; use Org\Mxchange\CoreFramework\Generic\FrameworkException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; use Org\Mxchange\CoreFramework\Socket\InvalidSocketException; @@ -94,7 +95,7 @@ class ConsoleTools extends BaseFrameworkSystem { // Validate parameter if (empty($host)) { // Throw IAE - throw new InvalidArgumentException('Parameter "host" is empty'); + throw new InvalidArgumentException('Parameter "host" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($port < 1) { // Throw IAE throw new InvalidArgumentException(sprintf('port=%d is not valid', $port)); @@ -155,7 +156,7 @@ class ConsoleTools extends BaseFrameworkSystem { // Validate parameter if (empty($rawData)) { // Throw IAE - throw new InvalidArgumentException('Parameter "rawData" is empty'); + throw new InvalidArgumentException('Parameter "rawData" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Default is invalid @@ -214,7 +215,7 @@ class ConsoleTools extends BaseFrameworkSystem { // Validate parameter if (empty($hostname)) { // Throw IAE - throw new InvalidArgumentException('Parameter "hostname" is empty'); + throw new InvalidArgumentException('Parameter "hostname" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (self::$quietResolver !== TRUE) { // Debug message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] Host name to resolve is: %s', diff --git a/framework/main/classes/user/guest/class_Guest.php b/framework/main/classes/user/guest/class_Guest.php index 3ac7c9ef..8a4992ae 100644 --- a/framework/main/classes/user/guest/class_Guest.php +++ b/framework/main/classes/user/guest/class_Guest.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\User\Guest; // Import framework stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Manager\Guest\ManageableGuest; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Request\Requestable; @@ -91,7 +92,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable { // Check parameter if (empty($userName)) { // Throw IAE - throw new InvalidArgumentException('Paramter "userName" is empty'); + throw new InvalidArgumentException('Paramter "userName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get a new instance @@ -124,7 +125,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable { // Check parameter if (empty($email)) { // Throw IAE - throw new InvalidArgumentException('Paramter "email" is empty'); + throw new InvalidArgumentException('Paramter "email" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get a new instance diff --git a/framework/main/classes/user/member/class_Member.php b/framework/main/classes/user/member/class_Member.php index 4c6ce760..295f38ab 100644 --- a/framework/main/classes/user/member/class_Member.php +++ b/framework/main/classes/user/member/class_Member.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\User\Login; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Manager\Login\ManageableMember; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\User\BaseUser; @@ -61,7 +62,7 @@ class Member extends BaseUser implements ManageableMember, Registerable { // Check parameter if (empty($userName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "userName" is empty'); + throw new InvalidArgumentException('Parameter "userName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get a new instance @@ -94,7 +95,7 @@ class Member extends BaseUser implements ManageableMember, Registerable { // Check parameter if (empty($email)) { // Throw IAE - throw new InvalidArgumentException('Parameter "email" is empty'); + throw new InvalidArgumentException('Parameter "email" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get a new instance diff --git a/framework/main/classes/utils/arrays/class_ArrayUtils.php b/framework/main/classes/utils/arrays/class_ArrayUtils.php index bb28ff03..56447d98 100644 --- a/framework/main/classes/utils/arrays/class_ArrayUtils.php +++ b/framework/main/classes/utils/arrays/class_ArrayUtils.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Utils\Arrays; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; // Import SPL stuff @@ -56,10 +57,10 @@ final class ArrayUtils extends BaseFrameworkSystem { // Validate parameters if (count($numericArray) == 0) { // Throw IAE - throw new InvalidArgumentException('Array "numericArray" is empty'); + throw new InvalidArgumentException('Array "numericArray" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (count($mapping) == 0) { // Throw it again - throw new InvalidArgumentException('Array "mapping" is empty'); + throw new InvalidArgumentException('Array "mapping" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (count($numericArray) != count($mapping)) { // Throw it yet again throw new InvalidArgumentException(sprintf('numericArray()=%d does not match mapping()=%d', count($numericArray), count($mapping))); diff --git a/framework/main/classes/utils/crypto/class_CryptoUtils.php b/framework/main/classes/utils/crypto/class_CryptoUtils.php index 5db28e4a..5aa55105 100644 --- a/framework/main/classes/utils/crypto/class_CryptoUtils.php +++ b/framework/main/classes/utils/crypto/class_CryptoUtils.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Utils\Crypto; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; // Import SPL stuff @@ -82,7 +83,7 @@ final class CryptoUtils extends BaseFrameworkSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRYPTO-UTILS: str=%s - CALLED!', $str)); if (empty($str)) { // Throw IAE - throw new InvalidArgumentException('Parameter "str" is empty'); + throw new InvalidArgumentException('Parameter "str" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!extension_loaded('hash')) { // Should be there throw new LogicException('Extension ext-hash not loaded'); diff --git a/framework/main/classes/utils/strings/class_StringUtils.php b/framework/main/classes/utils/strings/class_StringUtils.php index 8f48bf9d..d75ba401 100644 --- a/framework/main/classes/utils/strings/class_StringUtils.php +++ b/framework/main/classes/utils/strings/class_StringUtils.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Utils\Strings; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; @@ -153,7 +154,7 @@ final class StringUtils extends BaseFrameworkSystem { // Validate parameter if (empty($str)) { // Entry is empty - throw new InvalidArgumentException('Parameter "str" is empty'); + throw new InvalidArgumentException('Parameter "str" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Convert them all @@ -202,7 +203,7 @@ final class StringUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: str=%s - CALLED!', $str)); if (empty($str)) { // No empty strings, please - throw new InvalidArgumentException('Parameter "str" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY); + throw new InvalidArgumentException('Parameter "str" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!isset(self::$cache[$str])) { // Init class name $className = ''; diff --git a/framework/main/interfaces/class_FrameworkInterface.php b/framework/main/interfaces/class_FrameworkInterface.php index a4eca6b3..70e15b0e 100644 --- a/framework/main/interfaces/class_FrameworkInterface.php +++ b/framework/main/interfaces/class_FrameworkInterface.php @@ -27,6 +27,9 @@ namespace Org\Mxchange\CoreFramework\Generic; * along with this program. If not, see . */ interface FrameworkInterface { + // Exception constants + const EXCEPTION_INVALID_ARGUMENT = 0x200; + /** * Getter for field name * diff --git a/framework/main/middleware/database/class_DatabaseConnection.php b/framework/main/middleware/database/class_DatabaseConnection.php index 020d13d2..1f99803d 100644 --- a/framework/main/middleware/database/class_DatabaseConnection.php +++ b/framework/main/middleware/database/class_DatabaseConnection.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Connector\Database\DatabaseConnector; use Org\Mxchange\CoreFramework\Criteria\Criteria; use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria; use Org\Mxchange\CoreFramework\Database\Backend\DatabaseBackend; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Middleware\BaseMiddleware; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; @@ -153,7 +154,7 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re // Validate parameter if (empty($tableName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "tableName" is empty'); + throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Connect to the database @@ -215,7 +216,7 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re // Validate parameter if (empty($tableName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "tableName" is empty'); + throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Connect to the database @@ -257,7 +258,7 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re // Validate parameter if (empty($tableName)) { // Throw IAE - throw new InvalidArgumentException('Parameter "tableName" is empty'); + throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Connect to the database diff --git a/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php b/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php index 256b11ca..beb881cf 100644 --- a/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php +++ b/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Tests\Resolver\Command; // Import framework stuff use Org\Mxchange\CoreFramework\Command\InvalidCommandException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Command\BaseCommandResolver; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; @@ -61,7 +62,7 @@ class TestsConsoleCommandResolver extends BaseCommandResolver implements Command // Is the variable $commandName set and the command is valid? if (empty($commandName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "commandName" is empty'); + throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isCommandValid('Org\Mxchange\CoreFramework\Tests\Command', $commandName) === false) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); diff --git a/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php b/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php index 20767575..f49e3678 100644 --- a/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php +++ b/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Tests\Resolver\Controller; use Org\Mxchange\CoreFramework\Controller\BaseController; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Controller\InvalidControllerException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver; use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver; @@ -63,7 +64,7 @@ class TestsConsoleControllerResolver extends BaseControllerResolver implements C // Is the variable $controllerName set and the command is valid? if (empty($controllerName)) { // Then thrown an exception here - throw new InvalidArgumentException('Parameter "controllerName" is empty'); + throw new InvalidArgumentException('Parameter "controllerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ($resolverInstance->isControllerValid('Org\Mxchange\CoreFramework\Tests\Controller', $controllerName) === false) { // Invalid command found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); -- 2.39.2