Open Journal Systems  3.3.0
Chain.php
1 <?php
2 
4 
7 
13 final class Chain implements Authentication
14 {
18  private $authenticationChain = [];
19 
23  public function __construct(array $authenticationChain = [])
24  {
25  foreach ($authenticationChain as $authentication) {
26  if (!$authentication instanceof Authentication) {
27  throw new \InvalidArgumentException(
28  'Members of the authentication chain must be of type Http\Message\Authentication'
29  );
30  }
31  }
32 
33  $this->authenticationChain = $authenticationChain;
34  }
35 
39  public function authenticate(RequestInterface $request)
40  {
41  foreach ($this->authenticationChain as $authentication) {
42  $request = $authentication->authenticate($request);
43  }
44 
45  return $request;
46  }
47 }
Http\Message\Authentication
Definition: AutoBasicAuth.php:3
Psr\Http\Message\RequestInterface
Definition: vendor/psr/http-message/src/RequestInterface.php:24
Http\Message\Authentication
Definition: Authentication.php:12
Http\Message\Authentication\Chain\__construct
__construct(array $authenticationChain=[])
Definition: Chain.php:26
Http\Message\Authentication\Chain
Definition: Chain.php:13
Http\Message\Authentication\Chain\authenticate
authenticate(RequestInterface $request)
Definition: Chain.php:42