Example #1
0
 /**
  * Does the real handling of the request.
  * @param array $cookie
  */
 protected function doHandleRequest($cookie = [])
 {
     $request = $this->request;
     $pixie = $this->pixie;
     $pixie->cookie->set_cookie_data($cookie);
     $controllerName = implode('', array_map('ucfirst', preg_split('/_/', $request->param('controller'))));
     $controller = Controller::createController($controllerName, $request, $pixie);
     // Run all necessary filters
     $this->pixie->dispatcher->dispatch(Events::PRE_PROCESS_ACTION, new PreActionEvent($request, $controller));
     $action = strtolower($request->method);
     $action = $action == 'head' ? 'get' : $action;
     if (!$controller instanceof NoneController) {
         if (!$request->param('id')) {
             if (in_array($this->request->method, ['GET', 'HEAD'])) {
                 $action .= '_collection';
             }
         } else {
             if ($request->param('property')) {
                 $action .= '_' . $request->param('property');
             }
         }
     }
     $controller->run($action);
     $this->response = $controller->response;
 }