*/ final class QueryParam implements Authentication { /** * @var array */ private $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); } }