X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fmain%2Fclasses%2Fresolver%2Fclass_;h=763479a3a7af65a43fe281ea49d8157690326b09;hp=5cdfd089297bf6139ae070f0b4a514ebfa0ca443;hb=39c1aaf705e8e3c274d56ef1fa931a086f729c48;hpb=751f9e6c51f00dba27757b72fc85490e51fd3797 diff --git a/inc/main/classes/resolver/class_ b/inc/main/classes/resolver/class_ index 5cdfd089..763479a3 100644 --- a/inc/main/classes/resolver/class_ +++ b/inc/main/classes/resolver/class_ @@ -1,443 +1,10 @@ * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 ???Resolver extends BaseResolver implements Resolver { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set prefix to '???' - $this->setClassPrefix('???'); - } - - /** - * Creates an instance of a Html action resolver with a given default action - * - * @param $!!!Name The default action we shall execute - * @param $appInstance An instance of a manageable application helper class - * @return $resolverInstance The prepared action resolver instance - * @throws EmptyVariableException Thrown if default action is not set - * @throws Invalid|||Exception Thrown if default action is invalid - */ - public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) { - // Create the new instance - $resolverInstance = new ???Resolver(); - - // Is the variable $!!!Name set and the action is valid? - if (empty($!!!Name)) { - // Then thrown an exception here - throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) { - // Invalid action found - throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } - - // Set the application instance - $resolverInstance->setApplicationInstance($appInstance); - - // Return the prepared instance - return $resolverInstance; - } - - /** - * Returns an action instance for a given request class or null if - * it was not found - * - * @param $requestInstance An instance of a request class - * @return $!!!Instance An instance of the resolved action - * @throws Invalid|||Exception Thrown if $!!!Name is - * invalid - * @throws Invalid|||InstanceException Thrown if $!!!Instance - * is an invalid instance - */ - public function resolve|||ByRequest (Requestable $requestInstance) { - // Init variables - $!!!Name = ''; - $!!!Instance = null; - - // This goes fine so let's resolve the action - $!!!Name = $requestInstance->getRequestElement('action'); - - // Is the action empty? Then fall back to default action - if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action'); - - // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { - // This action is invalid! - throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Get the action - $!!!Instance = $this->load|||(); - - // And validate it - if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) { - // This action has an invalid instance! - throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Set last action - $this->setResolvedInstance($!!!Instance); - - // Return the resolved action instance - return $!!!Instance; - } - - /** - * Resolves the action by its direct name and returns an instance of its class - * - * @return $!!!Instance An instance of the action class - * @throws Invalid|||Exception Thrown if $!!!Name is invalid - */ - public function resolve||| () { - // Initiate the instance variable - $!!!Instance = null; - - // Get action name - $!!!Name = $this->get|||Name(); - - // Is the action empty? Then fall back to default action - if (empty($!!!Name)) { - $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action'); - } // END - if - - // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { - // This action is invalid! - throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Get the action - $!!!Instance = $this->load|||(); - - // Return the instance - return $!!!Instance; - } -} - -// [EOF] -?> - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 ???Resolver extends BaseResolver implements Resolver { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set prefix to '???' - $this->setClassPrefix('???'); - } - - /** - * Creates an instance of a Html action resolver with a given default action - * - * @param $!!!Name The default action we shall execute - * @param $appInstance An instance of a manageable application helper class - * @return $resolverInstance The prepared action resolver instance - * @throws EmptyVariableException Thrown if default action is not set - * @throws Invalid|||Exception Thrown if default action is invalid - */ - public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) { - // Create the new instance - $resolverInstance = new ???Resolver(); - - // Is the variable $!!!Name set and the action is valid? - if (empty($!!!Name)) { - // Then thrown an exception here - throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) { - // Invalid action found - throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } - - // Set the application instance - $resolverInstance->setApplicationInstance($appInstance); - - // Return the prepared instance - return $resolverInstance; - } - - /** - * Returns an action instance for a given request class or null if - * it was not found - * - * @param $requestInstance An instance of a request class - * @return $!!!Instance An instance of the resolved action - * @throws Invalid|||Exception Thrown if $!!!Name is - * invalid - * @throws Invalid|||InstanceException Thrown if $!!!Instance - * is an invalid instance - */ - public function resolve|||ByRequest (Requestable $requestInstance) { - // Init variables - $!!!Name = ''; - $!!!Instance = null; - - // This goes fine so let's resolve the action - $!!!Name = $requestInstance->getRequestElement('action'); - - // Is the action empty? Then fall back to default action - if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action'); - - // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { - // This action is invalid! - throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Get the action - $!!!Instance = $this->load|||(); - - // And validate it - if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) { - // This action has an invalid instance! - throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Set last action - $this->setResolvedInstance($!!!Instance); - - // Return the resolved action instance - return $!!!Instance; - } - - /** - * Resolves the action by its direct name and returns an instance of its class - * - * @return $!!!Instance An instance of the action class - * @throws Invalid|||Exception Thrown if $!!!Name is invalid - */ - public function resolve||| () { - // Initiate the instance variable - $!!!Instance = null; - - // Get action name - $!!!Name = $this->get|||Name(); - - // Is the action empty? Then fall back to default action - if (empty($!!!Name)) { - $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action'); - } // END - if - - // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { - // This action is invalid! - throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Get the action - $!!!Instance = $this->load|||(); - - // Return the instance - return $!!!Instance; - } -} - -// [EOF] -?> - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 ???Resolver extends BaseResolver implements Resolver { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set prefix to '???' - $this->setClassPrefix('???'); - } - - /** - * Creates an instance of a Html action resolver with a given default action - * - * @param $!!!Name The default action we shall execute - * @param $appInstance An instance of a manageable application helper class - * @return $resolverInstance The prepared action resolver instance - * @throws EmptyVariableException Thrown if default action is not set - * @throws Invalid|||Exception Thrown if default action is invalid - */ - public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) { - // Create the new instance - $resolverInstance = new ???Resolver(); - - // Is the variable $!!!Name set and the action is valid? - if (empty($!!!Name)) { - // Then thrown an exception here - throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) { - // Invalid action found - throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } - - // Set the application instance - $resolverInstance->setApplicationInstance($appInstance); - - // Return the prepared instance - return $resolverInstance; - } - - /** - * Returns an action instance for a given request class or null if - * it was not found - * - * @param $requestInstance An instance of a request class - * @return $!!!Instance An instance of the resolved action - * @throws Invalid|||Exception Thrown if $!!!Name is - * invalid - * @throws Invalid|||InstanceException Thrown if $!!!Instance - * is an invalid instance - */ - public function resolve|||ByRequest (Requestable $requestInstance) { - // Init variables - $!!!Name = ''; - $!!!Instance = null; - - // This goes fine so let's resolve the action - $!!!Name = $requestInstance->getRequestElement('action'); - - // Is the action empty? Then fall back to default action - if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action'); - - // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { - // This action is invalid! - throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Get the action - $!!!Instance = $this->load|||(); - - // And validate it - if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) { - // This action has an invalid instance! - throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Set last action - $this->setResolvedInstance($!!!Instance); - - // Return the resolved action instance - return $!!!Instance; - } - - /** - * Resolves the action by its direct name and returns an instance of its class - * - * @return $!!!Instance An instance of the action class - * @throws Invalid|||Exception Thrown if $!!!Name is invalid - */ - public function resolve||| () { - // Initiate the instance variable - $!!!Instance = null; - - // Get action name - $!!!Name = $this->get|||Name(); - - // Is the action empty? Then fall back to default action - if (empty($!!!Name)) { - $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action'); - } // END - if - - // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { - // This action is invalid! - throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); - } // END - if - - // Get the action - $!!!Instance = $this->load|||(); - - // Return the instance - return $!!!Instance; - } -} - -// [EOF] -?> - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -571,7 +138,5 @@ class ???Resolver extends BaseResolver implements Resolver { // Return the instance return $!!!Instance; } -} -// [EOF] -?> +}