getAction() public method

public getAction ( )
示例#1
0
 public function init()
 {
     $uri = new Uri();
     $router = new Router($uri);
     $routeRule = $router->findRoute();
     $this->currentController = $routeRule->getController();
     $this->requestContext->setCurrentController($this->currentController);
     $this->currentAction = $routeRule->isActionRequired() ? $routeRule->getAction() : $uri->getAction();
     $this->sessionInitializer->startSession();
     $this->currentControllerObject = $this->controllerFactory->createController($routeRule);
     $this->requestContext->setCurrentControllerObject($this->currentControllerObject);
     $this->_logRequest();
     $afterInitCallback = Config::getValue('callback', 'afterControllerInit');
     if ($afterInitCallback) {
         Functions::call($afterInitCallback, array());
     }
     try {
         ob_start();
         $this->_invokeControllerMethods();
     } catch (Exception $e) {
         ob_end_clean();
         throw $e;
     }
     ob_end_flush();
 }
示例#2
0
 /**
  * @test
  */
 public function shouldReturnEmptyArrayWhenParsePathIsNull()
 {
     //given
     $this->_path(null);
     //when
     $path = $this->uri->getAction();
     //then
     $this->assertNull($path);
 }
示例#3
0
 public function initialize(RouteRule $routeRule)
 {
     $this->_routeRule = $routeRule;
     $uri = new Uri();
     $this->currentController = $routeRule->getController();
     $this->currentAction = $routeRule->isActionRequired() ? $routeRule->getAction() : $uri->getAction();
     $viewName = $this->getViewName();
     $this->view = new View($viewName);
     $this->layout = new Layout($this->view);
     $this->params = $this->createParameters($routeRule, $uri);
 }