for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Http\Message\Authentication;
use Http\Message\Authentication;
use Http\Message\RequestMatcher;
use Psr\Http\Message\RequestInterface;
/**
* Authenticate a PSR-7 Request if the request is matching the given request matcher.
*
* @author Márk Sági-Kazár <[email protected]>
*/
final class RequestConditional implements Authentication
{
* @var Authentication
private $authentication;
* @var RequestMatcher
private $matcher;
* @param Authentication $authentication
* @param RequestMatcher $matcher
public function __construct(Authentication $authentication, RequestMatcher $matcher)
$this->authentication = $authentication;
$this->matcher = $matcher;
}
* {@inheritdoc}
public function authenticate(RequestInterface $request)
if ($this->matcher->matches($request)) {
return $this->authentication->authenticate($request);
return $request;