Webiny\Component\Rest\Response\Router::processRequest PHP Method

processRequest() public method

Process the api rest request and return the CallbackResult object.
public processRequest ( ) : CallbackResult
return CallbackResult
    public function processRequest()
    {
        // get version cache file
        $version = $this->getVersion();
        // get class data from the compiled cache files
        $classData = $this->compilerCache->getCacheContent($this->api, $this->class, $version);
        // match request
        return $this->matchRequest($classData);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Processes the current request and returns an instance of CallbackResult.
  *
  * @return bool|Response\CallbackResult
  * @throws RestException
  */
 public function processRequest()
 {
     try {
         $router = new Router($this->api, $this->class, $this->normalize, $this->cacheInstance);
         // check if url is set via the initRest method
         if (!empty(self::$url)) {
             $router->setUrl(self::$url);
         }
         // check if the method vas set via initRest method
         if (!empty(self::$method)) {
             $router->setHttpMethod(self::$method);
         }
         return $router->processRequest();
     } catch (\Exception $e) {
         $exception = new RestException('Unable to process request for class "' . $this->class . '". ' . $e->getMessage());
         $exception->setRequestedClass($this->class);
         throw $exception;
     }
 }
All Usage Examples Of Webiny\Component\Rest\Response\Router::processRequest