protected function getRequestInstance($requestType)
    {
        // First, we check if the request type is a valid namespace: if so, we instantiate the given class
        $className = null;
        if (class_exists($requestType)) {
            $className = $requestType;
        } elseif (class_exists(AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType)) {
            // If still not found, we add to the string the default namespace
            $className = AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType;
        } elseif (class_exists(AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType . AbstractActionRequest::REQUEST_CLASSNAME_SUFFIX)) {
            // If still not found, we add to the string a default class name suffix and the default namespace
            $className = AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType . AbstractActionRequest::REQUEST_CLASSNAME_SUFFIX;
        } else {
            throw new UnsupportedRequestTypeException(
                sprintf('[%s] Unsupported request type: \'%s\'', $this->getApiName(), $requestType),
                $requestType
            );
        }

        // If not found, we launch an exception
        $requestObj = new $className();
        if (!$requestObj instanceof ActionRequestInterface) {
            throw new UnsupportedRequestTypeException($this->getNotValidRequestExMsg($requestObj), $requestType);
        }

        // Return the ActionRequestInterface instance
        return $requestObj;
    }
protected function getRequestInstance($requestType)
    {
        // First, we check if the request type is a valid namespace: if so, we instantiate the given class
        $className = null;
        if (class_exists($requestType)) {
            $className = $requestType;
        } elseif (class_exists(AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType)) {
            // If still not found, we add to the string the default namespace
            $className = AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType;
        } elseif (class_exists(AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType . AbstractActionRequest::REQUEST_CLASSNAME_SUFFIX)) {
            // If still not found, we add to the string a default class name suffix and the default namespace
            $className = AbstractActionRequest::REQUEST_NAMESPACE . '\\' . $requestType . AbstractActionRequest::REQUEST_CLASSNAME_SUFFIX;
        } else {
            throw new UnsupportedRequestTypeException(
                sprintf('[%s] Unsupported request type: \'%s\'', $this->getApiName(), $requestType),
                $requestType
            );
        }

        // If not found, we launch an exception
        $requestObj = new $className();
        if (!$requestObj instanceof ActionRequestInterface) {
            throw new UnsupportedRequestTypeException($this->getNotValidRequestExMsg($requestObj), $requestType);
        }

        // Return the ActionRequestInterface instance
        return $requestObj;
    }
protected function getRequestInstance ( $ requestType ) { // First, we check if the request type is a valid namespace: if so, we instantiate the given class $ className = null ; if ( class_exists ( $ requestType ) ) { $ className = $ requestType ; } elseif ( class_exists ( AbstractActionRequest :: REQUEST_NAMESPACE . '\\' . $ requestType ) ) { // If still not found, we add to the string the default namespace $ className = AbstractActionRequest :: REQUEST_NAMESPACE . '\\' . $ requestType ; } elseif ( class_exists ( AbstractActionRequest :: REQUEST_NAMESPACE . '\\' . $ requestType . AbstractActionRequest :: REQUEST_CLASSNAME_SUFFIX ) ) { // If still not found, we add to the string a default class name suffix and the default namespace $ className = AbstractActionRequest :: REQUEST_NAMESPACE . '\\' . $ requestType . AbstractActionRequest :: REQUEST_CLASSNAME_SUFFIX ; } else { throw new UnsupportedRequestTypeException ( sprintf ( '[%s] Unsupported request type: \'%s\'' , $ this -> getApiName ( ) , $ requestType ) , $ requestType ) ; } // If not found, we launch an exception $ requestObj = new $ className ( ) ; if ( ! $ requestObj instanceof ActionRequestInterface ) { throw new UnsupportedRequestTypeException ( $ this -> getNotValidRequestExMsg ( $ requestObj ) , $ requestType ) ; } // Return the ActionRequestInterface instance return $ requestObj ; }
Returns a proper ActionRequestInterface instance for the given Request Type

@param string $requestType string representation of a request type (could be a class name or a string identifier)

@return ActionRequestInterface

@throws \Msl\RemoteHost\Exception\UnsupportedRequestTypeException
Returns a proper ActionRequestInterface instance for the given Request Type