for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
*
* (c) Yaroslav Honcharuk <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Yarhon\RouteGuardBundle\Controller\ArgumentResolver;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
/**
* Returns the same instance as the request object passed along.
* @author Yaroslav Honcharuk <[email protected]>
* @author Iltar van der Berg <[email protected]>
final class RequestValueResolver implements ArgumentValueResolverInterface
{
* {@inheritdoc}
public function supports(ArgumentResolverContextInterface $context, ArgumentMetadata $argument)
return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class);
}
public function resolve(ArgumentResolverContextInterface $context, ArgumentMetadata $argument)
return $context->getRequest();