Zend\Mvc\Controller\AbstractRestfulController::dispatch PHP Метод

dispatch() публичный Метод

If the route match includes an "action" key, then this acts basically like a standard action controller. Otherwise, it introspects the HTTP method to determine how to handle the request, and which method to delegate to.
public dispatch ( Zend\Stdlib\RequestInterface $request, Zend\Stdlib\ResponseInterface $response = null ) : mixed | Zend\Stdlib\ResponseInterface
$request Zend\Stdlib\RequestInterface
$response Zend\Stdlib\ResponseInterface
Результат mixed | Zend\Stdlib\ResponseInterface
    public function dispatch(Request $request, Response $response = null)
    {
        if (!$request instanceof HttpRequest) {
            throw new Exception\InvalidArgumentException('Expected an HTTP request');
        }
        return parent::dispatch($request, $response);
    }

Usage Example

 /**
  * @override
  * dispatch
  *
  * @param RequestInterface  $request
  * @param ResponseInterface $response
  *
  * @return mixed|ResponseInterface
  */
 public function dispatch(RequestInterface $request, ResponseInterface $response = null)
 {
     $this->request = $request;
     $response = $this->getResponse();
     return parent::dispatch($request, $response);
 }