actionClassNotAnInstanceOfActionAbstract() public static method

Service Exceptions
public static actionClassNotAnInstanceOfActionAbstract ( string $class ) : DrestException
$class string
return DrestException
Example #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($actionClass);
         }
     }
     return $this->service_action;
 }
Example #2
0
 /**
  * Get an instance of the action class to be used
  * @throws DrestException
  * @return AbstractAction $action
  */
 protected function getActionInstance()
 {
     if (!isset($this->service_action)) {
         if ($this->service_action_registry->hasServiceAction($this->matched_route)) {
             $this->service_action = $this->service_action_registry->getServiceAction($this->matched_route);
             $this->service_action->setService($this);
         } else {
             $this->service_action = $this->getDefaultAction();
         }
         if (!$this->service_action instanceof AbstractAction) {
             throw DrestException::actionClassNotAnInstanceOfActionAbstract(get_class($this->service_action));
         }
     }
     return $this->service_action;
 }