From: Roland Haeder Date: Sat, 4 Mar 2017 22:15:22 +0000 (+0100) Subject: renamed deprecated exception name to a more common one X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=3bb159161d180dd4c9a9d404f40bd77e855d56c4 renamed deprecated exception name to a more common one Signed-off-by: Roland Häder --- diff --git a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php index e4ca45eb..9d485c4e 100644 --- a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php +++ b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php @@ -48,7 +48,7 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem * * @return $templateInstance An instance of TemplateEngine * @throws UnexpectedValueException If the provided $templateBasePath is empty or no string - * @throws BasePathIsNoDirectoryException If $templateBasePath is no + * @throws InvalidDirectoryException If $templateBasePath is no * directory or not found * @throws BasePathReadProtectedException If $templateBasePath is * read-protected @@ -72,7 +72,7 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING); } elseif (!is_dir($templateBasePath)) { // Is not a path - throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); + throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); } elseif (!is_readable($templateBasePath)) { // Is not readable throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH); diff --git a/framework/main/classes/template/html/class_HtmlTemplateEngine.php b/framework/main/classes/template/html/class_HtmlTemplateEngine.php index 9fd2f285..0ecfa862 100644 --- a/framework/main/classes/template/html/class_HtmlTemplateEngine.php +++ b/framework/main/classes/template/html/class_HtmlTemplateEngine.php @@ -48,7 +48,7 @@ class HtmlTemplateEngine extends BaseTemplateEngine implements CompileableTempla * * @return $templateInstance An instance of TemplateEngine * @throws UnexpectedValueException If the provided $templateBasePath is empty or no string - * @throws BasePathIsNoDirectoryException If $templateBasePath is no + * @throws InvalidDirectoryException If $templateBasePath is no * directory or not found * @throws BasePathReadProtectedException If $templateBasePath is * read-protected @@ -72,7 +72,7 @@ class HtmlTemplateEngine extends BaseTemplateEngine implements CompileableTempla throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING); } elseif (!is_dir($templateBasePath)) { // Is not a path - throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); + throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); } elseif (!is_readable($templateBasePath)) { // Is not readable throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH); diff --git a/framework/main/classes/template/image/class_ImageTemplateEngine.php b/framework/main/classes/template/image/class_ImageTemplateEngine.php index 3dbdb96d..ba6b3c6b 100644 --- a/framework/main/classes/template/image/class_ImageTemplateEngine.php +++ b/framework/main/classes/template/image/class_ImageTemplateEngine.php @@ -84,7 +84,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl * * @return $templateInstance An instance of TemplateEngine * @throws UnexpectedValueException If the provided $templateBasePath is empty or no string - * @throws BasePathIsNoDirectoryException If $templateBasePath is no + * @throws InvalidDirectoryException If $templateBasePath is no * directory or not found * @throws BasePathReadProtectedException If $templateBasePath is * read-protected @@ -108,7 +108,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING); } elseif (!is_dir($templateBasePath)) { // Is not a path - throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); + throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); } elseif (!is_readable($templateBasePath)) { // Is not readable throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH); diff --git a/framework/main/classes/template/mail/class_MailTemplateEngine.php b/framework/main/classes/template/mail/class_MailTemplateEngine.php index 04e59829..109880f2 100644 --- a/framework/main/classes/template/mail/class_MailTemplateEngine.php +++ b/framework/main/classes/template/mail/class_MailTemplateEngine.php @@ -78,7 +78,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla * * @return $templateInstance An instance of TemplateEngine * @throws UnexpectedValueException If the provided $templateBasePath is empty or no string - * @throws BasePathIsNoDirectoryException If $templateBasePath is no + * @throws InvalidDirectoryException If $templateBasePath is no * directory or not found * @throws BasePathReadProtectedException If $templateBasePath is * read-protected @@ -102,7 +102,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING); } elseif (!is_dir($templateBasePath)) { // Is not a path - throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); + throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); } elseif (!is_readable($templateBasePath)) { // Is not readable throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH); diff --git a/framework/main/classes/template/menu/class_MenuTemplateEngine.php b/framework/main/classes/template/menu/class_MenuTemplateEngine.php index e21e97df..c5601b4c 100644 --- a/framework/main/classes/template/menu/class_MenuTemplateEngine.php +++ b/framework/main/classes/template/menu/class_MenuTemplateEngine.php @@ -4,6 +4,7 @@ namespace CoreFramework\Template\Engine; // Import framework stuff use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Filesystem\InvalidDirectoryException; use CoreFramework\Parser\Xml\XmlParser; use CoreFramework\Registry\Registry; use CoreFramework\Template\CompileableTemplate; @@ -138,8 +139,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla * @param $menuInstance A RenderableMenu instance * @return $templateInstance An instance of TemplateEngine * @throws UnexpectedValueException If the found $templateBasePath is empty or not a string - * @throws BasePathIsNoDirectoryException If $templateBasePath is no - * directory or not found + * @throws InvalidDirectoryException If $templateBasePath is no directory or not found * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ @@ -162,7 +162,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING); } elseif (!is_dir($templateBasePath)) { // Is not a path - throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); + throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); } elseif (!is_readable($templateBasePath)) { // Is not readable throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH); diff --git a/framework/main/exceptions/template/class_BasePathIsNoDirectoryException.php b/framework/main/exceptions/template/class_BasePathIsNoDirectoryException.php deleted file mode 100644 index eeb095f3..00000000 --- a/framework/main/exceptions/template/class_BasePathIsNoDirectoryException.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 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 BasePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $classArray An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public function __construct (array $classArray, $code) { - // Add a message around the missing class - $message = sprintf('[%s:%d] Template base path "%s" does not exist.', - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } - -} diff --git a/framework/main/exceptions/template/class_InvalidDirectoryException.php b/framework/main/exceptions/template/class_InvalidDirectoryException.php new file mode 100644 index 00000000..d40774da --- /dev/null +++ b/framework/main/exceptions/template/class_InvalidDirectoryException.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * 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 InvalidDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $classArray An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public function __construct (array $classArray, $code) { + // Add a message around the missing class + $message = sprintf('[%s:%d] Path "%s" is no directory.', + $classArray[0]->__toString(), + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } + +}