From: Roland Häder Date: Thu, 10 Dec 2009 09:52:14 +0000 (+0000) Subject: Code cleanups, deprecated classes renamed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3b369c267715db8baefd28b85375406946270ebd;p=core.git Code cleanups, deprecated classes renamed --- diff --git a/.gitattributes b/.gitattributes index 04db7bb2..490bf2d8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -87,6 +87,8 @@ inc/classes/exceptions/main/class_InvalidObjectException.php -text inc/classes/exceptions/main/class_MissingArrayElementsException.php -text inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php -text inc/classes/exceptions/main/class_MissingMethodException.php -text +inc/classes/exceptions/main/class_NoClassException.php -text +inc/classes/exceptions/main/class_NoConfigEntryException.php -text inc/classes/exceptions/main/class_NullPointerException.php -text inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php -text inc/classes/exceptions/main/class_VariableIsNotSetException.php -text diff --git a/docs/TODOs.txt b/docs/TODOs.txt index 00d5b86b..6282d33d 100644 --- a/docs/TODOs.txt +++ b/docs/TODOs.txt @@ -1,15 +1,13 @@ ### WARNING: THIS FILE IS AUTO-GENERATED BY ./todo-builder.sh ### ### DO NOT EDIT THIS FILE. ### -./inc/classes/exceptions/io/class_FileNotFoundException.php:10: * @todo Rename this class to FileIoException -./inc/classes/exceptions/main/class_ClassNotFoundException.php:10: * @todo Rename this class to NoClassException -./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:10: * @todo Rename this class to NoFoundEntryException ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo Try to rewrite user/guest login classes and mark this exception as deprecated +./inc/classes/exceptions/main/class_NoConfigEntryException.php:10: * @todo Rename this class to NoFoundEntryException ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo Find a better name for this interface -./inc/classes/main/class_BaseFrameworkSystem.php:1078: * @todo Write a logging mechanism for productive mode -./inc/classes/main/class_BaseFrameworkSystem.php:1092: // @TODO Finish this part! -./inc/classes/main/class_BaseFrameworkSystem.php:119: // @todo Try to clean these constants up -./inc/classes/main/class_BaseFrameworkSystem.php:200: * @todo This is old code. Do we still need this old lost code? -./inc/classes/main/class_BaseFrameworkSystem.php:268: * @todo SearchableResult and UpdateableResult shall have a super interface to use here +./inc/classes/main/class_BaseFrameworkSystem.php:1083: * @todo Write a logging mechanism for productive mode +./inc/classes/main/class_BaseFrameworkSystem.php:1097: // @TODO Finish this part! +./inc/classes/main/class_BaseFrameworkSystem.php:124: // @todo Try to clean these constants up +./inc/classes/main/class_BaseFrameworkSystem.php:205: * @todo This is old code. Do we still need this old lost code? +./inc/classes/main/class_BaseFrameworkSystem.php:273: * @todo SearchableResult and UpdateableResult shall have a super interface to use here ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64: * @todo Add some stuff here: Some personal data, app/game related data ./inc/classes/main/commands/web/class_WebProblemCommand.php:58: * @todo 0% done ./inc/classes/main/commands/web/class_WebStatusCommand.php:58: * @todo 0% done @@ -73,32 +71,49 @@ ./inc/classes/main/result/class_DatabaseResult.php:379:4 * @todo Find a caching way without modifying the result array ./inc/classes/main/rng/class_RandomNumberGenerator.php:150: * @todo I had a better random number generator here but now it is somewhere lost :( ./inc/classes/main/rng/class_RandomNumberGenerator.php:83: * @todo Add site key for stronger salt! -./inc/classes/main/template/class_BaseTemplateEngine.php:810: * @todo Unfinished work or don't die here. -./inc/classes/main/template/class_BaseTemplateEngine.php:827: // @TODO Non-string found so we need some deeper analysis... -./inc/classes/main/template/class_BaseTemplateEngine.php:904: // @TODO Old behaviour, will become obsolete! -./inc/classes/main/template/class_BaseTemplateEngine.php:907: // @TODO Yet another old way -./inc/classes/main/template/class_BaseTemplateEngine.php:983: * @todo Make this code some nicer... +./inc/classes/main/template/class_BaseTemplateEngine.php:804: * @todo Unfinished work or don't die here. +./inc/classes/main/template/class_BaseTemplateEngine.php:821: // @TODO Non-string found so we need some deeper analysis... +./inc/classes/main/template/class_BaseTemplateEngine.php:898: // @TODO Old behaviour, will become obsolete! +./inc/classes/main/template/class_BaseTemplateEngine.php:901: // @TODO Yet another old way +./inc/classes/main/template/class_BaseTemplateEngine.php:977: * @todo Make this code some nicer... ./inc/classes/main/template/image/class_ImageTemplateEngine.php:224: * @todo Find something usefull with this! ./inc/classes/main/template/image/class_ImageTemplateEngine.php:244: * @todo Add cache creation here ./inc/classes/main/template/mail/class_MailTemplateEngine.php:234: * @todo Add cache creation here ./inc/classes/main/template/mail/class_MailTemplateEngine.php:244: * @todo Should we call back the mailer class here? ./inc/classes/main/template/mail/class_MailTemplateEngine.php:325: * @todo 0% done -./inc/classes/main/template/menu/class_MenuTemplateEngine.php:270: * @todo Find something useful with this! -./inc/classes/main/template/menu/class_MenuTemplateEngine.php:315: * @todo Add cache creation here +./inc/classes/main/template/menu/class_MenuTemplateEngine.php:276: * @todo Find something useful with this! +./inc/classes/main/template/menu/class_MenuTemplateEngine.php:322: * @todo Add cache creation here ./inc/classes/main/user/class_BaseUser.php:308: * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem ./inc/classes/main/user/class_BaseUser.php:80: * @todo Find a way of casting here. "(int)" might destroy the user id > 32766 ./inc/classes/main/user/member/class_Member.php:84: * @todo Add more ways over creating user classes ./inc/classes/middleware/debug/class_DebugMiddleware.php:112: // @TODO Initialization phase +./inc/classes.php:10: * @todo We should minimize these includes ./inc/config/class_FrameworkConfiguration.php:172: * @todo We have to add some more entries from $_SERVER here -./inc/database.php:49:// @TODO Rewrite this -./inc/hooks.php:26:// @TODO This makes the core depending on the SPL. But it should be installed anyway. -./inc/includes.php:36:// @TODO Find a nicer OOP-ed way for this -./inc/language.php:31:// @TODO Rewrite this +./inc/database.php:11: * @todo We should minimize these includes +./inc/database.php:51:// @TODO Rewrite this +./inc/file_io.php:13: * @todo We should minimize these includes +./inc/hooks.php:11: * @todo We should minimize these includes +./inc/hooks.php:28:// @TODO This makes the core depending on the SPL. But it should be installed anyway. +./inc/includes.php:11: * @todo We should minimize these includes +./inc/includes.php:38:// @TODO Find a nicer OOP-ed way for this +./inc/language.php:10: * @todo We should minimize these includes +./inc/language.php:33:// @TODO Rewrite this ./inc/loader/class_ClassLoader.php:262: /* @todo: Do not die here. */ +./inc/output.php:11: * @todo We should minimize these includes +./inc/selector.php:11: * @todo We should minimize these includes ### ### DEPRECATION FOLLOWS: ### ### -./inc/classes/exceptions/io/class_FileNotFoundException.php:11: * @deprecated -./inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php:10: * @deprecated -./inc/classes/exceptions/main/class_ClassNotFoundException.php:11: * @deprecated -./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:11: * @deprecated -./inc/classes/main/template/class_BaseTemplateEngine.php:1133: * @deprecated -./inc/classes/main/template/class_BaseTemplateEngine.php:953: * @deprecated +./inc/classes/exceptions/io/class_FileNotFoundException.php:2:// @DEPRECATED +./inc/classes/exceptions/io/class_FilePointerNotOpenedException.php:2:// @DEPRECATED +./inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php:2:// @DEPRECATED +./inc/classes/exceptions/main/class_ClassNotFoundException.php:2:// @DEPRECATED +./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:2:// @DEPRECATED +./inc/classes/main/template/class_BaseTemplateEngine.php:1127: * @deprecated +./inc/classes/main/template/class_BaseTemplateEngine.php:947: * @deprecated +./inc/classes.php:9: * @deprecated +./inc/database.php:10: * @deprecated +./inc/file_io.php:12: * @deprecated +./inc/hooks.php:10: * @deprecated +./inc/includes.php:10: * @deprecated +./inc/language.php:9: * @deprecated +./inc/output.php:10: * @deprecated +./inc/selector.php:10: * @deprecated diff --git a/inc/classes.php b/inc/classes.php index 58f73f91..db89d2ed 100644 --- a/inc/classes.php +++ b/inc/classes.php @@ -6,6 +6,8 @@ * @version 0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version + * @deprecated + * @todo We should minimize these includes * * 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 diff --git a/inc/classes/exceptions/io/class_FileNotFoundException.php b/inc/classes/exceptions/io/class_FileNotFoundException.php index 9b9196ab..f551ef47 100644 --- a/inc/classes/exceptions/io/class_FileNotFoundException.php +++ b/inc/classes/exceptions/io/class_FileNotFoundException.php @@ -1,49 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * @todo Rename this class to FileIoException - * @deprecated - * - * 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 FileNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $fqfn Full-qualified file name of (maybe) missing file - * @param $code Code number for the exception - * @return void - */ - public function __construct ($fqfn, $code) { - // Add a message around the missing class - $message = sprintf("The requested file %s was not found.", - $fqfn - ); - - // Set extra data - $this->setExtraData(basename($fqfn)); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php index 00e01a10..f551ef47 100644 --- a/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php +++ b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php @@ -1,42 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.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 FilePointerNotOpenedException extends FrameworkException { - /** - * The constructor - * - * @param $fqfn Full-qualified file name of (maybe) missing file - * @param $code Code number for the exception - * @return void - */ - public function __construct ($fqfn, $code) { - // Add a message around the missing class - $message = sprintf("Not able to initialize a pointer for the file %s. Maybe the file is missing.", $fqfn); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php index 84994342..f551ef47 100644 --- a/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php +++ b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php @@ -1,47 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * @deprecated - * @see InvalidResourceException - * - * 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 InvalidDirectoryResourceException extends FrameworkException { - /** - * The constructor - * - * @param $class Class throwing this exception - * @param $code Code number for the exception - * @return void - */ - public function __construct (FrameworkInterface $class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Has an invalid directory resource.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/classes/exceptions/main/class_ClassNotFoundException.php b/inc/classes/exceptions/main/class_ClassNotFoundException.php index 1208fad5..f551ef47 100644 --- a/inc/classes/exceptions/main/class_ClassNotFoundException.php +++ b/inc/classes/exceptions/main/class_ClassNotFoundException.php @@ -1,51 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * @todo Rename this class to NoClassException - * @deprecated - * - * 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 ClassNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $msgArray Message from the exception - * @param $code Code number for the exception - * @return void - */ - public function __construct (array $msgArray, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Internal class %s not found.", - $msgArray[0]->__toString(), - $this->getLine(), - $msgArray[1] - ); - - // Set extra data - $this->setExtraData($msgArray[1]); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php index dd15071f..f551ef47 100644 --- a/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php +++ b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php @@ -1,51 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * @todo Rename this class to NoFoundEntryException - * @deprecated - * - * 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 ConfigEntryNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $classArray Array with exception data - * @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] Configuration entry %s not found.", - $classArray[0], - $this->getLine(), - $classArray[1] - ); - - // Set extra data - $this->setExtraData($classArray[1].':'.$this->getLine()); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/classes/exceptions/main/class_NoClassException.php b/inc/classes/exceptions/main/class_NoClassException.php new file mode 100644 index 00000000..c28a566f --- /dev/null +++ b/inc/classes/exceptions/main/class_NoClassException.php @@ -0,0 +1,49 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 NoClassException extends FrameworkException { + /** + * The constructor + * + * @param $msgArray Message from the exception + * @param $code Code number for the exception + * @return void + */ + public function __construct (array $msgArray, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Internal class %s not found.", + $msgArray[0]->__toString(), + $this->getLine(), + $msgArray[1] + ); + + // Set extra data + $this->setExtraData($msgArray[1]); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NoConfigEntryException.php b/inc/classes/exceptions/main/class_NoConfigEntryException.php new file mode 100644 index 00000000..8dd26943 --- /dev/null +++ b/inc/classes/exceptions/main/class_NoConfigEntryException.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * @todo Rename this class to NoFoundEntryException + * + * 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 NoConfigEntryException extends FrameworkException { + /** + * The constructor + * + * @param $classArray Array with exception data + * @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] Configuration entry %s not found.", + $classArray[0], + $this->getLine(), + $classArray[1] + ); + + // Set extra data + $this->setExtraData($classArray[1].':'.$this->getLine()); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/console/class_ConsoleTools.php b/inc/classes/main/console/class_ConsoleTools.php index 1599cdc8..c9fec474 100644 --- a/inc/classes/main/console/class_ConsoleTools.php +++ b/inc/classes/main/console/class_ConsoleTools.php @@ -101,7 +101,7 @@ class ConsoleTools extends BaseFrameworkSystem { // Resolve the IP number $ip = $helper->resolveIpAddress($hostname); - } catch (FileNotFoundException $e) { + } catch (FileIoException $e) { // Fall-back to 'SESSION_SVR' which found on my Sun Station if (isset($_SERVER['SESSION_SVR'])) { // Resolve it @@ -172,6 +172,54 @@ class ConsoleTools extends BaseFrameworkSystem { // Return determined external IP return $externalAddress; } + + /** + * Analyzes the 'environment', mostly $_SERVER, for presence of elements + * which indicates clearly that e.g. this script has been executed from + * console or web. + * + * @return $type The analyzed type, can be 'http' or 'console' + */ + public static function analyzeEnvironmentForType () { + // Default is the console + $type = 'console'; + + // Now, do we have a request method, or query string set? + if ((isset($_SERVER['REQUEST_METHOD'])) || (isset($_SERVER['QUERY_STRING']))) { + // Possibly HTTP request + $type = 'http'; + } // END - if + + // Return it + return $type; + } + + /** + * Analyzes the 'environment', mostly $_SERVER, for presence of elements + * which indicates clearly that e.g. this script has been executed from + * console or web. This method should be used for class names, they + * currently are named differently. Here is a list to clarify this: + * + * Request type | Class type + * ----------------------------- + * http | web + * console | console + * + * @return $type The analyzed type, can be 'http' or 'console' + */ + public static function analyzeEnvironmentForClassType () { + // Default is the console + $type = 'console'; + + // Now, do we have a request method, or query string set? + if ((isset($_SERVER['REQUEST_METHOD'])) || (isset($_SERVER['QUERY_STRING']))) { + // Possibly HTTP request + $type = 'web'; + } // END - if + + // Return it + return $type; + } } // [EOF] diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 1298ff8b..73db1984 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -289,7 +289,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend // Get the file contents try { $infoArray = $this->getDataArrayFromFile($fqfn); - } catch (FileNotFoundException $e) { + } catch (FileIoException $e) { // Not found, so ignore it here } diff --git a/inc/classes/main/factories/objects/class_ObjectFactory.php b/inc/classes/main/factories/objects/class_ObjectFactory.php index e3be9d28..4a6f0d42 100644 --- a/inc/classes/main/factories/objects/class_ObjectFactory.php +++ b/inc/classes/main/factories/objects/class_ObjectFactory.php @@ -45,7 +45,7 @@ class ObjectFactory extends BaseFactory { * @param $className Name of the class we shall construct * @param $args Arguments in an indexed array * @return $objectInstance An instance of the requested object - * @throws ClassNotFoundException If the requested class was not found + * @throws NoClassException If the requested class was not found * @throws EmptyVariableException If a variable is empty unexpectly */ public final static function createObjectByName ($className, array $args=array()) { @@ -58,7 +58,7 @@ class ObjectFactory extends BaseFactory { throw new EmptyVariableException(array($factoryInstance, 'className'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); } elseif (!class_exists($className)) { // Then throw an exception - throw new ClassNotFoundException(array($factoryInstance, $className), self::EXCEPTION_CLASS_NOT_FOUND); + throw new NoClassException(array($factoryInstance, $className), self::EXCEPTION_CLASS_NOT_FOUND); } // Create method name diff --git a/inc/classes/main/filter/auth/class_UserAuthFilter.php b/inc/classes/main/filter/auth/class_UserAuthFilter.php index 7745492f..6d19adae 100644 --- a/inc/classes/main/filter/auth/class_UserAuthFilter.php +++ b/inc/classes/main/filter/auth/class_UserAuthFilter.php @@ -73,7 +73,7 @@ class UserAuthFilter extends BaseFilter implements Filterable { * @return void * @throws UserAuthorizationException If the auth login was not found or if it was invalid * @throws UserPasswordMismatchException If the supplied password hash does not match - * @throws ClassNotFoundException If the user (guest/member) class was not found + * @throws NoClassException If the user (guest/member) class was not found */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Then get an auth instance for checking and updating the auth cookies @@ -115,7 +115,7 @@ class UserAuthFilter extends BaseFilter implements Filterable { // Does the guest class exist? if (!class_exists($className)) { // Then abort here - throw new ClassNotFoundException (array($this, $className), self::EXCEPTION_CLASS_NOT_FOUND); + throw new NoClassException (array($this, $className), self::EXCEPTION_CLASS_NOT_FOUND); } // END - if // Now try the dynamic login diff --git a/inc/classes/main/filter/payment/class_PaymentDiscoveryFilter.php b/inc/classes/main/filter/payment/class_PaymentDiscoveryFilter.php index 7a75a7c8..1857f7d5 100644 --- a/inc/classes/main/filter/payment/class_PaymentDiscoveryFilter.php +++ b/inc/classes/main/filter/payment/class_PaymentDiscoveryFilter.php @@ -108,7 +108,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable { // Remember this instance if all wents fine Registry::getRegistry()->addInstance('payments', $discoveryInstance); - } catch (ConfigEntryNotFoundException $e) { + } catch (NoConfigEntryException $e) { // Something bad happend $requestInstance->requestIsValid(false); @@ -118,7 +118,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable { // Abort here throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } catch (ClassNotFoundException $e) { + } catch (NoClassException $e) { // Something bad happend $requestInstance->requestIsValid(false); diff --git a/inc/classes/main/helper/web/links/class_WebLinkHelper.php b/inc/classes/main/helper/web/links/class_WebLinkHelper.php index 69eeb7e9..c09de55e 100644 --- a/inc/classes/main/helper/web/links/class_WebLinkHelper.php +++ b/inc/classes/main/helper/web/links/class_WebLinkHelper.php @@ -59,7 +59,7 @@ class WebLinkHelper extends BaseWebHelper implements HelpableTemplate { * @param $linkName Name of the link we shall generate * @param $linkBase Link base for the link. This parameter is deprecated. * @return $helperInstance A prepared instance of this helper - * @throws ConfigEntryNotFoundException A deprecated exception at this point + * @throws NoConfigEntryException A deprecated exception at this point */ public final static function createWebLinkHelper (CompileableTemplate $templateInstance, $linkName, $linkBase = null) { // Get new instance @@ -99,11 +99,11 @@ class WebLinkHelper extends BaseWebHelper implements HelpableTemplate { try { $newLinkBase = $helperInstance->getConfigInstance()->getConfigEntry($configEntry); $linkBase = $newLinkBase; - } catch (ConfigEntryNotFoundException $e) { + } catch (NoConfigEntryException $e) { // Is the deprecated linkBase not set? if (is_null($linkBase)) { // Then throw again the exception - throw new ConfigEntryNotFoundException(array(__CLASS__, ($configEntry)), FrameworkConfiguration::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND); + throw new NoConfigEntryException(array(__CLASS__, ($configEntry)), FrameworkConfiguration::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND); } // END - if } diff --git a/inc/classes/main/io/class_FileIoStream.php b/inc/classes/main/io/class_FileIoStream.php index a9b12dfe..dda95f0f 100644 --- a/inc/classes/main/io/class_FileIoStream.php +++ b/inc/classes/main/io/class_FileIoStream.php @@ -80,7 +80,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil // Get a file output pointer try { $fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fileName, 'w'); - } catch (FilePointerNotOpenedException $e) { + } catch (FileIoException $e) { // Create missing directory $dirName = dirname($fileName); for ($idx2 = 0; $idx2 < (2 - $idx); $idx2++) { diff --git a/inc/classes/main/io/class_FrameworkFileInputPointer.php b/inc/classes/main/io/class_FrameworkFileInputPointer.php index b296421b..bdd116f1 100644 --- a/inc/classes/main/io/class_FrameworkFileInputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileInputPointer.php @@ -64,8 +64,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem { * * @param $fileName The file name we shall pass to fopen() * @throws FileIsEmptyException If the provided file name is empty. - * @throws FilePointerNotOpenedException If fopen() returns not a - * file resource + * @throws FileIoException If fopen() returns not a file resource * @return void */ public final static function createFrameworkFileInputPointer ($fileName) { @@ -75,7 +74,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem { throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); } elseif (!file_exists($fileName)) { // File does not exist! - throw new FileNotFoundException($fileName, self::EXCEPTION_FILE_NOT_FOUND); + throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_FOUND); } elseif (!is_readable($fileName)) { // File does not exist! throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ); @@ -85,7 +84,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem { $filePointer = @fopen($fileName, 'rb'); if ((is_null($filePointer)) || ($filePointer === false)) { // Something bad happend - throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); + throw new FileIoException($fileName, self::EXCEPTION_FILE_POINTER_INVALID); } // END - if // Create new instance diff --git a/inc/classes/main/io/class_FrameworkFileOutputPointer.php b/inc/classes/main/io/class_FrameworkFileOutputPointer.php index bc69bea5..c542ad32 100644 --- a/inc/classes/main/io/class_FrameworkFileOutputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileOutputPointer.php @@ -61,8 +61,7 @@ class FrameworkFileOutputPointer extends BaseFrameworkSystem { * @param $fileName The file name we shall pass to fopen() * @param $mode The output mode ('w', 'a' are valid) * @throws FileIsEmptyException If the provided file name is empty. - * @throws FilePointerNotOpened If fopen() returns not a file - * resource + * @throws FileIoException If fopen() returns not a file resource * @return void */ public final static function createFrameworkFileOutputPointer ($fileName, $mode) { @@ -70,14 +69,14 @@ class FrameworkFileOutputPointer extends BaseFrameworkSystem { if (is_null($fileName)) { // No filename given throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } + } // END - if // Try to open a handler $filePointer = @fopen($fileName, $mode); if (($filePointer === null) || ($filePointer === false)) { // Something bad happend - throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); - } + throw new FileIoException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); + } // END - if // Create new instance $pointerInstance = new FrameworkFileOutputPointer(); diff --git a/inc/classes/main/menu/class_BaseMenu.php b/inc/classes/main/menu/class_BaseMenu.php index 8041813b..8ab109f8 100644 --- a/inc/classes/main/menu/class_BaseMenu.php +++ b/inc/classes/main/menu/class_BaseMenu.php @@ -55,7 +55,7 @@ class BaseMenu extends BaseFrameworkSystem { // Load the menu template for this page try { $this->getTemplateInstance()->loadMenuTemplate($page . '_menu_entries'); - } catch (FileNotFoundException $e) { + } catch (FileIoException $e) { // @TODO Should we log it here? We should, because it will be silently ignored. } diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php index 8a58b46d..c8924f7a 100644 --- a/inc/classes/main/template/class_BaseTemplateEngine.php +++ b/inc/classes/main/template/class_BaseTemplateEngine.php @@ -523,7 +523,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @param $template The template we shall load * @param $extOther An other extension to use * @return void - * @throws FileNotFoundException If the template was not found + * @throws FileIoException If the template was not found */ protected function loadTemplate ($template, $extOther = '') { // Get extension for the template if empty @@ -550,7 +550,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { try { // Load the raw template data $this->loadRawTemplateData($fqfn); - } catch (FileNotFoundException $e) { + } catch (FileIoException $e) { // If we shall load a code-template we need to switch the file extension if (($this->getTemplateType() != $this->getConfigInstance()->getConfigEntry('web_template_type')) && (empty($extOther))) { // Switch over to the code-template extension and try it again @@ -560,7 +560,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $this->loadTemplate($template, $ext); } else { // Throw it again - throw new FileNotFoundException($fqfn, FrameworkFileInputPointer::EXCEPTION_FILE_NOT_FOUND); + throw new FileIoException($fqfn, FrameworkFileInputPointer::EXCEPTION_FILE_NOT_FOUND); } } @@ -689,10 +689,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Remember this template for recursion detection // RECURSIVE PROTECTION! $this->loadedTemplates[] = $template; - } catch (FileNotFoundException $e) { - // Even this is not done... :/ - $this->rawTemplates[] = $template; - } catch (FilePointerNotOpenedException $e) { + } catch (FileIoException $e) { // Even this is not done... :/ $this->rawTemplates[] = $template; } @@ -791,10 +788,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Remember this template for recursion detection // RECURSIVE PROTECTION! $this->loadedTemplates[] = $template; - } catch (FileNotFoundException $e) { - // This template was never found. We silently ignore it - unset($this->rawTemplates[$key]); - } catch (FilePointerNotOpenedException $e) { + } catch (FileIoException $e) { // This template was never found. We silently ignore it unset($this->rawTemplates[$key]); } diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php index 70f05858..f37194d9 100644 --- a/inc/config/class_FrameworkConfiguration.php +++ b/inc/config/class_FrameworkConfiguration.php @@ -119,7 +119,7 @@ class FrameworkConfiguration implements Registerable { * @param $cfgEntry The configuration element * @return $cfgValue The fetched configuration value * @throws ConfigEntryIsEmptyException If $cfgEntry is empty - * @throws ConfigEntryNotFoundException If a configuration element + * @throws NoConfigEntryException If a configuration element * was not found */ public function getConfigEntry ($cfgEntry) { @@ -132,7 +132,7 @@ class FrameworkConfiguration implements Registerable { throw new ConfigEntryIsEmptyException($this, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY); } elseif (!$this->isConfigurationEntrySet($cfgEntry)) { // Entry was not found! - throw new ConfigEntryNotFoundException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND); + throw new NoConfigEntryException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND); } // Return the requested value diff --git a/inc/database.php b/inc/database.php index 40d58f0b..23dd7192 100644 --- a/inc/database.php +++ b/inc/database.php @@ -7,6 +7,8 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @deprecated + * @todo We should minimize these includes * * 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 diff --git a/inc/file_io.php b/inc/file_io.php index 0f209939..8282f987 100644 --- a/inc/file_io.php +++ b/inc/file_io.php @@ -9,6 +9,8 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @deprecated + * @todo We should minimize these includes * * 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 diff --git a/inc/hooks.php b/inc/hooks.php index 17c70e16..9c7ebbb9 100644 --- a/inc/hooks.php +++ b/inc/hooks.php @@ -7,6 +7,8 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @deprecated + * @todo We should minimize these includes * * 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 diff --git a/inc/includes.php b/inc/includes.php index f4088d90..059df0b3 100644 --- a/inc/includes.php +++ b/inc/includes.php @@ -7,6 +7,8 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @deprecated + * @todo We should minimize these includes * * 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 diff --git a/inc/language.php b/inc/language.php index 38ae358d..816780ba 100644 --- a/inc/language.php +++ b/inc/language.php @@ -6,6 +6,8 @@ * @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version + * @deprecated + * @todo We should minimize these includes * * 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 diff --git a/inc/output.php b/inc/output.php index 5216da1a..a3ec6531 100644 --- a/inc/output.php +++ b/inc/output.php @@ -7,6 +7,8 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @deprecated + * @todo We should minimize these includes * * 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 diff --git a/inc/selector.php b/inc/selector.php index 18985579..00f35442 100644 --- a/inc/selector.php +++ b/inc/selector.php @@ -7,6 +7,8 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @deprecated + * @todo We should minimize these includes * * 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