class Psr7RequestValueResolver

Same name in other branches
  1. 9 core/lib/Drupal/Core/Controller/ArgumentResolver/Psr7RequestValueResolver.php \Drupal\Core\Controller\ArgumentResolver\Psr7RequestValueResolver
  2. 8.9.x core/lib/Drupal/Core/Controller/ArgumentResolver/Psr7RequestValueResolver.php \Drupal\Core\Controller\ArgumentResolver\Psr7RequestValueResolver
  3. 11.x core/lib/Drupal/Core/Controller/ArgumentResolver/Psr7RequestValueResolver.php \Drupal\Core\Controller\ArgumentResolver\Psr7RequestValueResolver

Yields a PSR7 request object based on the request object passed along.

Hierarchy

  • class \Drupal\Core\Controller\ArgumentResolver\Psr7RequestValueResolver implements \Symfony\Component\HttpKernel\Controller\ValueResolverInterface

Expanded class hierarchy of Psr7RequestValueResolver

1 string reference to 'Psr7RequestValueResolver'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses Psr7RequestValueResolver
argument_resolver.psr7_request in core/core.services.yml
Drupal\Core\Controller\ArgumentResolver\Psr7RequestValueResolver

File

core/lib/Drupal/Core/Controller/ArgumentResolver/Psr7RequestValueResolver.php, line 14

Namespace

Drupal\Core\Controller\ArgumentResolver
View source
final class Psr7RequestValueResolver implements ValueResolverInterface {
    
    /**
     * The PSR-7 converter.
     *
     * @var \Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface
     */
    protected $httpMessageFactory;
    
    /**
     * Constructs a new ControllerResolver.
     *
     * @param \Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface $http_message_factory
     *   The PSR-7 converter.
     */
    public function __construct(HttpMessageFactoryInterface $http_message_factory) {
        $this->httpMessageFactory = $http_message_factory;
    }
    
    /**
     * {@inheritdoc}
     *
     * @deprecated in drupal:10.2.0 and is removed from drupal:11.0.0.
     *    There is no replacement.
     *
     * @see https://www.drupal.org/node/3383585
     */
    public function supports(Request $request, ArgumentMetadata $argument) : bool {
        @trigger_error(__METHOD__ . ' is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3383585', E_USER_DEPRECATED);
        return $argument->getType() == ServerRequestInterface::class;
    }
    
    /**
     * {@inheritdoc}
     */
    public function resolve(Request $request, ArgumentMetadata $argument) : array {
        return $argument->getType() === ServerRequestInterface::class ? [
            $this->httpMessageFactory
                ->createRequest($request),
        ] : [];
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary
Psr7RequestValueResolver::$httpMessageFactory protected property The PSR-7 converter.
Psr7RequestValueResolver::resolve public function
Psr7RequestValueResolver::supports Deprecated public function
Psr7RequestValueResolver::__construct public function Constructs a new ControllerResolver.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.