diff --git a/lib/recurly/base_client.php b/lib/recurly/base_client.php index 39fa7f35..821ba130 100644 --- a/lib/recurly/base_client.php +++ b/lib/recurly/base_client.php @@ -31,7 +31,7 @@ abstract class BaseClient * In addition to the options managed by BaseClient, it accepts the following options: * - "region" to define the Data Center connection - defaults to "us"; */ - public function __construct(string $api_key, LoggerInterface $logger = null, array $options = []) + public function __construct(string $api_key, LoggerInterface $logger = null, array $options = [], HttpAdapterInterface $http_adapter = null) { $this->_api_key = $api_key; if (isset($options['region'])) { @@ -41,6 +41,11 @@ public function __construct(string $api_key, LoggerInterface $logger = null, arr $this->baseUrl = BaseClient::API_HOSTS[$options['region']]; } + if (is_null($http_adapter)) { + $http_adapter = new HttpAdapter; + } + $this->http = $http_adapter; + $this->http = new HttpAdapter; if (is_null($logger)) { $logger = new \Recurly\Logger('Recurly', LogLevel::WARNING); diff --git a/lib/recurly/http_adapter_interface.php b/lib/recurly/http_adapter_interface.php new file mode 100644 index 00000000..843e7a5b --- /dev/null +++ b/lib/recurly/http_adapter_interface.php @@ -0,0 +1,11 @@ +