X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fcontroller%2Fdefault%2Fclass_WebDefaultController.php;h=ec56fdd9fb64461c8130014af9ecf7a36a9d5d5b;hb=11808cd3fb50e3ac374381b646c0852bf010bdb2;hp=3256f461d8b928d988b5914375a49e7f85f35e55;hpb=e66d9d3d9ab15a66fd136f41e046e33c785c3e2a;p=shipsimu.git diff --git a/inc/classes/main/controller/default/class_WebDefaultController.php b/inc/classes/main/controller/default/class_WebDefaultController.php index 3256f46..ec56fdd 100644 --- a/inc/classes/main/controller/default/class_WebDefaultController.php +++ b/inc/classes/main/controller/default/class_WebDefaultController.php @@ -23,12 +23,7 @@ */ class WebWebDefaultController extends BaseController implements Controller { /** - * Instance of a CommandResolver class - */ - private $resolverInstance = null; - - /** - * Private constructor + * Protected constructor * * @return void */ @@ -37,13 +32,10 @@ class WebWebDefaultController extends BaseController implements Controller { parent::__construct(__CLASS__); // Set part description - $this->setObjectDescription("Standart-Controller für alle übrigen Anfragen"); + $this->setObjectDescription("Default controller for all other requests"); // Create unique ID number - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); + $this->generateUniqueId(); } /** @@ -63,16 +55,6 @@ class WebWebDefaultController extends BaseController implements Controller { return $controllerInstance; } - /** - * Setter for a command resolver instance - * - * @param $resolverInstance An instance of a command resolver class - * @return void - */ - public final function setResolverInstance (CommandResolver $resolverInstance) { - $this->resolverInstance = $resolverInstance; - } - /** * Handles the given request and response * @@ -82,13 +64,16 @@ class WebWebDefaultController extends BaseController implements Controller { */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { // Get the command instance - $commandInstance = $this->resolverInstance->resolvCommandByRequest($requestInstance); + $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance); + + // This request was valid! :-D + $requestInstance->requestIsValid(); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); // Flush the response out - $responseInstance->flushResponse(); + $responseInstance->flushBuffer(); } }