From: Roland Häder Date: Tue, 28 Feb 2023 14:05:11 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0ea73fee55f5e2a522415cdeb32c8d3ffa75abc3;p=core.git Continued: - added EXCEPTION_INVALID_ARGUMENT --- diff --git a/framework/main/classes/criteria/search/class_SearchCriteria.php b/framework/main/classes/criteria/search/class_SearchCriteria.php index 1880919c..7234fb23 100644 --- a/framework/main/classes/criteria/search/class_SearchCriteria.php +++ b/framework/main/classes/criteria/search/class_SearchCriteria.php @@ -100,7 +100,7 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SEARCH-CRITERIA: configKey=%s - CALLED!', $configKey)); if (empty($configKey)) { // Throw IAE - throw new InvalidArgumentException('Parameter "configKey" is empty'); + throw new InvalidArgumentException('Parameter "configKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Get the limit from config entry diff --git a/framework/main/classes/registry/generic/class_GenericRegistry.php b/framework/main/classes/registry/generic/class_GenericRegistry.php index a95f38ce..f5ce8237 100644 --- a/framework/main/classes/registry/generic/class_GenericRegistry.php +++ b/framework/main/classes/registry/generic/class_GenericRegistry.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Mxchange\CoreFramework\Registry; +// Import framework stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; + /** * A registry for several data types and objects. Objects should be added by * addInstance() and therefore must implement the interface Registerable. @@ -54,7 +57,7 @@ class GenericRegistry extends BaseRegistry implements Register { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key)); if (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is an instance there? diff --git a/framework/main/classes/registry/object/class_ObjectRegistry.php b/framework/main/classes/registry/object/class_ObjectRegistry.php index 102a26e2..8d25922f 100644 --- a/framework/main/classes/registry/object/class_ObjectRegistry.php +++ b/framework/main/classes/registry/object/class_ObjectRegistry.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Registry\Object; // Import framework stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Registry\BaseRegistry; use Org\Mxchange\CoreFramework\Registry\Registerable; @@ -70,7 +71,7 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key)); if (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" is empty'); + throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Is an instance there? diff --git a/framework/main/classes/utils/numbers/class_NumberUtils.php b/framework/main/classes/utils/numbers/class_NumberUtils.php index 264b17ee..aafd71d6 100644 --- a/framework/main/classes/utils/numbers/class_NumberUtils.php +++ b/framework/main/classes/utils/numbers/class_NumberUtils.php @@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Utils\Numbers; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; // Import SPL stuff @@ -87,7 +88,7 @@ final class NumberUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('NUMBER-UTILS: timestamp[%s]=%s - CALLED!', gettype($timestamp), $timestamp)); if (empty($timestamp)) { // Throw IAE - throw new InvalidArgumentException('Parameter "timestamp" is empty'); + throw new InvalidArgumentException('Parameter "timestamp" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Default value to return @@ -141,7 +142,7 @@ final class NumberUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('NUMBER-UTILS: num=%s,castValue=%d,assertMismatch=%d - CALLED!', $num, intval($castValue), intval($assertMismatch))); if ($num === '') { // Throw IAE - throw new InvalidArgumentException('Parameter "num" is empty'); + throw new InvalidArgumentException('Parameter "num" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Filter all numbers out diff --git a/framework/main/classes/utils/strings/class_StringUtils.php b/framework/main/classes/utils/strings/class_StringUtils.php index c97c9fe3..972035c1 100644 --- a/framework/main/classes/utils/strings/class_StringUtils.php +++ b/framework/main/classes/utils/strings/class_StringUtils.php @@ -274,7 +274,7 @@ final class StringUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: hex=%s - CALLED!', $hex)); if (empty($hex)) { // Throw IAE - throw new InvalidArgumentException('Parameter "hex" is empty'); + throw new InvalidArgumentException('Parameter "hex" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Convert to all lower-case @@ -366,7 +366,7 @@ final class StringUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: asc=%s - CALLED!', $asc)); if (empty($asc)) { // Throw IAE - throw new InvalidArgumentException('Parameter "asc" is empty'); + throw new InvalidArgumentException('Parameter "asc" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Convert it into a hexadecimal number @@ -421,7 +421,7 @@ final class StringUtils extends BaseFrameworkSystem { /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: hex=%s - CALLED!', $hex)); if (empty($hex)) { // Throw IAE - throw new InvalidArgumentException('Parameter "hex" is empty'); + throw new InvalidArgumentException('Parameter "hex" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif ((strlen($hex) % 2) != 0) { // Throw it again throw new InvalidArgumentException(sprintf('hex=%s length not dividable by 2', $hex)); @@ -456,7 +456,7 @@ final class StringUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-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); } // First compress the string (gzcompress is okay) @@ -512,7 +512,7 @@ final class StringUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: num=%s,assertMismatch=%d - CALLED!', $num, intval($assertMismatch))); if (empty($num)) { // Throw IAE - throw new InvalidArgumentException('Parameter "num" is empty'); + throw new InvalidArgumentException('Parameter "num" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Filter all numbers out