Example #1
0
 /**
  * @return boolean
  */
 public function handle(Event\Type\Http\Request $event)
 {
     if (!parent::matchRequest($event->getRequest())) {
         $this->invalidateActions();
         return false;
     }
     foreach ($this->getApplication()->getValidActions() as $action) {
         // Skip actions which do not belong to the package
         if (!$action instanceof AbstractAction) {
             continue;
         }
         if ($action->matchRequest($event->getRequest())) {
             $this->action = $action;
             $this->controller = $this->getFactory()->createControllerByAction($action);
             $this->frontController = $this->getFactory()->createFrontControllerByAction($action);
             return true;
         }
     }
     $this->triggerResponse404($event, Event\Type\Http\Response404::create());
 }
Example #2
0
 /**
  * @return bool
  */
 public function process(Event\Type\Http\Request $event)
 {
     if (!$this->matchRequest($event->getRequest())) {
         return false;
     }
     $pkgActions = $this->getApplication()->getPackageActions($this->getPackage());
     foreach ($pkgActions as $action) {
         if ($this->skipAction($action)) {
             continue;
         }
         if ($action->matchRequest($event->getRequest())) {
             $this->action = $action;
             $this->controller = $this->getFactory()->createControllerByAction($action);
             $this->frontController = $this->getFactory()->createFrontControllerByAction($action);
             return true;
         }
     }
     $this->triggerResponse404($event, Event\Type\Http\Response404::create());
     return false;
 }