From f50b908a487166a866eb49856bccb8c45d76a4bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 2 Dec 2020 02:06:29 +0100 Subject: [PATCH] Continued: - got rid of 3 deprecated exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../classes/language/class_LanguageSystem.php | 12 ++--- ...ass_InvalidLanguagePathStringException.php | 51 ------------------- ...ass_LanguagePathIsNoDirectoryException.php | 51 ------------------- ...ass_LanguagePathReadProtectedException.php | 51 ------------------- 4 files changed, 6 insertions(+), 159 deletions(-) delete mode 100644 framework/main/exceptions/language/class_InvalidLanguagePathStringException.php delete mode 100644 framework/main/exceptions/language/class_LanguagePathIsNoDirectoryException.php delete mode 100644 framework/main/exceptions/language/class_LanguagePathReadProtectedException.php diff --git a/framework/main/classes/language/class_LanguageSystem.php b/framework/main/classes/language/class_LanguageSystem.php index 3080899b..ebcfc38e 100644 --- a/framework/main/classes/language/class_LanguageSystem.php +++ b/framework/main/classes/language/class_LanguageSystem.php @@ -73,10 +73,10 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage, * @param $languageBasePath The local base path for all language strings or emty for auto-detection * @return $langInstance An instance of LanguageSystem * @throws InvalidArgumentException If languageBasePath remains empty (@TODO Get rid of that old-lost code) - * @throws InvalidLanguagePathStringException If $languageBasePath is no string - * @throws LanguagePathIsNoDirectoryException If $languageBasePath is no + * @throws InvalidArgumentException If $languageBasePath is no string + * @throws InvalidArgumentException If $languageBasePath is no * directory or not found - * @throws LanguagePathReadProtectedException If $languageBasePath is + * @throws InvalidArgumentException If $languageBasePath is * read-protected */ public static final function createLanguageSystem (string $languageBasePath = '') { @@ -102,13 +102,13 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage, throw new InvalidArgumentException('languageBasePath is still empty'); } elseif (!is_string($languageBasePath)) { // Is not a string - throw new InvalidLanguagePathStringException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_STRING); + throw new InvalidArgumentException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_STRING); } elseif (!is_dir($languageBasePath)) { // Is not a path - throw new LanguagePathIsNoDirectoryException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_PATH_NAME); + throw new InvalidArgumentException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_PATH_NAME); } elseif (!is_readable($languageBasePath)) { // Is not readable - throw new LanguagePathReadProtectedException(array($langInstance, $languageBasePath), self::EXCEPTION_READ_PROTECED_PATH); + throw new InvalidArgumentException(array($langInstance, $languageBasePath), self::EXCEPTION_READ_PROTECED_PATH); } // Set the base path diff --git a/framework/main/exceptions/language/class_InvalidLanguagePathStringException.php b/framework/main/exceptions/language/class_InvalidLanguagePathStringException.php deleted file mode 100644 index fc49eeb6..00000000 --- a/framework/main/exceptions/language/class_InvalidLanguagePathStringException.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 InvalidLanguagePathStringException extends FrameworkException { - /** - * The constructor - * - * @param $classArray Array holding exception data - * @param $code Code number for the exception - * @return void - */ - public function __construct (array $classArray, int $code) { - // Add a message around the missing class - $message = sprintf('[%s:%d] %s is not a string with path.', - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } - -} diff --git a/framework/main/exceptions/language/class_LanguagePathIsNoDirectoryException.php b/framework/main/exceptions/language/class_LanguagePathIsNoDirectoryException.php deleted file mode 100644 index 60c6565b..00000000 --- a/framework/main/exceptions/language/class_LanguagePathIsNoDirectoryException.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 - * @todo 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 LanguagePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $classArray Array holding exception data - * @param $code Code number for the exception - * @return void - */ - public function __construct (array $classArray, int $code) { - // Add a message around the missing class - $message = sprintf('[%s:%d] Language base path %s does not exist or is not a directory.', - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } - -} diff --git a/framework/main/exceptions/language/class_LanguagePathReadProtectedException.php b/framework/main/exceptions/language/class_LanguagePathReadProtectedException.php deleted file mode 100644 index 9b740438..00000000 --- a/framework/main/exceptions/language/class_LanguagePathReadProtectedException.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 LanguagePathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $class Array holding exception data - * @param $code Code number for the exception - * @return void - */ - public function __construct (array $classArray, int $code) { - // Add a message around the missing class - $message = sprintf('[%s:%d] Base language path %s is read-protected. Please change access rights (CHMOD).', - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } - -} -- 2.39.2