src/Api/Client.php
public function send($controller, User $actor = null, array $queryParams = [], array $body = []): ResponseInterface
    {
        $request = ServerRequestFactory::fromGlobals(null, $queryParams, $body);

        $request = $request->withAttribute('actor', $actor);

        if (is_string($controller)) {
            $controller = $this->container->make($controller);
        }

        if (! ($controller instanceof RequestHandlerInterface)) {
            throw new InvalidArgumentException(
                'Endpoint must be an instance of '.RequestHandlerInterface::class
            );
        }

        try {
            return $controller->handle($request);
        } catch (Exception $e) {
            if (! $this->errorHandler) {
                throw $e;
            }

            return $this->errorHandler->handle($e);
        }
    }
public function send($controller, User $actor = null, array $queryParams = [], array $body = []): ResponseInterface
    {
        $request = ServerRequestFactory::fromGlobals(null, $queryParams, $body);

        $request = $request->withAttribute('actor', $actor);

        if (is_string($controller)) {
            $controller = $this->container->make($controller);
        }

        if (! ($controller instanceof RequestHandlerInterface)) {
            throw new InvalidArgumentException(
                'Endpoint must be an instance of '.RequestHandlerInterface::class
            );
        }

        try {
            return $controller->handle($request);
        } catch (Exception $e) {
            if (! $this->errorHandler) {
                throw $e;
            }

            return $this->errorHandler->handle($e);
        }
    }
public function send ( $ controller , User $ actor = null , array $ queryParams = [ ] , array $ body = [ ] ) : ResponseInterface { $ request = ServerRequestFactory :: fromGlobals ( null , $ queryParams , $ body ) ; $ request = $ request -> withAttribute ( 'actor' , $ actor ) ; if ( is_string ( $ controller ) ) { $ controller = $ this -> container -> make ( $ controller ) ; } if ( ! ( $ controller instanceof RequestHandlerInterface ) ) { throw new InvalidArgumentException ( 'Endpoint must be an instance of ' . RequestHandlerInterface :: class ) ; } try { return $ controller -> handle ( $ request ) ; } catch ( Exception $ e ) { if ( ! $ this -> errorHandler ) { throw $ e ; } return $ this -> errorHandler -> handle ( $ e ) ; } }
Execute the given API action class, pass the input and return its response.

@param string|RequestHandlerInterface $controller
@param User|null $actor
@param array $queryParams
@param array $body
@return ResponseInterface
@throws Exception
Execute the given API action class pass the input and return its response .