/**
  * @param Event               $event
  * @param DispatcherInterface $dispatcher
  */
 public function beforeDispatchLoop(Event $event, DispatcherInterface $dispatcher, $data)
 {
     if ($dispatcher->getActionName()) {
         $actionName = $dispatcher->getActionName();
         $actionName = Text::camelize($actionName);
         $actionName = lcfirst($actionName);
         $dispatcher->setActionName($actionName);
     }
 }
 /**
  * @param \Phalcon\Events\Event        $event
  * @param \Phalcon\DispatcherInterface $dispatcher
  *
  * @throws \Phalcon\Mvc\Dispatcher\Exception
  */
 public function beforeExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\DispatcherInterface $dispatcher, $data)
 {
     $methodAnnotations = $this->annotations->getMethod($dispatcher->getHandlerClass(), $dispatcher->getActiveMethod());
     if (!$methodAnnotations->has("RequiredParams")) {
         return;
     }
     $requiredParams = $methodAnnotations->get("RequiredParams")->getArgument(0);
     $specifiedParams = array_keys($this->getParams());
     $missingParams = array_diff($requiredParams, $specifiedParams);
     if (count($missingParams) > 0) {
         throw new \Sid\Phalcon\RequiredParams\Exception("Required parameters not specified (" . implode(", ", $missingParams) . ").");
     }
 }
 /**
  * @param \Phalcon\Events\Event        $event
  * @param \Phalcon\DispatcherInterface $dispatcher
  * @param \Exception                   $exception
  *
  * @return boolean
  */
 public function beforeException(\Phalcon\Events\Event $event, \Phalcon\DispatcherInterface $dispatcher, \Exception $exception)
 {
     $methodAnnotations = $this->annotations->getMethod($dispatcher->getHandlerClass(), $dispatcher->getActiveMethod());
     if (!$methodAnnotations->has("ForwardException")) {
         return true;
     }
     $annotation = $methodAnnotations->get("ForwardException");
     $forward = $annotation->getArgument(0);
     $dispatcher->forward($forward);
     if ($annotation->hasArgument(1)) {
         $callbackNames = $annotation->getArgument(1);
         foreach ($callbackNames as $callbackName) {
             if (isset($this->callbacks[$callbackName])) {
                 $closure = \Closure::bind($this->callbacks[$callbackName], $this);
                 $closure($exception);
             }
         }
     }
     return false;
 }
 /**
  * @param Event               $event
  * @param DispatcherInterface $dispatcher
  * @param Exception           $exception
  *
  * @return boolean
  */
 public function beforeException(Event $event, DispatcherInterface $dispatcher, Exception $exception)
 {
     $dispatcher->forward(["controller" => $this->controller, "action" => $this->action, "params" => [$exception]]);
     return false;
 }