src/Controller/Component/AuthorizationComponent.php
protected function getService(ServerRequestInterface $request)
    {
        $serviceAttribute = $this->getConfig('serviceAttribute');
        $service = $request->getAttribute($serviceAttribute);
        if (!$service instanceof AuthorizationServiceInterface) {
            $type = is_object($service) ? get_class($service) : gettype($service);
            throw new InvalidArgumentException(sprintf(
                'Expected that `%s` would be an instance of %s, but got %s',
                $serviceAttribute,
                AuthorizationServiceInterface::class,
                $type
            ));
        }

        return $service;
    }
protected function getService(ServerRequestInterface $request)
    {
        $serviceAttribute = $this->getConfig('serviceAttribute');
        $service = $request->getAttribute($serviceAttribute);
        if (!$service instanceof AuthorizationServiceInterface) {
            $type = is_object($service) ? get_class($service) : gettype($service);
            throw new InvalidArgumentException(sprintf(
                'Expected that `%s` would be an instance of %s, but got %s',
                $serviceAttribute,
                AuthorizationServiceInterface::class,
                $type
            ));
        }

        return $service;
    }
protected function getService ( ServerRequestInterface $ request ) { $ serviceAttribute = $ this -> getConfig ( 'serviceAttribute' ) ; $ service = $ request -> getAttribute ( $ serviceAttribute ) ; if ( ! $ service instanceof AuthorizationServiceInterface ) { $ type = is_object ( $ service ) ? get_class ( $ service ) : gettype ( $ service ) ; throw new InvalidArgumentException ( sprintf ( 'Expected that `%s` would be an instance of %s, but got %s' , $ serviceAttribute , AuthorizationServiceInterface :: class , $ type ) ) ; } return $ service ; }
Get the authorization service from a request.

@param \Psr\Http\Message\ServerRequestInterface $request The request
@return \Authorization\AuthorizationServiceInterface
@throws \InvalidArgumentException When invalid authorization service encountered.
Get the authorization service from a request .