X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fclasses%2Fmain%2Fcontroller%2Fclass_;h=a6cea16e326509a7dfe78c2385ed676b8340ce96;hb=2230a2e7e09b6b47fe3d68181a28a4435c1732e6;hp=46459d5d8a374b08a709b32a7cdd085216df77f5;hpb=42bc0e1fc5ae4653fe04c9d41474c874a0050b69;p=mailer.git diff --git a/inc/classes/main/controller/class_ b/inc/classes/main/controller/class_ index 46459d5d8a..a6cea16e32 100644 --- a/inc/classes/main/controller/class_ +++ b/inc/classes/main/controller/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class Controller extends BaseController implements Controller { +class ???Controller extends BaseController implements Controller { /** * Protected constructor * @@ -30,15 +30,44 @@ class Controller extends BaseController implements Controller { protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + */ + public final static function create???Controller (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new ???Controller(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $controllerInstance; + } + + /** + * Handles the given request and response + * + * @param $requestInstance An instance of a request class + * @param $responseInstance An instance of a response class + * @return void + */ + public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Get the command instance + $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); - // Set part description - $this->setObjectDescription("Ein spezieller Controller"); + // This request was valid! :-D + $requestInstance->requestIsValid(); - // Create unique ID number - $this->generateUniqueId(); + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); - // Clean up a little - $this->removeSystemArray(); + // Flush the response out + $responseInstance->flushBuffer(); } }