Directory prepared, missing variable fixed:
authorRoland Häder <roland@mxchange.org>
Sat, 5 Mar 2011 12:35:18 +0000 (12:35 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 5 Mar 2011 12:35:18 +0000 (12:35 +0000)
- Added missing class template for resolver class
- Prepared directory for request resolver (the method entryPoint() is to large)
- Fixed missing variable $result in method equals()

.gitattributes
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/resolver/class_ [new file with mode: 0644]
inc/classes/main/resolver/request/.htaccess [new file with mode: 0644]
inc/config/class_FrameworkConfiguration.php

index e344bccac5fceb6f16c8d0f5bde87750f1b2453d..2f1dff57277b0fec8cfec34dcdfee0e75989a349 100644 (file)
@@ -470,6 +470,7 @@ inc/classes/main/resolver/action/.htaccess -text svneol=unset#text/plain
 inc/classes/main/resolver/action/class_BaseActionResolver.php -text svneol=unset#text/plain
 inc/classes/main/resolver/action/web/.htaccess -text svneol=unset#text/plain
 inc/classes/main/resolver/action/web/class_WebActionResolver.php -text svneol=unset#text/plain
+inc/classes/main/resolver/class_ -text
 inc/classes/main/resolver/class_BaseResolver.php -text svneol=unset#text/plain
 inc/classes/main/resolver/command/.htaccess -text svneol=unset#text/plain
 inc/classes/main/resolver/command/class_BaseCommandResolver.php -text svneol=unset#text/plain
@@ -488,6 +489,7 @@ inc/classes/main/resolver/controller/image/.htaccess -text svneol=unset#text/pla
 inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php -text svneol=unset#text/plain
 inc/classes/main/resolver/controller/web/.htaccess -text svneol=unset#text/plain
 inc/classes/main/resolver/controller/web/class_WebControllerResolver.php -text svneol=unset#text/plain
+inc/classes/main/resolver/request/.htaccess svneol=native#text/plain
 inc/classes/main/response/.htaccess -text svneol=unset#text/plain
 inc/classes/main/response/class_BaseResponse.php -text svneol=unset#text/plain
 inc/classes/main/response/console/.htaccess -text svneol=unset#text/plain
index 7fa4374d41d6c735efcdf5bb541faa6e2f0b06ea..9b153224b9a9398514f4364023f56f2642e7472c 100644 (file)
@@ -595,7 +595,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                ));
 
                // Return the result
-               return $result;
+               return $equals;
        }
 
        /**
diff --git a/inc/classes/main/resolver/class_ b/inc/classes/main/resolver/class_
new file mode 100644 (file)
index 0000000..5d4fb17
--- /dev/null
@@ -0,0 +1,576 @@
+<?php
+/**
+ * A ??? resolver
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 <http://www.gnu.org/licenses/>.
+ */
+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 Web 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]
+?>
+<?php
+/**
+ * A ??? resolver
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 <http://www.gnu.org/licenses/>.
+ */
+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 Web 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]
+?>
+<?php
+/**
+ * A ??? resolver
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 <http://www.gnu.org/licenses/>.
+ */
+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 Web 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]
+?>
+<?php
+/**
+ * A ??? resolver
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 <http://www.gnu.org/licenses/>.
+ */
+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 Web 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]
+?>
diff --git a/inc/classes/main/resolver/request/.htaccess b/inc/classes/main/resolver/request/.htaccess
new file mode 100644 (file)
index 0000000..0a9de16
--- /dev/null
@@ -0,0 +1,4 @@
+Deny from all
+Deny from all
+Deny from all
+Deny from all
index 7e93e21be247d157f9b1ece5671d08ea575b8bcf..c69bd5ef892a33c12572b4b63aae00c7d28b937e 100644 (file)
@@ -335,7 +335,7 @@ class FrameworkConfiguration implements Registerable {
                ));
 
                // Return the result
-               return $result;
+               return $equals;
        }
 }