From b76e2ff898b23745d4c9aaee49eeb7d88f2896ab Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Thu, 2 Mar 2017 22:49:24 -0500 Subject: Updated mailgun plugin --- .../src/Authentication/RequestConditional.php | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 inc/mailgun/php-http/message/src/Authentication/RequestConditional.php (limited to 'inc/mailgun/php-http/message/src/Authentication/RequestConditional.php') diff --git a/inc/mailgun/php-http/message/src/Authentication/RequestConditional.php b/inc/mailgun/php-http/message/src/Authentication/RequestConditional.php new file mode 100644 index 0000000..5477440 --- /dev/null +++ b/inc/mailgun/php-http/message/src/Authentication/RequestConditional.php @@ -0,0 +1,47 @@ + + */ +final class RequestConditional implements Authentication +{ + /** + * @var RequestMatcher + */ + private $requestMatcher; + + /** + * @var Authentication + */ + private $authentication; + + /** + * @param RequestMatcher $requestMatcher + * @param Authentication $authentication + */ + public function __construct(RequestMatcher $requestMatcher, Authentication $authentication) + { + $this->requestMatcher = $requestMatcher; + $this->authentication = $authentication; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + if ($this->requestMatcher->matches($request)) { + return $this->authentication->authenticate($request); + } + + return $request; + } +} -- cgit v1.2.3