Drest\Service::getActionInstance PHP Method

getActionInstance() protected method

Get an instance of the action class to be used
protected getActionInstance ( ) : Drest\Service\Action\AbstractAction
return Drest\Service\Action\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;
    }