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 --- .../message/src/Authentication/QueryParam.php | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 inc/mailgun/php-http/message/src/Authentication/QueryParam.php (limited to 'inc/mailgun/php-http/message/src/Authentication/QueryParam.php') diff --git a/inc/mailgun/php-http/message/src/Authentication/QueryParam.php b/inc/mailgun/php-http/message/src/Authentication/QueryParam.php new file mode 100644 index 0000000..14b58ff --- /dev/null +++ b/inc/mailgun/php-http/message/src/Authentication/QueryParam.php @@ -0,0 +1,50 @@ + + */ +final class QueryParam implements Authentication +{ + /** + * @var array + */ + private $params = []; + + /** + * @param array $params + */ + public function __construct(array $params) + { + $this->params = $params; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + $uri = $request->getUri(); + $query = $uri->getQuery(); + $params = []; + + parse_str($query, $params); + + $params = array_merge($params, $this->params); + + $query = http_build_query($params); + + $uri = $uri->withQuery($query); + + return $request->withUri($uri); + } +} -- cgit v1.2.3