<?php
 namespace League\OAuth2\Client\Tool; use GuzzleHttp\Psr7\Request; class RequestFactory { public function getRequest( $method, $uri, array $headers = [], $body = null, $version = '1.1' ) { return new Request($method, $uri, $headers, $body, $version); } protected function parseOptions(array $options) { $defaults = [ 'headers' => [], 'body' => null, 'version' => '1.1', ]; return array_merge($defaults, $options); } public function getRequestWithOptions($method, $uri, array $options = []) { $options = $this->parseOptions($options); return $this->getRequest( $method, $uri, $options['headers'], $options['body'], $options['version'] ); } } 