From c21969ecc9ea3689d37dac8dd39ea202b2726e99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 25 Feb 2023 07:48:37 +0100 Subject: [PATCH] Continued: - used more exception codes - moved one to FrameworkInterface - removed no longer used (was old code anyway) --- .../config/class_FrameworkConfiguration.php | 2 +- framework/loader/class_ClassLoader.php | 8 +++--- .../classes/class_BaseFrameworkSystem.php | 2 -- .../classes/client/http/class_HttpClient.php | 2 +- .../classes/criteria/class_BaseCriteria.php | 26 +++++++++---------- .../class_CachedLocalFileDatabase.php | 6 ++--- .../factories/objects/class_ObjectFactory.php | 2 +- .../binary/class_BaseBinaryFile.php | 2 +- .../binary/index/class_IndexFile.php | 1 - .../binary/stack/class_StackFile.php | 1 - .../class_FrameworkRawFileInputPointer.php | 2 +- .../class_FrameworkFileInputOutputPointer.php | 2 +- .../text/input/csv/class_CsvInputFile.php | 2 +- .../filter/auth/class_UserAuthFilter.php | 3 ++- .../handler/tasks/class_TaskHandler.php | 11 ++++---- .../main/classes/index/class_BaseIndex.php | 1 - .../index/file/class_BaseFileIndex.php | 10 +++---- .../index/file/stack/class_FileStackIndex.php | 2 +- .../registry/class_RegistryIterator.php | 3 ++- .../mailer/debug/class_DebugMailer.php | 2 +- .../command/class_BaseCommandResolver.php | 2 +- .../stacker/file/class_BaseFileStack.php | 12 ++++----- .../console/class_ConsoleTemplateEngine.php | 3 ++- .../html/class_HtmlTemplateEngine.php | 3 ++- .../image/class_ImageTemplateEngine.php | 3 ++- .../mail/class_MailTemplateEngine.php | 3 ++- .../menu/class_MenuTemplateEngine.php | 3 ++- .../tools/console/class_ConsoleTools.php | 1 + .../interfaces/class_FrameworkInterface.php | 1 + 29 files changed, 63 insertions(+), 58 deletions(-) diff --git a/framework/config/class_FrameworkConfiguration.php b/framework/config/class_FrameworkConfiguration.php index 531de648..98dd71b9 100644 --- a/framework/config/class_FrameworkConfiguration.php +++ b/framework/config/class_FrameworkConfiguration.php @@ -248,7 +248,7 @@ class FrameworkConfiguration implements Registerable { //* NOISY-DEBUG: */ printf('[%s:%d]: isEnabled[]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($isEnabled)); if (!is_bool($isEnabled)) { // Throw exception - throw new UnexpectedValueException(sprintf('isEnabled[]=%s is unexpected', gettype($isEnabled))); + throw new UnexpectedValueException(sprintf('isEnabled[]=%s is unexpected', gettype($isEnabled)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Return it diff --git a/framework/loader/class_ClassLoader.php b/framework/loader/class_ClassLoader.php index 7d29b2aa..9e9b7fef 100644 --- a/framework/loader/class_ClassLoader.php +++ b/framework/loader/class_ClassLoader.php @@ -337,10 +337,10 @@ final class ClassLoader { continue; } elseif (!is_dir($realPathName)) { // Is not a directory - throw new UnexpectedValueException(sprintf('realPathName=%s is not a directory', $realPathName)); + throw new UnexpectedValueException(sprintf('realPathName=%s is not a directory', $realPathName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_readable($realPathName)) { // Not readable - throw new UnexpectedValueException(sprintf('realPathName=%s cannot be read from', $realPathName)); + throw new UnexpectedValueException(sprintf('realPathName=%s cannot be read from', $realPathName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Try to load the application classes @@ -386,10 +386,10 @@ final class ClassLoader { continue; } elseif (!is_dir($realPathName)) { // Is not a directory - throw new UnexpectedValueException(sprintf('realPathName=%s is not a directory', $realPathName)); + throw new UnexpectedValueException(sprintf('realPathName=%s is not a directory', $realPathName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_readable($realPathName)) { // Not readable - throw new UnexpectedValueException(sprintf('realPathName=%s cannot be read from', $realPathName)); + throw new UnexpectedValueException(sprintf('realPathName=%s cannot be read from', $realPathName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Try to load the application classes diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index d043576b..ca6a7f09 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -118,7 +118,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac const EXCEPTION_DIR_POINTER_INVALID = 0x019; const EXCEPTION_FILE_POINTER_INVALID = 0x01a; const EXCEPTION_INVALID_RESOURCE = 0x01b; - const EXCEPTION_UNEXPECTED_OBJECT = 0x01c; const EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED = 0x01d; const EXCEPTION_GETTER_IS_MISSING = 0x01e; const EXCEPTION_ARRAY_EXPECTED = 0x01f; @@ -140,7 +139,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac const EXCEPTION_MISSING_ELEMENT = 0x02f; const EXCEPTION_HEADERS_ALREADY_SENT = 0x030; const EXCEPTION_DEFAULT_CONTROLLER_GONE = 0x031; - const EXCEPTION_CLASS_NOT_FOUND = 0x032; const EXCEPTION_REQUIRED_INTERFACE_MISSING = 0x033; const EXCEPTION_FATAL_ERROR = 0x034; const EXCEPTION_FILE_NOT_FOUND = 0x035; diff --git a/framework/main/classes/client/http/class_HttpClient.php b/framework/main/classes/client/http/class_HttpClient.php index aa0c6d7b..fc955eda 100644 --- a/framework/main/classes/client/http/class_HttpClient.php +++ b/framework/main/classes/client/http/class_HttpClient.php @@ -119,7 +119,7 @@ class HttpClient extends BaseClient implements Client { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HTTP-CLIENT: responseArray()=%d', count($responseArray))); if (count($responseArray) < 2) { // Not expected count - throw new UnexpectedValueException(sprintf('responseArray()=%d must have at least two elements', count($responseArray))); + throw new UnexpectedValueException(sprintf('responseArray()=%d must have at least two elements', count($responseArray)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Analyze first header line diff --git a/framework/main/classes/criteria/class_BaseCriteria.php b/framework/main/classes/criteria/class_BaseCriteria.php index cb041490..3582f38a 100644 --- a/framework/main/classes/criteria/class_BaseCriteria.php +++ b/framework/main/classes/criteria/class_BaseCriteria.php @@ -114,7 +114,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (empty($criteriaKey)) { // Throw it again throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -207,7 +207,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Invoke inner method @@ -296,7 +296,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Convert dashes to underscore @@ -339,7 +339,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Convert dashes to underscore @@ -375,7 +375,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); } elseif (is_array($criteriaValue) || is_bool($criteriaValue) || is_object($criteriaValue) || is_resource($criteriaValue)) { // Throw UAE - throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not accepted', gettype($criteriaValue))); + throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not accepted', gettype($criteriaValue)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Convert dashes to underscore @@ -411,7 +411,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { throw new InvalidArgumentException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); } elseif (is_array($criteriaValue) || is_bool($criteriaValue) || is_object($criteriaValue) || is_resource($criteriaValue)) { // Throw UAE - throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not accepted', gettype($criteriaValue))); + throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not accepted', gettype($criteriaValue)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Add it with generic method @@ -449,7 +449,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Add the configuration entry as a criteria @@ -486,7 +486,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Convert dashes to underscore @@ -574,7 +574,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // First nothing matches and nothing is counted @@ -602,7 +602,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue)); if ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw it again - throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); + throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Convert dashes to underscore @@ -686,7 +686,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { 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)); + throw new UnexpectedValueException(sprintf('criteriaType=%s is not supported', $criteriaType), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!$this->isValidGenericArrayGroup('criteria', $criteriaType)) { // Not intialized yet throw new BadMethodCallException(sprintf('Method cannot be invoked before criteriaType=%s is initialized!', $criteriaType), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL); @@ -701,10 +701,10 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue)); if ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) { // Throw UAE - throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey)); + throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (is_array($criteriaValue) || is_bool($criteriaValue) || is_object($criteriaValue) || is_resource($criteriaValue)) { // Throw it again - throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not supported', gettype($criteriaValue))); + throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not supported', gettype($criteriaValue)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Convert dashes to underscore 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 28e0b812..25225398 100644 --- a/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php +++ b/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php @@ -13,6 +13,7 @@ use Org\Mxchange\CoreFramework\Database\Sql\SqlException; 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\Result\Database\BaseDatabaseResult; use Org\Mxchange\CoreFramework\Traits\Compressor\Channel\CompressorChannelTrait; use Org\Mxchange\CoreFramework\Traits\Handler\Io\IoHandlerTrait; @@ -20,7 +21,6 @@ use Org\Mxchange\CoreFramework\Traits\Handler\Io\IoHandlerTrait; // Import SPL stuff use \InvalidArgumentException; use \SplFileInfo; -use \UnexpectedValueException; /** * Database backend class for storing objects in locally created files. @@ -530,7 +530,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac * * @param $dataSetInstance An instance of a StorableCriteria class * @return void - * @throws UnexpectedValueException If $tableName is empty + * @throws InvalidArgumentException If $tableName is empty * @throws SqlException If an SQL error occurs */ public function queryUpdateDataSet (StoreableCriteria $dataSetInstance) { @@ -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', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + throw new InvalidArgumentException('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; diff --git a/framework/main/classes/factories/objects/class_ObjectFactory.php b/framework/main/classes/factories/objects/class_ObjectFactory.php index 7826039a..e100dc69 100644 --- a/framework/main/classes/factories/objects/class_ObjectFactory.php +++ b/framework/main/classes/factories/objects/class_ObjectFactory.php @@ -66,7 +66,7 @@ class ObjectFactory extends BaseFactory { $factoryInstance = new ObjectFactory(); // Then throw an exception - throw new NoClassException(array($factoryInstance, $fullClassName), self::EXCEPTION_CLASS_NOT_FOUND); + throw new NoClassException([$factoryInstance, $fullClassName], FrameworkInterface::EXCEPTION_CLASS_NOT_FOUND); } // Split class name on backslash to check naming-convention diff --git a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php index 0885e338..b7ddafcd 100644 --- a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php +++ b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php @@ -599,7 +599,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: fileSize[%s]=%d', gettype($fileSize), $fileSize)); if (!is_int($fileSize)) { // Bad file? - throw new UnexpectedValueException(sprintf('fileSize[]=%s is unexpected', gettype($fileSize))); + throw new UnexpectedValueException(sprintf('fileSize[]=%s is unexpected', gettype($fileSize)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Is more than 0 returned? 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 bed690ff..df36ffbd 100644 --- a/framework/main/classes/file_directories/binary/index/class_IndexFile.php +++ b/framework/main/classes/file_directories/binary/index/class_IndexFile.php @@ -138,7 +138,6 @@ class IndexFile extends BaseBinaryFile implements IndexableFile { * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid - * @throws UnexpectedValueException If some value is not expected * @throws BadMethodCallException If this->indexInstance is not properly set */ public function isValid () { 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 a6dfd4df..b3f27e4b 100644 --- a/framework/main/classes/file_directories/binary/stack/class_StackFile.php +++ b/framework/main/classes/file_directories/binary/stack/class_StackFile.php @@ -135,7 +135,6 @@ class StackFile extends BaseBinaryFile implements FileStacker { * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid - * @throws UnexpectedValueException If some value is not expected * @throws BadMethodCallException If this->stackInstance is not properly set */ public function isValid () { diff --git a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php index 1a8c9b65..71eed4d4 100644 --- a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php +++ b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php @@ -155,7 +155,7 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer { // Is it valid? if (!is_string($data)) { // Is not a string - throw new UnexpectedValueException(sprintf('Returned data[]=%s is not expected.', gettype($data))); + throw new UnexpectedValueException(sprintf('Returned data[]=%s is not expected.', gettype($data)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Then return it diff --git a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php index 62d8689d..ed4c49e1 100644 --- a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php +++ b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php @@ -315,7 +315,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP // Make sure the required array key is there if (!isset($fileData['size'])) { // Not valid array - throw new UnexpectedValueException(sprintf('fileData=%s has no element "size"', print_r($fileData, TRUE))); + throw new UnexpectedValueException(sprintf('fileData=%s has no element "size"', print_r($fileData, TRUE)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Return size 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 4491d933..c34a6d18 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 @@ -102,7 +102,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] expectedMatches=%d,lineArray()=%d', __METHOD__, __LINE__, $expectedMatches, count($lineArray))); if (($expectedMatches > 0) && (count($lineArray) !== $expectedMatches)) { // Invalid line found as strict count matching is requested - throw new UnexpectedValueException(sprintf('lineArray()=%d has not expected count %d', count($lineArray), $expectedMatches)); + throw new UnexpectedValueException(sprintf('lineArray()=%d has not expected count %d', count($lineArray), $expectedMatches), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Return it diff --git a/framework/main/classes/filter/auth/class_UserAuthFilter.php b/framework/main/classes/filter/auth/class_UserAuthFilter.php index 0abc99cf..11422845 100644 --- a/framework/main/classes/filter/auth/class_UserAuthFilter.php +++ b/framework/main/classes/filter/auth/class_UserAuthFilter.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Filterable; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Loader\NoClassException; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; @@ -126,7 +127,7 @@ class UserAuthFilter extends BaseFilter implements Filterable { // Does the guest class exist? if (!class_exists($className)) { // Then abort here - throw new NoClassException (array($this, $className), self::EXCEPTION_CLASS_NOT_FOUND); + throw new NoClassException ([$this, $className], FrameworkInterface::EXCEPTION_CLASS_NOT_FOUND); } // Now try the dynamic login diff --git a/framework/main/classes/handler/tasks/class_TaskHandler.php b/framework/main/classes/handler/tasks/class_TaskHandler.php index 91badf6f..792073e1 100644 --- a/framework/main/classes/handler/tasks/class_TaskHandler.php +++ b/framework/main/classes/handler/tasks/class_TaskHandler.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Handler\Task; // 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\Handler\BaseHandler; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Task\Taskable; @@ -251,19 +252,19 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // If the task is 'idle_loop', a deplay of zero seconds is fine if ($intervalDelay < 0) { // Invalid configuration value - throw new UnexpectedValueException(sprintf('taskName=%s has intervalDelay=%d below zero', $taskName, $intervalDelay)); + throw new UnexpectedValueException(sprintf('taskName=%s has intervalDelay=%d below zero', $taskName, $intervalDelay), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif ($startupDelay < 0) { // Invalid configuration value - throw new UnexpectedValueException(sprintf('taskName=%s has startupDelay=%d below zero', $taskName, $startupDelay)); + throw new UnexpectedValueException(sprintf('taskName=%s has startupDelay=%d below zero', $taskName, $startupDelay), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif ($maxRuns < 0) { // Invalid configuration value - throw new UnexpectedValueException(sprintf('taskName=%s has maxRuns=%d below zero', $taskName, $maxRuns)); + throw new UnexpectedValueException(sprintf('taskName=%s has maxRuns=%d below zero', $taskName, $maxRuns), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif ($taskName != 'idle_loop' && $intervalDelay == 0) { // Only idle_loop can have a zero interval delay - throw new UnexpectedValueException(sprintf('taskName=%s has zero interval delay which is only valid for "idle_loop" task', $taskName)); + throw new UnexpectedValueException(sprintf('taskName=%s has zero interval delay which is only valid for "idle_loop" task', $taskName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif ($taskName != 'idle_loop' && $startupDelay == 0) { // Only idle_loop can have a zero interval delay - throw new UnexpectedValueException(sprintf('taskName=%s has zero startup delay which is only valid for "idle_loop" task', $taskName)); + throw new UnexpectedValueException(sprintf('taskName=%s has zero startup delay which is only valid for "idle_loop" task', $taskName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Create the entry diff --git a/framework/main/classes/index/class_BaseIndex.php b/framework/main/classes/index/class_BaseIndex.php index 6c7d93fb..d32b473b 100644 --- a/framework/main/classes/index/class_BaseIndex.php +++ b/framework/main/classes/index/class_BaseIndex.php @@ -13,7 +13,6 @@ use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait; // Import SPL stuff use \SplFileInfo; -use \UnexpectedValueException; /** * A general index class diff --git a/framework/main/classes/index/file/class_BaseFileIndex.php b/framework/main/classes/index/file/class_BaseFileIndex.php index 222f9f61..080678fc 100644 --- a/framework/main/classes/index/file/class_BaseFileIndex.php +++ b/framework/main/classes/index/file/class_BaseFileIndex.php @@ -83,7 +83,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { strlen($data), $data, $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (empty(trim($data, chr(0)))) { // Empty file header /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-INDEX: File header is empty - EXIT!'); @@ -93,7 +93,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { throw new UnexpectedValueException(sprintf('data=%s does not end with "%s"', $data, chr(BinaryFile::SEPARATOR_HEADER_ENTRIES) - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Okay, then remove it @@ -123,13 +123,13 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: HEADER_INDEX_ELEMENT_COUNT=%d,header()=%d', BinaryFile::HEADER_INDEX_ELEMENT_COUNT, count($header))); if (count($header) != BinaryFile::HEADER_INDEX_ELEMENT_COUNT) { // Bad header - throw new UnexpectedValueException(sprintf('header()=%d is not expected value %d', count($header), BinaryFile::HEADER_INDEX_ELEMENT_COUNT)); + throw new UnexpectedValueException(sprintf('header()=%d is not expected value %d', count($header), BinaryFile::HEADER_INDEX_ELEMENT_COUNT), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif ($header[BinaryFile::HEADER_NAME_MAGIC] !== Indexable::INDEX_MAGIC) { // Magic must be in first element - throw new UnexpectedValueException(sprintf('header[%s]=%s is not the expected magic (%s)', BinaryFile::HEADER_NAME_MAGIC, $header[BinaryFile::HEADER_NAME_MAGIC], Indexable::INDEX_MAGIC)); + throw new UnexpectedValueException(sprintf('header[%s]=%s is not the expected magic (%s)', BinaryFile::HEADER_NAME_MAGIC, $header[BinaryFile::HEADER_NAME_MAGIC], Indexable::INDEX_MAGIC), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (strlen($header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES]) != BinaryFile::LENGTH_COUNT) { // Length of total entries not matching - throw new UnexpectedValueException(sprintf('header[%s](%d)=%s does not have expected length %d', BinaryFile::HEADER_NAME_TOTAL_ENTRIES, strlen($header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES]), $header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES], BinaryFile::LENGTH_COUNT)); + throw new UnexpectedValueException(sprintf('header[%s](%d)=%s does not have expected length %d', BinaryFile::HEADER_NAME_TOTAL_ENTRIES, strlen($header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES]), $header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES], BinaryFile::LENGTH_COUNT), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Decode count diff --git a/framework/main/classes/index/file/stack/class_FileStackIndex.php b/framework/main/classes/index/file/stack/class_FileStackIndex.php index 9fc6ced3..f47f423c 100644 --- a/framework/main/classes/index/file/stack/class_FileStackIndex.php +++ b/framework/main/classes/index/file/stack/class_FileStackIndex.php @@ -116,7 +116,7 @@ class FileStackIndex extends BaseFileIndex implements IndexableStack, Registerab /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: stackName=%s,hash{}=0x%s,gapPosition=%s', $stackName, bin2hex($data[StackableFile::ARRAY_NAME_HASH]), $gapPosition)); if ($gapPosition <= ($this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() + 1)) { // Not valid gap position returned - throw new UnexpectedValueException(sprintf('gapPosition[%s]=%d is smaller or equal headerSize+1=%d', gettype($gapPosition), $gapPosition, ($this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() + 1))); + throw new UnexpectedValueException(sprintf('gapPosition[%s]=%d is smaller or equal headerSize+1=%d', gettype($gapPosition), $gapPosition, ($this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() + 1)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Then write the data at that gap diff --git a/framework/main/classes/iterator/registry/class_RegistryIterator.php b/framework/main/classes/iterator/registry/class_RegistryIterator.php index 62cab41d..e99d012b 100644 --- a/framework/main/classes/iterator/registry/class_RegistryIterator.php +++ b/framework/main/classes/iterator/registry/class_RegistryIterator.php @@ -15,6 +15,7 @@ use Org\Mxchange\CoreFramework\Traits\Registry\RegisterTrait; // Import SPL stuff use \BadMethodCallException; use \LogicException; +use \UnexpectedValueException; /** * A registry iterator @@ -308,7 +309,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { throw new BadMethodCallException(sprintf('this->key=%s is last key in this iteration. Forgot to invoke valid() before?', $this->key()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL); } elseif ($registryType == 'invalid') { // Not changed! - throw new UnexpectedValueException('registryType has not been changed.'); + throw new UnexpectedValueException('registryType has not been changed.', FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Yes, then advance to that entry diff --git a/framework/main/classes/mailer/debug/class_DebugMailer.php b/framework/main/classes/mailer/debug/class_DebugMailer.php index d9fa84a0..3d34d045 100644 --- a/framework/main/classes/mailer/debug/class_DebugMailer.php +++ b/framework/main/classes/mailer/debug/class_DebugMailer.php @@ -88,7 +88,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail { // The recipient should be a user instance, right? if (!$recipientInstance instanceof ManageableMember) { // Invalid entry found! - throw new UnexpectedValueException(sprintf('recipientInstance[]=%s does not implement ManageableMember', gettype($recipientInstance))); + throw new UnexpectedValueException(sprintf('recipientInstance[]=%s does not implement ManageableMember', gettype($recipientInstance)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // User class found, so entry is valid, first load the template diff --git a/framework/main/classes/resolver/command/class_BaseCommandResolver.php b/framework/main/classes/resolver/command/class_BaseCommandResolver.php index f103525f..2a231dc0 100644 --- a/framework/main/classes/resolver/command/class_BaseCommandResolver.php +++ b/framework/main/classes/resolver/command/class_BaseCommandResolver.php @@ -143,7 +143,7 @@ abstract class BaseCommandResolver extends BaseResolver { // And validate it if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) { // This command has an invalid instance! - throw new UnexpectedValueException(sprintf('commandInstance for commandName=%s is not object (%s) or does not implement Commandable.', $commandName, gettype($commandInstance)), self::EXCEPTION_INVALID_COMMAND); + throw new UnexpectedValueException(sprintf('commandInstance for commandName=%s is not object (%s) or does not implement Commandable.', $commandName, gettype($commandInstance)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Set last command diff --git a/framework/main/classes/stacker/file/class_BaseFileStack.php b/framework/main/classes/stacker/file/class_BaseFileStack.php index 573403dd..303caca7 100644 --- a/framework/main/classes/stacker/file/class_BaseFileStack.php +++ b/framework/main/classes/stacker/file/class_BaseFileStack.php @@ -95,7 +95,7 @@ abstract class BaseFileStack extends BaseStacker { strlen($data), $data, $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (empty(trim($data, chr(0)))) { // Empty header, file is freshly pre-allocated /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Empty file header detected - EXIT!'); @@ -109,7 +109,7 @@ abstract class BaseFileStack extends BaseStacker { throw new UnexpectedValueException(sprintf('data=%s does not have separator=0x%s at the end.', $data, dechex(BinaryFile::SEPARATOR_HEADER_ENTRIES) - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Okay, then remove it @@ -145,7 +145,7 @@ abstract class BaseFileStack extends BaseStacker { $data, count($header), BinaryFile::HEADER_STACK_ELEMENT_COUNT - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif ($header[BinaryFile::HEADER_NAME_MAGIC] != StackableFile::STACK_MAGIC) { // Bad magic throw new InvalidMagicException($data, self::EXCEPTION_BAD_MAGIC); @@ -156,7 +156,7 @@ abstract class BaseFileStack extends BaseStacker { strlen($header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES]), $header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES], BinaryFile::LENGTH_COUNT - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (strlen($header[BinaryFile::HEADER_NAME_SEEK_POSITION]) != BinaryFile::LENGTH_POSITION) { // Position length not valid throw new UnexpectedValueException(sprintf('header[%s](%d)=%s is not expected %d length', @@ -164,7 +164,7 @@ abstract class BaseFileStack extends BaseStacker { strlen($header[BinaryFile::HEADER_NAME_SEEK_POSITION]), $header[BinaryFile::HEADER_NAME_SEEK_POSITION], BinaryFile::LENGTH_POSITION - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Decode count and seek position @@ -745,7 +745,7 @@ abstract class BaseFileStack extends BaseStacker { gettype($gapPosition), $gapPosition, $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() - )); + ), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } // Then write the data at that gap diff --git a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php index 61666a2f..e15a33d8 100644 --- a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php +++ b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException; +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; @@ -70,7 +71,7 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem // Is the base path valid? if (empty($templateBasePath)) { // Base path is empty - throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_dir($templateBasePath)) { // Is not a path throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); diff --git a/framework/main/classes/template/html/class_HtmlTemplateEngine.php b/framework/main/classes/template/html/class_HtmlTemplateEngine.php index d909c32b..4c5863ba 100644 --- a/framework/main/classes/template/html/class_HtmlTemplateEngine.php +++ b/framework/main/classes/template/html/class_HtmlTemplateEngine.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException; +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; @@ -70,7 +71,7 @@ class HtmlTemplateEngine extends BaseTemplateEngine implements CompileableTempla // Is the base path valid? if (empty($templateBasePath)) { // Base path is empty - throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_dir($templateBasePath)) { // Is not a path throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); diff --git a/framework/main/classes/template/image/class_ImageTemplateEngine.php b/framework/main/classes/template/image/class_ImageTemplateEngine.php index e24d8cac..92591a98 100644 --- a/framework/main/classes/template/image/class_ImageTemplateEngine.php +++ b/framework/main/classes/template/image/class_ImageTemplateEngine.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Image\BaseImage; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; @@ -115,7 +116,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl // Is the base path valid? if (empty($templateBasePath)) { // Base path is empty - throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_dir($templateBasePath)) { // Is not a path throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); diff --git a/framework/main/classes/template/mail/class_MailTemplateEngine.php b/framework/main/classes/template/mail/class_MailTemplateEngine.php index a5c9e9dd..1be38d42 100644 --- a/framework/main/classes/template/mail/class_MailTemplateEngine.php +++ b/framework/main/classes/template/mail/class_MailTemplateEngine.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Mailer\DeliverableMail; use Org\Mxchange\CoreFramework\Parser\Parseable; @@ -104,7 +105,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla // Is the base path valid? if (empty($templateBasePath)) { // Base path is empty - throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_dir($templateBasePath)) { // Is not a path throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); diff --git a/framework/main/classes/template/menu/class_MenuTemplateEngine.php b/framework/main/classes/template/menu/class_MenuTemplateEngine.php index 777269ca..dca4118c 100644 --- a/framework/main/classes/template/menu/class_MenuTemplateEngine.php +++ b/framework/main/classes/template/menu/class_MenuTemplateEngine.php @@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Menu\RenderableMenu; use Org\Mxchange\CoreFramework\Parser\Parseable; @@ -166,7 +167,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla // Is the base path valid? if (empty($templateBasePath)) { // Base path is empty - throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_dir($templateBasePath)) { // Is not a path throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); diff --git a/framework/main/classes/tools/console/class_ConsoleTools.php b/framework/main/classes/tools/console/class_ConsoleTools.php index 1e309d76..0051dfcc 100644 --- a/framework/main/classes/tools/console/class_ConsoleTools.php +++ b/framework/main/classes/tools/console/class_ConsoleTools.php @@ -14,6 +14,7 @@ use Org\Mxchange\CoreFramework\Socket\InvalidSocketException; // Import SPL stuff use \InvalidArgumentException; use \SplFileInfo; +use \UnexpectedValueException; /** * This class contains static helper functions for console applications diff --git a/framework/main/interfaces/class_FrameworkInterface.php b/framework/main/interfaces/class_FrameworkInterface.php index bf6e4479..216f95be 100644 --- a/framework/main/interfaces/class_FrameworkInterface.php +++ b/framework/main/interfaces/class_FrameworkInterface.php @@ -32,6 +32,7 @@ interface FrameworkInterface { const EXCEPTION_LOGIC_EXCEPTION = 0x201; const EXCEPTION_UNSPPORTED_OPERATION = 0x202; const EXCEPTION_UNEXPECTED_VALUE = 0x203; + const EXCEPTION_CLASS_NOT_FOUND = 0x204; /** * Getter for field name -- 2.39.2