From 57e7f91a5aba4faf1a7ad107b3e013ad926f94f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 6 Dec 2020 12:24:23 +0100 Subject: [PATCH] Continued: - replaced InvalidObjectException with InvalidArgumentException - that custom exception was already deprecated/unwanted anyway - moved classes to deeper packages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../compressor/class_Bzip2Compressor.php | 23 +++++---- .../compressor/class_GzipCompressor.php | 23 +++++---- .../compressor/class_NullCompressor.php | 21 +++++--- .../compressor/class_ZlibCompressor.php | 23 +++++---- .../controller/class_BaseController.php | 6 +-- .../frontend/class_BaseDatabaseFrontend.php | 5 +- .../class_XmlCompactorDecorator.php | 2 +- .../class_XmlRewriterTemplateDecorator.php | 0 .../classes/factories/class_BaseFactory.php | 23 ++++++--- .../class_DatabaseFrontendFactory.php | 2 +- .../factories/html/class_HtmlNewsFactory.php | 4 +- .../index/class_FileStackIndexFactory.php | 7 ++- .../factories/objects/class_ObjectFactory.php | 26 +++++----- .../xml/class_XmlTemplateEngineFactory.php | 14 ++--- .../main/class_InvalidObjectException.php | 51 ------------------- .../compressor/class_Compressor.php | 4 +- 16 files changed, 110 insertions(+), 124 deletions(-) rename framework/main/classes/decorator/xml/{ => compactor}/class_XmlCompactorDecorator.php (98%) rename framework/main/classes/decorator/{ => xml}/template/class_XmlRewriterTemplateDecorator.php (100%) delete mode 100644 framework/main/exceptions/main/class_InvalidObjectException.php diff --git a/framework/main/classes/compressor/class_Bzip2Compressor.php b/framework/main/classes/compressor/class_Bzip2Compressor.php index 982b110d..bdfe5d96 100644 --- a/framework/main/classes/compressor/class_Bzip2Compressor.php +++ b/framework/main/classes/compressor/class_Bzip2Compressor.php @@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Bzip2; use Org\Mxchange\CoreFramework\Compressor\Compressor; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; +// Load SPL stuff +use \InvalidArgumentException; + /** * BZIP2 compression and decompression class * @@ -52,7 +55,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) { // Compressor can maybe be used $compressorInstance = new Bzip2Compressor(); - } // END - if + } // Return the compressor instance return $compressorInstance; @@ -63,13 +66,14 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function compressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Return the compressed stream return bzcompress($streamData, 1); @@ -80,13 +84,14 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function decompressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Decompress it $streamData = bzdecompress($streamData, true); diff --git a/framework/main/classes/compressor/class_GzipCompressor.php b/framework/main/classes/compressor/class_GzipCompressor.php index 36f556e2..4a46ab89 100644 --- a/framework/main/classes/compressor/class_GzipCompressor.php +++ b/framework/main/classes/compressor/class_GzipCompressor.php @@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Gzip; use Org\Mxchange\CoreFramework\Compressor\Compressor; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; +// Load SPL stuff +use \InvalidArgumentException; + /** * GZIP compression and decompression class * @@ -52,7 +55,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { if ((function_exists('gzencode')) && (function_exists('gzdecode'))) { // Compressor can maybe be used $compressorInstance = new GzipCompressor(); - } // END - if + } // Return the compressor instance return $compressorInstance; @@ -63,13 +66,14 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function compressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Return the compressed stream return gzencode($streamData, 1); @@ -80,13 +84,14 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function decompressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Return the decompressed stream return gzdecode($streamData); diff --git a/framework/main/classes/compressor/class_NullCompressor.php b/framework/main/classes/compressor/class_NullCompressor.php index a18a1a81..79e865dd 100644 --- a/framework/main/classes/compressor/class_NullCompressor.php +++ b/framework/main/classes/compressor/class_NullCompressor.php @@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Null; use Org\Mxchange\CoreFramework\Compressor\Compressor; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; +// Load SPL stuff +use \InvalidArgumentException; + /** * Null compression and decompression class * @@ -57,13 +60,14 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function compressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Return the compressed stream return $streamData; @@ -74,13 +78,14 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function decompressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Return the decompressed stream return $streamData; diff --git a/framework/main/classes/compressor/class_ZlibCompressor.php b/framework/main/classes/compressor/class_ZlibCompressor.php index 79b88d5d..6e120a47 100644 --- a/framework/main/classes/compressor/class_ZlibCompressor.php +++ b/framework/main/classes/compressor/class_ZlibCompressor.php @@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Zlib; use Org\Mxchange\CoreFramework\Compressor\Compressor; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; +// Load SPL stuff +use \InvalidArgumentException; + /** * ZLIB compression and decompression class * @@ -52,7 +55,7 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor { if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) { // Compressor can maybe be used $compressorInstance = new ZlibCompressor(); - } // END - if + } // Return the compressor instance return $compressorInstance; @@ -63,13 +66,14 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function compressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Return the compressed stream return gzcompress($streamData, 1); @@ -80,13 +84,14 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor { * * @param $streamData Mixed non-object stream data * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ public function decompressStream ($streamData) { - if (is_object($streamData)) { + // Validate parameter + if (is_object($streamData) || is_resource($streamData)) { // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } // END - if + throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData))); + } // Return the decompressed stream return gzuncompress($streamData); diff --git a/framework/main/classes/controller/class_BaseController.php b/framework/main/classes/controller/class_BaseController.php index 56c0e214..7c2acb44 100644 --- a/framework/main/classes/controller/class_BaseController.php +++ b/framework/main/classes/controller/class_BaseController.php @@ -193,7 +193,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl * @param $filterChain Name of the filter chain * @return void */ - protected function initFilterChain ($filterChain) { + protected function initFilterChain (string $filterChain) { //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONTROLLER: ' . $filterChain . ' init: START'); $this->filterChains[$filterChain] = ObjectFactory::createObjectByConfiguredName('filter_chain_class'); //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONTROLLER: ' . $filterChain . ' init: FINISHED'); @@ -207,7 +207,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl * @return void * @throws InvalidFilterChainException If the filter chain is invalid */ - protected function addFilter ($filterChain, Filterable $filterInstance) { + protected function addFilter (string $filterChain, Filterable $filterInstance) { //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONTROLLER: ' . $filterChain . ',' . $filterInstance->__toString(). ' add: START'); // Test if the filter is there @@ -262,7 +262,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl * @return void * @throws InvalidFilterChainException If the filter chain is invalid */ - protected function executeFilters ($filterChain, Requestable $requestInstance, Responseable $responseInstance) { + protected function executeFilters (string $filterChain, Requestable $requestInstance, Responseable $responseInstance) { // Test if the filter is there if (!isset($this->filterChains[$filterChain])) { // Throw an exception here diff --git a/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php b/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php index 446e13a5..1201949f 100644 --- a/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php +++ b/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php @@ -45,11 +45,12 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { /** * Protected constructor * + * @param $className Name of the class * @return void */ - protected function __construct ($class) { + protected function __construct (string $className) { // Call parent constructor - parent::__construct($class); + parent::__construct($className); // Initialize the cache instance $this->initCacheInstance(); diff --git a/framework/main/classes/decorator/xml/class_XmlCompactorDecorator.php b/framework/main/classes/decorator/xml/compactor/class_XmlCompactorDecorator.php similarity index 98% rename from framework/main/classes/decorator/xml/class_XmlCompactorDecorator.php rename to framework/main/classes/decorator/xml/compactor/class_XmlCompactorDecorator.php index db9cfce4..23c125b2 100644 --- a/framework/main/classes/decorator/xml/class_XmlCompactorDecorator.php +++ b/framework/main/classes/decorator/xml/compactor/class_XmlCompactorDecorator.php @@ -94,7 +94,7 @@ class XmlCompactorDecorator extends BaseDecorator implements Parseable { * @return void * @throws XmlCompactorDecoratorException If an XML error was found */ - public function parseXmlContent ($content) { + public function parseXmlContent (string $content) { // Remove all comments for better compacting $content = $this->getParserInstance()->getTemplateInstance()->compactContent($content); diff --git a/framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php b/framework/main/classes/decorator/xml/template/class_XmlRewriterTemplateDecorator.php similarity index 100% rename from framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php rename to framework/main/classes/decorator/xml/template/class_XmlRewriterTemplateDecorator.php diff --git a/framework/main/classes/factories/class_BaseFactory.php b/framework/main/classes/factories/class_BaseFactory.php index 1eea9ce9..5b16ef50 100644 --- a/framework/main/classes/factories/class_BaseFactory.php +++ b/framework/main/classes/factories/class_BaseFactory.php @@ -41,12 +41,12 @@ abstract class BaseFactory extends BaseFrameworkSystem { /** * Protected constructor * - * @param $fullClassName Name of the real class (not BaseFactory) + * @param $className Name of the real class (not BaseFactory) * @return void */ - protected function __construct ($fullClassName) { + protected function __construct (string $className) { // Call parent constructor - parent::__construct($fullClassName); + parent::__construct($className); } /** @@ -54,15 +54,15 @@ abstract class BaseFactory extends BaseFrameworkSystem { * * @param $fullClassName Name of the class we shall count */ - protected static final function countObject ($fullClassName) { + protected static final function countObject (string $fullClassName) { // Count it up in total sum self::$total++; // Do we have an entry? - if (!isset(self::$objectCounters[$fullClassName])) { + if (!self::isClassCounted($fullClassName)) { // No, then generate one self::$objectCounters[$fullClassName] = 0; - } // END - if + } // Count it up again //* NOISY-DEBUG: */ print __METHOD__.': className=' .$fullClassName . PHP_EOL; @@ -87,4 +87,15 @@ abstract class BaseFactory extends BaseFrameworkSystem { return self::$objectCounters; } + /** + * Checks whether given full class name is already counted + * + * @param $fullClassName Full name of class + * @return $isCounted Whether given class name is counted + */ + protected static final function isClassCounted (string $fullClassName) { + // Return isset() result + return isset(self::$objectCounters[$fullClassName]); + } + } diff --git a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php index 8df8c285..6848cf36 100644 --- a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php +++ b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php @@ -46,7 +46,7 @@ class DatabaseFrontendFactory extends ObjectFactory { * * @return $frontendInstance A database frontend instance */ - public static final function createFrontendByConfiguredName ($frontendName) { + public static final function createFrontendByConfiguredName (string $frontendName) { // Get registry instance $registryInstance = GenericRegistry::getRegistry(); diff --git a/framework/main/classes/factories/html/class_HtmlNewsFactory.php b/framework/main/classes/factories/html/class_HtmlNewsFactory.php index da522134..ebcd9ff4 100644 --- a/framework/main/classes/factories/html/class_HtmlNewsFactory.php +++ b/framework/main/classes/factories/html/class_HtmlNewsFactory.php @@ -67,8 +67,8 @@ class HtmlNewsFactory extends BaseFactory { if (!empty($action)) { // Then use both for config entry $configEntry = sprintf('news_reader_%s_%s_class', $command, $action); - } // END - if - } // END - if + } + } // Get the news reader class name from config $className = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry); diff --git a/framework/main/classes/factories/index/class_FileStackIndexFactory.php b/framework/main/classes/factories/index/class_FileStackIndexFactory.php index b24f2884..51de21d6 100644 --- a/framework/main/classes/factories/index/class_FileStackIndexFactory.php +++ b/framework/main/classes/factories/index/class_FileStackIndexFactory.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; // Import SPL stuff +use \InvalidArgumentException; use \SplFileInfo; /** @@ -47,10 +48,14 @@ class FileStackIndexFactory extends ObjectFactory { * * @param $infoInstance An instance of a SplFileInfo class * @return $indexInstance An instance of a IndexableStack class + * @throws InvalidArgumentException If a parameter is invalid */ public static final function createFileStackIndexInstance (SplFileInfo $infoInstance, string $type) { // If there is no handler? - if (GenericRegistry::getRegistry()->instanceExists($type . '_index')) { + if (empty($type)) { + // Throw IAE + throw new InvalidArgumentException('Parameter "type" is empty'); + } elseif (GenericRegistry::getRegistry()->instanceExists($type . '_index')) { // Get handler from registry $indexInstance = GenericRegistry::getRegistry()->getInstance($type . '_index'); } else { diff --git a/framework/main/classes/factories/objects/class_ObjectFactory.php b/framework/main/classes/factories/objects/class_ObjectFactory.php index b10907b5..c081b6bd 100644 --- a/framework/main/classes/factories/objects/class_ObjectFactory.php +++ b/framework/main/classes/factories/objects/class_ObjectFactory.php @@ -35,12 +35,12 @@ class ObjectFactory extends BaseFactory { /** * Protected constructor * - * @param $fullClassName Name of this class + * @param $className Name of this class * @return void */ - protected function __construct ($fullClassName = __CLASS__) { + protected function __construct (string $className = __CLASS__) { // Call parent constructor - parent::__construct($fullClassName); + parent::__construct($className); } /** @@ -48,18 +48,18 @@ class ObjectFactory extends BaseFactory { * the class was not found. No parameters for the object are currently * supported. * - * @param $fullClassName Name of the class we shall construct + * @param $fullClassName Name of the class we shall construct * @param $args Arguments in an indexed array * @return $objectInstance An instance of the requested object * @throws NoClassException If the requested class was not found * @throws InvalidArgumentException If className is empty or the name not following naming-convention */ - public static final function createObjectByName ($fullClassName, array $args = []) { + public static final function createObjectByName (string $fullClassName, array $args = []) { // Is the class name valid and is the class there? if (empty($fullClassName)) { // Throw an exception here - throw new InvalidArgumentException('Parameter "className" is empty'); - } elseif (!class_exists($fullClassName)) { + throw new InvalidArgumentException('Parameter "fullClassName" is empty'); + } elseif (!self::isClassCounted($fullClassName) && !class_exists($fullClassName)) { // First get an instance of this factory $factoryInstance = new ObjectFactory(); @@ -74,13 +74,13 @@ class ObjectFactory extends BaseFactory { if (count($classNameParts) < 4) { // Namespaces are missing throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Tld\Domain\Project\Package[\SubPackage...]\SomeFooBar', $fullClassName)); - } // END - if + } // Create method name $methodName = sprintf('create%s', self::stripNamespaceFromClassName($fullClassName)); // Run the user function - $objectInstance = call_user_func_array(array($fullClassName, $methodName), $args); + $objectInstance = call_user_func_array([$fullClassName, $methodName], $args); // Count this one up self::countObject($fullClassName); @@ -92,13 +92,13 @@ class ObjectFactory extends BaseFactory { /** * Creates an object by it's configured name * - * @param $configEnttry Configuration entry to read + * @param $configKey Configuration key to read * @param $args Arguments in an indexed array * @return $objectInstance An instance of the requested object */ - public static final function createObjectByConfiguredName ($configEntry, array $args = []) { + public static final function createObjectByConfiguredName (string $configKey, array $args = []) { // Read the configuration entry - $fullClassName = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry); + $fullClassName = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configKey); // Send this to the other factory... $objectInstance = self::createObjectByName($fullClassName, $args); @@ -115,7 +115,7 @@ class ObjectFactory extends BaseFactory { * @param $fullClassName Class name with namespace * @return $shortClassName Stripped class name (no namespace) */ - private static function stripNamespaceFromClassName ($fullClassName) { + private static function stripNamespaceFromClassName (string $fullClassName) { // The class name should contain at least 2 back-slashes, so split at them $classNameParts = explode("\\", $fullClassName); diff --git a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php index 172550a6..04f8fce7 100644 --- a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php +++ b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php @@ -46,17 +46,17 @@ class XmlTemplateEngineFactory extends ObjectFactory { * the registry it will be returned, else a new instance is created and * stored in the same registry entry. * - * @param $configEntry Config entry name for the template engine + * @param $configKey Config entry name for the template engine * @return $templateInstance A template engine instance */ - public static final function createXmlTemplateEngineInstance (string $configEntry) { + public static final function createXmlTemplateEngineInstance (string $configKey) { // Do we have an instance in the registry? - if (GenericRegistry::getRegistry()->instanceExists($configEntry)) { + if (GenericRegistry::getRegistry()->instanceExists($configKey)) { // Then use this instance - $templateInstance = GenericRegistry::getRegistry()->getInstance($configEntry); + $templateInstance = GenericRegistry::getRegistry()->getInstance($configKey); } else { - // Now prepare the tags instance - $templateInstance = ObjectFactory::createObjectByConfiguredName($configEntry); + // Get the XML template instance + $templateInstance = ObjectFactory::createObjectByConfiguredName($configKey); // Disable language support $templateInstance->enableLanguageSupport(false); @@ -68,7 +68,7 @@ class XmlTemplateEngineFactory extends ObjectFactory { $templateInstance->enableXmlCompacting(); // Set the instance in registry for further use - GenericRegistry::getRegistry()->addInstance($configEntry, $templateInstance); + GenericRegistry::getRegistry()->addInstance($configKey, $templateInstance); } // Return the instance diff --git a/framework/main/exceptions/main/class_InvalidObjectException.php b/framework/main/exceptions/main/class_InvalidObjectException.php deleted file mode 100644 index 7b55f5e9..00000000 --- a/framework/main/exceptions/main/class_InvalidObjectException.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * @deprecated Don't use this anymore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidObjectException extends FrameworkException { - /** - * The constructor - * - * @param $class Class throwing the exception - * @param $code Code number for the exception - * @return void - */ - public function __construct (FrameworkInterface $class, int $code) { - // Add a message around the missing class - $message = sprintf('[%s:%d] Object is not allowed here.', - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } - -} diff --git a/framework/main/interfaces/compressor/class_Compressor.php b/framework/main/interfaces/compressor/class_Compressor.php index ae996719..df7ac71b 100644 --- a/framework/main/interfaces/compressor/class_Compressor.php +++ b/framework/main/interfaces/compressor/class_Compressor.php @@ -33,7 +33,7 @@ interface Compressor extends FrameworkInterface { * * @param $streamData Mixed non-object stream data * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ function compressStream ($streamData); @@ -42,7 +42,7 @@ interface Compressor extends FrameworkInterface { * * @param $streamData Mixed non-object stream data * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object + * @throws InvalidArgumentException If the stream is not compressable or decompressable */ function decompressStream ($streamData); -- 2.39.2