requestHandler = $requestHandler; } /** * * @return RequestHandlerAbstract */ public function getRequestHandler() { return $this->requestHandler; } /** * Getter * @return Phrasea\Kernel */ public function getKernel() { return $this->requestHandler->getKernel(); } /** * Getter * @return Request */ public function getRequest() { return $this->getKernel()->getRequest(); } /** * Getter * @return EntityManager */ public function getEntityManager() { return $this->getKernel()->getEntityManager(); } /** * Getter * @return \registryInterface */ public function getRegistry() { return $this->getKernel()->getRegistry(); } /** * Getter * @return Response */ public function getResponse() { if (null === $this->response) { $this->process(); } return $this->response; } /** * * @return ControllerProcessorAbstract */ public function process() { $response = null; switch (strtoupper($this->getRequest()->getMethod())) { case 'POST' : $response = $this->post(); break; case 'PUT' : $response = $this->put(); break; case 'DELETE' : $response = $this->delete(); break; case 'GET' : $response = $this->get(); break; case 'OPTIONS' : $response = $this->options(); break; case 'HEAD' : $response = $this->head(); break; default : throw new Http\NotImplemented(); break; } $this->response = $response; return $this; } /** * Handle post action */ protected function post() { throw new Http\MethodNotAllowed($this->getAllowedMethods()); } /** * Handle delete action */ protected function delete() { throw new Http\MethodNotAllowed($this->getAllowedMethods()); } /** * Handle get action */ protected function get() { throw new Http\MethodNotAllowed($this->getAllowedMethods()); } /** * Handle put action */ protected function put() { throw new Http\MethodNotAllowed($this->getAllowedMethods()); } /** * Handle options action */ protected function options() { throw new Http\MethodNotAllowed($this->getAllowedMethods()); } /** * Handle head action */ protected function head() { throw new Http\MethodNotAllowed($this->getAllowedMethods()); } }