From: Roland Häder Date: Mon, 7 Dec 2009 21:37:13 +0000 (+0000) Subject: Stacker classes/interface/exceptions (FiFoStacker is not completed, will follow soon... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c3106ae537f1d46274988826a070632a439e2c49;p=core.git Stacker classes/interface/exceptions (FiFoStacker is not completed, will follow soon) added, some minor rewrites for better Doxygen parsing --- diff --git a/.gitattributes b/.gitattributes index 0185c481..1c4f05ab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -94,6 +94,11 @@ inc/classes/exceptions/result/class_InvalidDatabaseResultException.php -text inc/classes/exceptions/result/class_ResultUpdateException.php -text inc/classes/exceptions/socket/.htaccess -text inc/classes/exceptions/socket/class_InvalidSocketException.php -text +inc/classes/exceptions/stacker/.htaccess -text +inc/classes/exceptions/stacker/class_AlreadyInitializedStackerException.php -text +inc/classes/exceptions/stacker/class_EmptyStackerException.php -text +inc/classes/exceptions/stacker/class_FullStackerException.php -text +inc/classes/exceptions/stacker/class_NoStackerException.php -text inc/classes/exceptions/state/.htaccess -text inc/classes/exceptions/state/class_InvalidStateException.php -text inc/classes/exceptions/state/class_InvalidStateInstanceException.php -text @@ -202,6 +207,8 @@ inc/classes/interfaces/response/class_Responseable.php -text inc/classes/interfaces/result/.htaccess -text inc/classes/interfaces/result/class_SearchableResult.php -text inc/classes/interfaces/result/class_UpdateableResult.php -text +inc/classes/interfaces/stacker/.htaccess -text +inc/classes/interfaces/stacker/class_Stackable.php -text inc/classes/interfaces/state/.htaccess -text inc/classes/interfaces/state/class_Stateable.php -text inc/classes/interfaces/streams/.htaccess -text @@ -463,6 +470,13 @@ inc/classes/main/result/.htaccess -text inc/classes/main/result/class_DatabaseResult.php -text inc/classes/main/rng/.htaccess -text inc/classes/main/rng/class_RandomNumberGenerator.php -text +inc/classes/main/stacker/.htaccess -text +inc/classes/main/stacker/class_ -text +inc/classes/main/stacker/class_BaseStacker.php -text +inc/classes/main/stacker/fifo/.htaccess -text +inc/classes/main/stacker/fifo/class_FiFoStacker.php -text +inc/classes/main/stacker/filo/.htaccess -text +inc/classes/main/stacker/filo/class_FiLoStacker.php -text inc/classes/main/streams/.htaccess -text inc/classes/main/streams/class_ -text inc/classes/main/streams/class_BaseStream.php -text diff --git a/inc/classes/exceptions/stacker/.htaccess b/inc/classes/exceptions/stacker/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/exceptions/stacker/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/stacker/class_AlreadyInitializedStackerException.php b/inc/classes/exceptions/stacker/class_AlreadyInitializedStackerException.php new file mode 100644 index 00000000..2b0cd79d --- /dev/null +++ b/inc/classes/exceptions/stacker/class_AlreadyInitializedStackerException.php @@ -0,0 +1,46 @@ + + * @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 AlreadyInitializedStackerException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $messageArray Error message array + * @param $code Error code + * @return void + */ + public function __construct(array $messageArray, $code) { + // Construct message + $message = sprintf("[%s:%d] Stacker %s already initialized.", + $messageArray[0]->__toString(), + $this->getLine(0), + $messageArray[1] + ); + + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/stacker/class_EmptyStackerException.php b/inc/classes/exceptions/stacker/class_EmptyStackerException.php new file mode 100644 index 00000000..429025bb --- /dev/null +++ b/inc/classes/exceptions/stacker/class_EmptyStackerException.php @@ -0,0 +1,46 @@ + + * @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 EmptyStackerException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $messageArray Error message array + * @param $code Error code + * @return void + */ + public function __construct(array $messageArray, $code) { + // Construct message + $message = sprintf("[%s:%d] Stacker %s is empty.", + $messageArray[0]->__toString(), + $this->getLine(0), + $messageArray[1] + ); + + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/stacker/class_FullStackerException.php b/inc/classes/exceptions/stacker/class_FullStackerException.php new file mode 100644 index 00000000..dbb23e84 --- /dev/null +++ b/inc/classes/exceptions/stacker/class_FullStackerException.php @@ -0,0 +1,46 @@ + + * @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 FullStackerException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $messageArray Error message array + * @param $code Error code + * @return void + */ + public function __construct(array $messageArray, $code) { + // Construct message + $message = sprintf("[%s:%d] Stacker %s is full.", + $messageArray[0]->__toString(), + $this->getLine(0), + $messageArray[1] + ); + + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/stacker/class_NoStackerException.php b/inc/classes/exceptions/stacker/class_NoStackerException.php new file mode 100644 index 00000000..108c4fe3 --- /dev/null +++ b/inc/classes/exceptions/stacker/class_NoStackerException.php @@ -0,0 +1,46 @@ + + * @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 NoStackerException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $messageArray Error message array + * @param $code Error code + * @return void + */ + public function __construct(array $messageArray, $code) { + // Construct message + $message = sprintf("[%s:%d] Stacker %s is not intialized.", + $messageArray[0]->__toString(), + $this->getLine(0), + $messageArray[1] + ); + + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/actions/class_PerformableAction.php b/inc/classes/interfaces/actions/class_PerformableAction.php index d16554f4..21c29287 100644 --- a/inc/classes/interfaces/actions/class_PerformableAction.php +++ b/inc/classes/interfaces/actions/class_PerformableAction.php @@ -32,5 +32,5 @@ interface PerformableAction extends FrameworkInterface { function execute (Requestable $requestInstance, Responseable $responseInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/actions/commands/class_Commandable.php b/inc/classes/interfaces/actions/commands/class_Commandable.php index a1aa3ffc..c4255ac5 100644 --- a/inc/classes/interfaces/actions/commands/class_Commandable.php +++ b/inc/classes/interfaces/actions/commands/class_Commandable.php @@ -32,5 +32,5 @@ interface Commandable extends PerformableAction { function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/auth/class_Authorizeable.php b/inc/classes/interfaces/auth/class_Authorizeable.php index 3472e9e0..f23691a2 100644 --- a/inc/classes/interfaces/auth/class_Authorizeable.php +++ b/inc/classes/interfaces/auth/class_Authorizeable.php @@ -37,5 +37,5 @@ interface Authorizeable extends FrameworkInterface { function updateAuthData (); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/captcha/class_SolveableCaptcha.php b/inc/classes/interfaces/captcha/class_SolveableCaptcha.php index d47f6dd7..c9393e86 100644 --- a/inc/classes/interfaces/captcha/class_SolveableCaptcha.php +++ b/inc/classes/interfaces/captcha/class_SolveableCaptcha.php @@ -37,5 +37,5 @@ interface SolveableCaptcha extends FrameworkInterface { function renderCode (); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/class_ b/inc/classes/interfaces/class_ index 5b04acb6..0736f56d 100644 --- a/inc/classes/interfaces/class_ +++ b/inc/classes/interfaces/class_ @@ -24,5 +24,5 @@ interface ??? extends FrameworkInterface { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/class_FrameworkInterface.php b/inc/classes/interfaces/class_FrameworkInterface.php index ea2df039..61d09824 100644 --- a/inc/classes/interfaces/class_FrameworkInterface.php +++ b/inc/classes/interfaces/class_FrameworkInterface.php @@ -41,5 +41,5 @@ interface FrameworkInterface { function hashCode (); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/controller/class_Controller.php b/inc/classes/interfaces/controller/class_Controller.php index 765a4dbd..fc48100d 100644 --- a/inc/classes/interfaces/controller/class_Controller.php +++ b/inc/classes/interfaces/controller/class_Controller.php @@ -32,5 +32,5 @@ interface Controller extends FrameworkInterface { function handleRequest (Requestable $requestInstance, Responseable $responseInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/criteria/class_Criteria.php b/inc/classes/interfaces/criteria/class_Criteria.php index 9cda4c4d..2ba12f0e 100644 --- a/inc/classes/interfaces/criteria/class_Criteria.php +++ b/inc/classes/interfaces/criteria/class_Criteria.php @@ -41,5 +41,5 @@ interface Criteria extends FrameworkInterface { function addConfiguredCriteria ($criteriaKey, $configEntry); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php b/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php index 051392ac..a4a81916 100644 --- a/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php +++ b/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php @@ -24,5 +24,5 @@ interface LocalSearchCriteria extends Criteria { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/criteria/extended/class_LocalUpdateCriteria.php b/inc/classes/interfaces/criteria/extended/class_LocalUpdateCriteria.php index f01e0836..3ab61199 100644 --- a/inc/classes/interfaces/criteria/extended/class_LocalUpdateCriteria.php +++ b/inc/classes/interfaces/criteria/extended/class_LocalUpdateCriteria.php @@ -24,5 +24,5 @@ interface LocalUpdateCriteria extends Criteria { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/database/class_Updateable.php b/inc/classes/interfaces/database/class_Updateable.php index 57e34f2d..dd50e9aa 100644 --- a/inc/classes/interfaces/database/class_Updateable.php +++ b/inc/classes/interfaces/database/class_Updateable.php @@ -32,5 +32,5 @@ interface Updateable extends FrameworkInterface { function updateDatabaseField ($fieldName, $fieldValue); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/database/wrapper/class_BookablePointsWrapper.php b/inc/classes/interfaces/database/wrapper/class_BookablePointsWrapper.php index 2d609eba..2d384660 100644 --- a/inc/classes/interfaces/database/wrapper/class_BookablePointsWrapper.php +++ b/inc/classes/interfaces/database/wrapper/class_BookablePointsWrapper.php @@ -39,5 +39,5 @@ interface BookablePointsWrapper extends FrameworkInterface { function doUpdateByResult (UpdateableResult $resultInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/database/wrapper/class_ManageableAccountWrapper.php b/inc/classes/interfaces/database/wrapper/class_ManageableAccountWrapper.php index d55ca0de..7f443ba9 100644 --- a/inc/classes/interfaces/database/wrapper/class_ManageableAccountWrapper.php +++ b/inc/classes/interfaces/database/wrapper/class_ManageableAccountWrapper.php @@ -39,5 +39,5 @@ interface ManageableAccountWrapper extends FrameworkInterface { function doUpdateByResult (UpdateableResult $resultInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/debug/class_Debugger.php b/inc/classes/interfaces/debug/class_Debugger.php index 2cb5f562..7275a568 100644 --- a/inc/classes/interfaces/debug/class_Debugger.php +++ b/inc/classes/interfaces/debug/class_Debugger.php @@ -31,5 +31,5 @@ interface Debugger extends FrameworkInterface { function outputStream ($output); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/discovery/class_Discoverable.php b/inc/classes/interfaces/discovery/class_Discoverable.php index c886d5f6..d7cde847 100644 --- a/inc/classes/interfaces/discovery/class_Discoverable.php +++ b/inc/classes/interfaces/discovery/class_Discoverable.php @@ -39,5 +39,5 @@ interface Discoverable extends FrameworkInterface { function addResultsToHelper (HelpableTemplate $helperInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/filter/class_Filterable.php b/inc/classes/interfaces/filter/class_Filterable.php index 99019a26..0825c454 100644 --- a/inc/classes/interfaces/filter/class_Filterable.php +++ b/inc/classes/interfaces/filter/class_Filterable.php @@ -32,5 +32,5 @@ interface Filterable extends FrameworkInterface { function execute (Requestable $requestInstance, Responseable $responseInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/helper/class_HelpableLogin.php b/inc/classes/interfaces/helper/class_HelpableLogin.php index 09c83c03..8a8b7a07 100644 --- a/inc/classes/interfaces/helper/class_HelpableLogin.php +++ b/inc/classes/interfaces/helper/class_HelpableLogin.php @@ -32,5 +32,5 @@ interface HelpableLogin extends FrameworkInterface { function executeLogin (Responseable $responseInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/helper/class_HelpableTemplate.php b/inc/classes/interfaces/helper/class_HelpableTemplate.php index 57558d9e..10a6ba3b 100644 --- a/inc/classes/interfaces/helper/class_HelpableTemplate.php +++ b/inc/classes/interfaces/helper/class_HelpableTemplate.php @@ -30,5 +30,5 @@ interface HelpableTemplate extends FrameworkInterface { function flushContent (); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/io/class_Streamable.php b/inc/classes/interfaces/io/class_Streamable.php index 9f76f716..71ee8eb8 100644 --- a/inc/classes/interfaces/io/class_Streamable.php +++ b/inc/classes/interfaces/io/class_Streamable.php @@ -24,5 +24,5 @@ interface Streamable extends FrameworkInterface { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/io/file/class_FileInputStreamer.php b/inc/classes/interfaces/io/file/class_FileInputStreamer.php index fa759161..2878d72e 100644 --- a/inc/classes/interfaces/io/file/class_FileInputStreamer.php +++ b/inc/classes/interfaces/io/file/class_FileInputStreamer.php @@ -27,12 +27,11 @@ interface FileInputStreamer extends Streamable { * * @param $fqfn The file's FQFN we shall load * @return $array An array containing all read lines - * @throws InvalidArrayCountException If an array has not the - * expected size + * @throws InvalidArrayCountException If an array has not the expected size * @throws InvalidMD5ChecksumException If two MD5 hashes did not match */ function loadFileContents ($fqfn); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/io/file/class_FileOutputStreamer.php b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php index 161decfa..21f7010c 100644 --- a/inc/classes/interfaces/io/file/class_FileOutputStreamer.php +++ b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php @@ -27,12 +27,11 @@ interface FileOutputStreamer extends Streamable { * external servers. * * @param $fileName The local file's name including full path - * @param $dataArray Array containing the compressor's extension - * and streamed data + * @param $dataArray Array containing the compressor's extension and streamed data * @return void */ function saveFile ($fileName, $dataArray); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/io/output/class_OutputStreamer.php b/inc/classes/interfaces/io/output/class_OutputStreamer.php index 7fd9c0eb..029bb3ab 100644 --- a/inc/classes/interfaces/io/output/class_OutputStreamer.php +++ b/inc/classes/interfaces/io/output/class_OutputStreamer.php @@ -30,5 +30,5 @@ interface OutputStreamer extends Streamable { function output ($outStream = false); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/language/class_ManageableLanguage.php b/inc/classes/interfaces/language/class_ManageableLanguage.php index 950ca0a9..385bf9d8 100644 --- a/inc/classes/interfaces/language/class_ManageableLanguage.php +++ b/inc/classes/interfaces/language/class_ManageableLanguage.php @@ -28,7 +28,7 @@ interface ManageableLanguage extends FrameworkInterface { * @return void */ function initLanguageStrings(); -} // END - class +} // [EOF] ?> diff --git a/inc/classes/interfaces/login/class_LoginableUser.php b/inc/classes/interfaces/login/class_LoginableUser.php index 10acedd4..6f6bac11 100644 --- a/inc/classes/interfaces/login/class_LoginableUser.php +++ b/inc/classes/interfaces/login/class_LoginableUser.php @@ -34,5 +34,5 @@ interface LoginableUser extends FrameworkInterface { function doLogin (Requestable $requestInstance, Responseable $responseInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/mailer/class_DeliverableMail.php b/inc/classes/interfaces/mailer/class_DeliverableMail.php index 814fb64e..b50e77c7 100644 --- a/inc/classes/interfaces/mailer/class_DeliverableMail.php +++ b/inc/classes/interfaces/mailer/class_DeliverableMail.php @@ -52,5 +52,5 @@ interface DeliverableMail extends FrameworkInterface { function sendAdminNotification (); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/parser/class_Parseable.php b/inc/classes/interfaces/parser/class_Parseable.php index 61416fff..57060e1c 100644 --- a/inc/classes/interfaces/parser/class_Parseable.php +++ b/inc/classes/interfaces/parser/class_Parseable.php @@ -32,5 +32,5 @@ interface Parseable extends FrameworkInterface { function parseXmlContent ($content); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/points/class_BookablePoints.php b/inc/classes/interfaces/points/class_BookablePoints.php index ee9e1142..73946e54 100644 --- a/inc/classes/interfaces/points/class_BookablePoints.php +++ b/inc/classes/interfaces/points/class_BookablePoints.php @@ -47,5 +47,5 @@ interface BookablePoints extends FrameworkInterface { function addElementsToDataSet (StoreableCriteria $criteriaInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/reader/class_ReadableNews.php b/inc/classes/interfaces/reader/class_ReadableNews.php index 2058fbf1..4791d8ea 100644 --- a/inc/classes/interfaces/reader/class_ReadableNews.php +++ b/inc/classes/interfaces/reader/class_ReadableNews.php @@ -30,5 +30,5 @@ interface ReadableNews extends FrameworkInterface { function initializeReader(); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/registration/class_UserRegister.php b/inc/classes/interfaces/registration/class_UserRegister.php index 33cfc723..3c57c6e2 100644 --- a/inc/classes/interfaces/registration/class_UserRegister.php +++ b/inc/classes/interfaces/registration/class_UserRegister.php @@ -72,5 +72,5 @@ interface UserRegister extends FrameworkInterface { function addElementsToDataSet (StoreableCriteria $criteriaInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/request/class_Requestable.php b/inc/classes/interfaces/request/class_Requestable.php index fef4e349..cda7f3ec 100644 --- a/inc/classes/interfaces/request/class_Requestable.php +++ b/inc/classes/interfaces/request/class_Requestable.php @@ -78,5 +78,5 @@ interface Requestable extends FrameworkInterface { function readCookie ($cookieName); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/resolver/actions/class_ActionResolver.php b/inc/classes/interfaces/resolver/actions/class_ActionResolver.php index bbf58ec3..befb434d 100644 --- a/inc/classes/interfaces/resolver/actions/class_ActionResolver.php +++ b/inc/classes/interfaces/resolver/actions/class_ActionResolver.php @@ -47,5 +47,5 @@ interface ActionResolver extends Resolver { function isActionValid ($actionName); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/resolver/class_Resolver.php b/inc/classes/interfaces/resolver/class_Resolver.php index 58c13316..6d39353f 100644 --- a/inc/classes/interfaces/resolver/class_Resolver.php +++ b/inc/classes/interfaces/resolver/class_Resolver.php @@ -24,5 +24,5 @@ interface Resolver extends FrameworkInterface { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/resolver/commands/class_CommandResolver.php b/inc/classes/interfaces/resolver/commands/class_CommandResolver.php index e3057e5e..2428bc80 100644 --- a/inc/classes/interfaces/resolver/commands/class_CommandResolver.php +++ b/inc/classes/interfaces/resolver/commands/class_CommandResolver.php @@ -40,5 +40,5 @@ interface CommandResolver extends Resolver { function isCommandValid ($commandName); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/resolver/controller/class_ControllerResolver.php b/inc/classes/interfaces/resolver/controller/class_ControllerResolver.php index 647c5fec..06c4592e 100644 --- a/inc/classes/interfaces/resolver/controller/class_ControllerResolver.php +++ b/inc/classes/interfaces/resolver/controller/class_ControllerResolver.php @@ -30,5 +30,5 @@ interface ControllerResolver extends Resolver { function resolveController (); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/resolver/state/class_StateResolver.php b/inc/classes/interfaces/resolver/state/class_StateResolver.php index cb882c16..c919332e 100644 --- a/inc/classes/interfaces/resolver/state/class_StateResolver.php +++ b/inc/classes/interfaces/resolver/state/class_StateResolver.php @@ -41,5 +41,5 @@ interface StateResolver extends Resolver { function isStateValid ($stateName); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/response/class_Responseable.php b/inc/classes/interfaces/response/class_Responseable.php index 0a7850c9..25f2fc5d 100644 --- a/inc/classes/interfaces/response/class_Responseable.php +++ b/inc/classes/interfaces/response/class_Responseable.php @@ -110,5 +110,5 @@ interface Responseable extends FrameworkInterface { function refreshCookie ($cookieName); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/stacker/.htaccess b/inc/classes/interfaces/stacker/.htaccess new file mode 100644 index 00000000..2effffd3 --- /dev/null +++ b/inc/classes/interfaces/stacker/.htaccess @@ -0,0 +1,2 @@ +Deny from all +Deny from all diff --git a/inc/classes/interfaces/stacker/class_Stackable.php b/inc/classes/interfaces/stacker/class_Stackable.php new file mode 100644 index 00000000..22c2ac66 --- /dev/null +++ b/inc/classes/interfaces/stacker/class_Stackable.php @@ -0,0 +1,114 @@ + + * @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 . + */ +interface Stackable extends FrameworkInterface { + /** + * Pushs a value on a named stacker + * + * @param $stackerName Name of the stacker + * @param $value Value to push on it + * @return void + * @throws StackerFullException If the stacker is full + */ + function pushNamed ($stackerName, $value); + + /** + * 'Pops' a value from a named stacker + * + * @param $stackerName Name of the stacker + * @return void + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + function popNamed ($stackerName); + + /** + * Get value from named stacker + * + * @param $stackerName Name of the stacker + * @return $value Value of last added value + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + function getNamed ($stackerName); +} + +// [EOF] +?> + + * @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 . + */ +interface Stackable extends FrameworkInterface { + /** + * Pushs a value on a named stacker + * + * @param $stackerName Name of the stacker + * @param $value Value to push on it + * @return void + * @throws StackerFullException If the stacker is full + */ + function pushNamed ($stackerName, $value); + + /** + * 'Pops' a value from a named stacker + * + * @param $stackerName Name of the stacker + * @return void + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + function popNamed ($stackerName); + + /** + * Get value from named stacker + * + * @param $stackerName Name of the stacker + * @return $value Value of last added value + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + function getNamed ($stackerName); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/state/class_Stateable.php b/inc/classes/interfaces/state/class_Stateable.php index c6621fdf..f19ab1e3 100644 --- a/inc/classes/interfaces/state/class_Stateable.php +++ b/inc/classes/interfaces/state/class_Stateable.php @@ -24,5 +24,5 @@ interface Stateable extends FrameworkInterface { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/streams/class_Streamable.php b/inc/classes/interfaces/streams/class_Streamable.php index 9f76f716..71ee8eb8 100644 --- a/inc/classes/interfaces/streams/class_Streamable.php +++ b/inc/classes/interfaces/streams/class_Streamable.php @@ -24,5 +24,5 @@ interface Streamable extends FrameworkInterface { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php b/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php index ae4a5e69..7fcd5124 100644 --- a/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php +++ b/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php @@ -39,5 +39,5 @@ interface EncryptableStream extends Streamable { function decryptStream ($encrypted); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/template/class_CompileableTemplate.php b/inc/classes/interfaces/template/class_CompileableTemplate.php index 6737b56e..8667cd7b 100644 --- a/inc/classes/interfaces/template/class_CompileableTemplate.php +++ b/inc/classes/interfaces/template/class_CompileableTemplate.php @@ -83,7 +83,7 @@ interface CompileableTemplate extends FrameworkInterface { * @return void */ function output (); -} // END - class +} // [EOF] ?> diff --git a/inc/classes/interfaces/user/class_ManageableAccount.php b/inc/classes/interfaces/user/class_ManageableAccount.php index 9e775641..ebc32eee 100644 --- a/inc/classes/interfaces/user/class_ManageableAccount.php +++ b/inc/classes/interfaces/user/class_ManageableAccount.php @@ -46,5 +46,5 @@ interface ManageableAccount extends FrameworkInterface { function ifPasswordHashMatches (Requestable $requestInstance); } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/user/extended/class_ManageableGuest.php b/inc/classes/interfaces/user/extended/class_ManageableGuest.php index 044943dc..08919fe2 100644 --- a/inc/classes/interfaces/user/extended/class_ManageableGuest.php +++ b/inc/classes/interfaces/user/extended/class_ManageableGuest.php @@ -24,5 +24,5 @@ interface ManageableGuest extends ManageableAccount { } -// +// [EOF] ?> diff --git a/inc/classes/interfaces/user/extended/class_ManageableMember.php b/inc/classes/interfaces/user/extended/class_ManageableMember.php index 32172b0e..6adabfa1 100644 --- a/inc/classes/interfaces/user/extended/class_ManageableMember.php +++ b/inc/classes/interfaces/user/extended/class_ManageableMember.php @@ -24,5 +24,5 @@ interface ManageableMember extends ManageableAccount { } -// +// [EOF] ?> diff --git a/inc/classes/main/class_ b/inc/classes/main/class_ index c5fe84ee..e46dc6a4 100644 --- a/inc/classes/main/class_ +++ b/inc/classes/main/class_ @@ -37,6 +37,7 @@ class ???!!! extends Base!!! implements CompileableTemplate { * * @param $appInstance A manageable application * @return $///Instance An instance of !!! + */ public final static function create???!!! (ManageableApplication $appInstance) { // Get a new instance $///Instance = new ???!!!(); diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 0b14dcbb..10b67239 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -98,6 +98,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $imageInstance = null; + /** + * Instance of the stacker + */ + private $stackerInstance = null; + /** * The real class name */ @@ -1253,6 +1258,25 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { public final function getImageInstance () { return $this->imageInstance; } + + /** + * Setter for stacker instanxe + * + * @param $stackerInstance An instance of an stacker + * @return void + */ + public final function setStackerInstance (Stackable $stackerInstance) { + $this->stackerInstance = $stackerInstance; + } + + /** + * Getter for stacker instanxe + * + * @return $stackerInstance An instance of an stacker + */ + public final function getStackerInstance () { + return $this->stackerInstance; + } } // [EOF] diff --git a/inc/classes/main/stacker/.htaccess b/inc/classes/main/stacker/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/main/stacker/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/stacker/class_ b/inc/classes/main/stacker/class_ new file mode 100644 index 00000000..1d8d8af1 --- /dev/null +++ b/inc/classes/main/stacker/class_ @@ -0,0 +1,90 @@ + + * @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 ???Stacker extends BaseStacker implements Stackable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of the class Stacker and prepares it for usage + * + * @param $appInstance A manageable application + * @return $stackerInstance An instance of ???Stacker + */ + public final static function create???Stacker (ManageableApplication $appInstance) { + // Get a new instance + $stackerInstance = new ???Stacker(); + + // Init generic stacker + $stackerInstance->initStacker('generic'); + + // Return the prepared instance + return $stackerInstance; + } + + /** + * Pushs a value on a named stacker + * + * @param $stackerName Name of the stack + * @param $value Value to push on it + * @return void + * @throws StackerFullException If the stack is full + */ + public function pushNamed ($stackerName, $value) { + $this->partialStub('stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . $value); + } + + /** + * 'Pops' a value from a named stacker + * + * @param $stackerName Name of the stack + * @return void + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + public function popNamed ($stackerName) { + $this->partialStub('stackerName=' . $stackerName); + } + + /** + * Get value from named stacker + * + * @param $stackerName Name of the stack + * @return $value Value of last added value + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + public function getNamed ($stackerName) { + $this->partialStub('stackerName=' . $stackerName); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/stacker/class_BaseStacker.php b/inc/classes/main/stacker/class_BaseStacker.php new file mode 100644 index 00000000..31612e19 --- /dev/null +++ b/inc/classes/main/stacker/class_BaseStacker.php @@ -0,0 +1,216 @@ + + * @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 BaseStacker extends BaseFrameworkSystem { + // Exception codes + const EXCEPTION_STACKER_ALREADY_INITIALIZED = 0x050; + const EXCEPTION_STACKER_IS_FULL = 0x051; + const EXCEPTION_NO_STACKER_FOUND = 0x052; + const EXCEPTION_STACKER_IS_EMPTY = 0x053; + + /** + * An array holding all stacks + */ + private $stacks = array(); + + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Initializes given stacker + * + * @param $stackerName Name of the stack + * @return void + * @throws AlreadyInitializedStackerException If the stack is already initialized + */ + protected final function initStacker ($stackerName) { + // Is the stack already initialized? + if ($this->isStackInitialized($stackerName)) { + // Then throw the exception + throw new AlreadyInitializedStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_ALREADY_INITIALIZED); + } // END - if + + // Initialize the given stack + $this->stacks[$stackerName] = array( + 'max_size' => $this->getConfigInstance()->getConfigEntry('stacker_' . $stackerName . '_max_size'), + 'entries' => array() + ); + } + + /** + * Checks wether the given stack is initialized (set in array $stackers) + * + * @param $stackerName Name of the stack + * @return $isInitialized Wether the stack is initialized + */ + protected final function isStackInitialized ($stackerName) { + // Is is there? + $isInitialized = ((isset($this->stacks[$stackerName])) && (is_array($this->stacks[$stackerName]))); + + // Return result + return $isInitialized; + } + + /** + * Checks wether the given stack is full + * + * @param $stackerName Name of the stack + * @return $isFull Wether the stack is full + * @throws NoStackerException If given stack is missing + */ + protected final function isStackFull($stackerName) { + // Is the stack not yet initialized? + if (!$this->isStackInitialized($stackerName)) { + // Throw an exception + throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); + } // END - if + + // So, is the stack full? + $isFull = (($this->getStackCount($stackerName)) == $this->getConfigInstance()->getConfigEntry('stacker_' . $stackerName . '_max_size')); + + // Return result + return $isFull; + } + + /** + * Checks wether the given stack is empty + * + * @param $stackerName Name of the stack + * @return $isEmpty Wether the stack is empty + * @throws NoStackerException If given stack is missing + */ + protected final function isStackEmpty($stackerName) { + // Is the stack not yet initialized? + if (!$this->isStackInitialized($stackerName)) { + // Throw an exception + throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); + } // END - if + + // So, is the stack full? + $isFull = (($this->getStackCount($stackerName)) == 0); + + // Return result + return $isFull; + } + + /** + * Getter for size of given stack (array count) + * + * @param $stackerName Name of the stack + * @return $count Size of stack (array count) + * @throws NoStackerException If given stack is missing + */ + protected final function getStackCount ($stackerName) { + // Is the stack not yet initialized? + if (!$this->isStackInitialized($stackerName)) { + // Throw an exception + throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); + } // END - if + + // Now, count the array of entries + $count = count($this->stacks[$stackerName]['entries']); + + // Return result + return $count; + } + + /** + * Adds a value to given stack + * + * @param $stackerName Name of the stack + * @param $value Value to add to this stacker + * @return void + * @throws FullStackerException Thrown if the stack is full + */ + protected final function addValue ($stackerName, $value) { + // Is the stack not yet initialized or full? + if (!$this->isStackInitialized($stackerName)) { + // Then do it here + $this->initStacker($stackerName); + } elseif ($this->isStackFull($stackerName)) { + // Stacker is full + throw new FullStackerException(array($this, $stackerName, $value), self::EXCEPTION_STACKER_IS_FULL); + } + + // Now add the value to the stack + array_push($this->stacks[$stackerName]['entries'], $value); + } + + /** + * Get last value from named stacker + * + * @param $stackerName Name of the stack + * @return $value Value of last added value + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + protected final function getLastValue ($stackerName) { + // Is the stack not yet initialized or full? + if (!$this->isStackInitialized($stackerName)) { + // Throw an exception + throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); + } elseif ($this->isStackEmpty($stackerName)) { + //Throw an exception + throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); + } + + // Now get the last value + $value = $this->stacks[$stackerName]['entries'][$this->getStackCount($stackerName) - 1]; + + // Return it + return $value; + } + + /** + * "Pops" last entry from stack + * + * @param $stackerName Name of the stack + * @return void + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + protected final function popLast ($stackerName) { + // Is the stack not yet initialized or full? + if (!$this->isStackInitialized($stackerName)) { + // Throw an exception + throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); + } elseif ($this->isStackEmpty($stackerName)) { + //Throw an exception + throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); + } + + // Now, remove the last entry, we don't care about the return value here, see elseif() block above + array_pop($this->stacks[$stackerName]['entries']); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/stacker/fifo/.htaccess b/inc/classes/main/stacker/fifo/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/main/stacker/fifo/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/stacker/fifo/class_FiFoStacker.php b/inc/classes/main/stacker/fifo/class_FiFoStacker.php new file mode 100644 index 00000000..fa88aa99 --- /dev/null +++ b/inc/classes/main/stacker/fifo/class_FiFoStacker.php @@ -0,0 +1,89 @@ + + * @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 FiFoStacker extends BaseStacker implements Stackable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of the class Stacker and prepares it for usage + * + * @return $stackerInstance An instance of FiFoStacker + */ + public final static function createFiFoStacker () { + // Get a new instance + $stackerInstance = new FiFoStacker(); + + // Init generic stacker + $stackerInstance->initStacker('generic'); + + // Return the prepared instance + return $stackerInstance; + } + + /** + * Pushs a value on a named stacker + * + * @param $stackerName Name of the stack + * @param $value Value to push on it + * @return void + * @throws StackerFullException If the stack is full + */ + public function pushNamed ($stackerName, $value) { + $this->partialStub('stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . $value); + } + + /** + * 'Pops' a value from a named stacker + * + * @param $stackerName Name of the stack + * @return void + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + public function popNamed ($stackerName) { + $this->partialStub('stackerName=' . $stackerName); + } + + /** + * Get value from named stacker + * + * @param $stackerName Name of the stack + * @return $value Value of last added value + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + public function getNamed ($stackerName) { + $this->partialStub('stackerName=' . $stackerName); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/stacker/filo/.htaccess b/inc/classes/main/stacker/filo/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/main/stacker/filo/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/stacker/filo/class_FiLoStacker.php b/inc/classes/main/stacker/filo/class_FiLoStacker.php new file mode 100644 index 00000000..1a80cef2 --- /dev/null +++ b/inc/classes/main/stacker/filo/class_FiLoStacker.php @@ -0,0 +1,92 @@ + + * @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 FiLoStacker extends BaseStacker implements Stackable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of the class Stacker and prepares it for usage + * + * @return $stackerInstance An instance of FiLoStacker + */ + public final static function createFiLoStacker () { + // Get a new instance + $stackerInstance = new FiLoStacker(); + + // Init the generic stacker + $stackerInstance->initStacker('generic'); + + // Return the prepared instance + return $stackerInstance; + } + + /** + * Pushs a value on a named stacker + * + * @param $stackerName Name of the stack + * @param $value Value to push on it + * @return void + * @throws StackerFullException If the stack is full + */ + public function pushNamed ($stackerName, $value) { + // Call the protected method + parent::addValue($stackerName, $value); + } + + /** + * 'Pops' a value from a named stacker + * + * @param $stackerName Name of the stack + * @return void + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + public function popNamed ($stackerName) { + // Call the protected method + parent::popLast($stackerName); + } + + /** + * Get value from named stacker + * + * @param $stackerName Name of the stack + * @return $value Value of last added value + * @throws NoStackerException If the named stacker was not found + * @throws EmptyStackerException If the named stacker is empty + */ + public function getNamed ($stackerName) { + // Call the protected method + return parent::getLastValue($stackerName); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/template/menu/class_MenuTemplateEngine.php b/inc/classes/main/template/menu/class_MenuTemplateEngine.php index 37dfca2c..597b0149 100644 --- a/inc/classes/main/template/menu/class_MenuTemplateEngine.php +++ b/inc/classes/main/template/menu/class_MenuTemplateEngine.php @@ -141,6 +141,12 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla // Set the menu instance $tplInstance->setMenuInstance($menuInstance); + // Init a variable stacker + $stackerInstance = ObjectFactory::createObjectByConfiguredName('menu_stacker_class'); + + // Set it + $tplInstance->setStackerInstance($stackerInstance); + // Return the prepared instance return $tplInstance; } @@ -279,8 +285,9 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla return false; } // END - if - // Unfinished work! - $this->partialStub('Handling extra characters is not yet supported! length='.strlen($characters)); + // Assign the found characters to variable and use the last entry from + // stack as the name + parent::assignVariable($this->getStackerInstance()->getNamed('current_node'), $characters); } /** @@ -465,13 +472,164 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla $this->assignVariable('footer_end', $this->getTemplateInstance()->getRawTemplateData()); } + /** + * Starts the menu property 'block-list' + * + * @return void + */ + private function startBlockList () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'block-list'); + } + + /** + * Starts the menu property 'block' + * + * @return void + */ + private function startBlock () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'block'); + } + /** * Starts the menu property 'title' * * @return void */ private function startTitle () { - $this->partialStub('Cleared due to XML rewrite.'); + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'title'); + } + + /** + * Starts the menu property 'title-id' + * + * @return void + */ + private function startTitleId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'title-id'); + } + + /** + * Starts the menu property 'title-class' + * + * @return void + */ + private function startTitleClass () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'title-class'); + } + + /** + * Starts the menu property 'title-text' + * + * @return void + */ + private function startTitleText () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'title-text'); + } + + /** + * Starts the menu property 'entry' + * + * @return void + */ + private function startEntry () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'entry'); + } + + /** + * Starts the menu property 'entry-id' + * + * @return void + */ + private function startEntryId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'entry-id'); + } + + /** + * Starts the menu property 'anchor' + * + * @return void + */ + private function startAnchor () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'anchor'); + } + + /** + * Starts the menu property 'anchor-id' + * + * @return void + */ + private function startAnchorId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'anchor-id'); + } + + /** + * Starts the menu property 'anchor-text' + * + * @return void + */ + private function startAnchorText () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'anchor-text'); + } + + /** + * Starts the menu property 'anchor-title' + * + * @return void + */ + private function startAnchorTitle () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'anchor-title'); + } + + /** + * Starts the menu property 'anchor-href' + * + * @return void + */ + private function startAnchorHref () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'anchor-href'); + } + + /** + * Starts the menu property 'footer-id' + * + * @return void + */ + private function startFooterId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'footer-id'); + } + + /** + * Starts the menu property 'footer-class' + * + * @return void + */ + private function startFooterClass () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'footer-class'); + } + + /** + * Starts the menu property 'footer-text' + * + * @return void + */ + private function startFooterText () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('current_node', 'footer-text'); } /** @@ -480,87 +638,199 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla * @return void */ private function finishTitle () { - $this->partialStub('Cleared due to XML rewrite.'); + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); } /** - * Starts the menu text + * Finishes the title-id node by * * @return void */ - private function startText () { - // Do we have a template instance? - if (is_null($this->getTemplateInstance())) { - // Init template instance for underlaying web templates - $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class'); + private function finishTitleId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } - // Set it in this template engine - $this->setTemplateInstance($templateInstance); - } // END - if + /** + * Finishes the title-class node + * + * @return void + */ + private function finishTitleClass () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } - // Load the text template for this page - $this->getTemplateInstance()->loadCodeTemplate('menu_text_start'); + /** + * Finishes the title-class node + * + * @return void + */ + private function finishTitleText () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } - // Set the variable group to page - $this->setVariableGroup('menu'); + /** + * Finishes the footer-text node + * + * @return void + */ + private function finishFooterText () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } - // Set its content in this template instance - $this->assignVariable('text', $this->getTemplateInstance()->getRawTemplateData()); + /** + * Finishes the footer-class node + * + * @return void + */ + private function finishFooterClass () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); } /** - * Finishes the menu text + * Finishes the footer-id node * * @return void */ - private function finishText () { - // Load the text template for this page - $this->getTemplateInstance()->loadCodeTemplate('menu_text_end'); + private function finishFooterId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } - // Set the variable group to page - $this->setVariableGroup('menu'); + /** + * Finishes the anchor-href node + * + * @return void + */ + private function finishAnchorHref () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } - // Set its content in this template instance - $this->assignVariable('text_end', $this->getTemplateInstance()->getRawTemplateData()); + /** + * Finishes the anchor-title node + * + * @return void + */ + private function finishAnchorTitle () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); } /** - * Starts the menu property 'entry' + * Finishes the anchor-text node * * @return void */ - private function startEntry () { - $this->partialStub('Cleared due to XML rewrite.'); + private function finishAnchorText () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); } /** - * Finishes the entry node by added another template to the menu + * Finishes the anchor-id node + * + * @return void + */ + private function finishAnchorId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } + + /** + * Finishes the anchor node + * + * @return void + */ + private function finishAnchor () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } + + /** + * Finishes the entry-id node + * + * @return void + */ + private function finishEntryId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } + + /** + * Finishes the entry node * * @return void */ private function finishEntry () { - $this->partialStub('Cleared due to XML rewrite.'); + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); } /** - * Starts the menu property 'anchor' + * Finishes the block node * - * @param $id Id of the anchor - * @param $link Link text of the anchor - * @param $title Link title of the anchor * @return void */ - private function startAnchor () { - $this->partialStub('Please implement this method.'); + private function finishBlock () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); } /** - * Finishes the anchor node by added another template to the menu + * Finishes the block-list node * * @return void */ - private function finishAnchor () { - $this->partialStub('Please implement this method.'); + private function finishBlockList () { + // Pop the last entry + $this->getStackerInstance()->popNamed('current_node'); + } + + /** + * Starts the menu text + * + * @return void + */ + private function startText () { + // Do we have a template instance? + if (is_null($this->getTemplateInstance())) { + // Init template instance for underlaying web templates + $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class'); + + // Set it in this template engine + $this->setTemplateInstance($templateInstance); + } // END - if + + // Load the text template for this page + $this->getTemplateInstance()->loadCodeTemplate('menu_text_start'); + + // Set the variable group to page + $this->setVariableGroup('menu'); + + // Set its content in this template instance + $this->assignVariable('text', $this->getTemplateInstance()->getRawTemplateData()); + } + + /** + * Finishes the menu text + * + * @return void + */ + private function finishText () { + // Load the text template for this page + $this->getTemplateInstance()->loadCodeTemplate('menu_text_end'); + + // Set the variable group to page + $this->setVariableGroup('menu'); + + // Set its content in this template instance + $this->assignVariable('text_end', $this->getTemplateInstance()->getRawTemplateData()); } /** diff --git a/inc/config.php b/inc/config.php index 9e33cfad..817a3379 100644 --- a/inc/config.php +++ b/inc/config.php @@ -305,5 +305,14 @@ $cfg->setConfigEntry('product_install_mode', 'debug'); // CFG: DECIMALS $cfg->setConfigEntry('decimals', 3); +// CFG: STACKER-CLASS +$cfg->setConfigEntry('menu_stacker_class', 'FiLoStacker'); + +// CFG: STACKER-GENERIC-MAX-SIZE +$cfg->setConfigEntry('stacker_generic_max_size', 100); + +// CFG: STACKER-CURRENT-NODE-MAX-SIZE +$cfg->setConfigEntry('stacker_current_node_max_size', 20); + // [EOF] ?>