Beispiel #1
0
 /**
  * Get an instance of the action class to be used
  * @throws DrestException
  * @return AbstractAction $action
  */
 protected function getActionInstance()
 {
     if (!isset($this->service_action)) {
         $actionClass = $this->matched_route->getActionClass();
         if (is_null($actionClass)) {
             // Run default action class
             $this->service_action = $this->getDefaultAction();
         } else {
             if (!class_exists($actionClass)) {
                 throw DrestException::unknownActionClass($actionClass);
             }
             $this->service_action = new $actionClass($this);
         }
         if (!$this->service_action instanceof AbstractAction) {
             throw DrestException::actionClassNotAnInstanceOfActionAbstract($this->service_action);
         }
     }
     return $this->service_action;
 }