Skip to content

Commit

Permalink
Moves logic from Connector about to isolate request
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonius committed Nov 24, 2017
1 parent db22336 commit f39377c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/CloudApi/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public function __construct($config)
*/
public function request(string $verb, string $path, array $query = [], array $options = array())
{
$options['query'] = $query;

if (!empty($options['query']['filter']) && is_array($options['query']['filter'])) {
// Default to an AND filter.
$options['query']['filter'] = implode(',', $options['query']['filter']);
}
$response = $this->makeRequest($verb, $path, $query, $options);

return $this->processResponse($response);
Expand All @@ -66,13 +72,6 @@ public function request(string $verb, string $path, array $query = [], array $op
*/
public function makeRequest(string $verb, string $path, array $query = [], array $options = array())
{
$options['query'] = $query;

if (!empty($options['query']['filter']) && is_array($options['query']['filter'])) {
// Default to an AND filter.
$options['query']['filter'] = implode(',', $options['query']['filter']);
}

try {
$response = $this->client->$verb(self::BASE_URI . $path, $options);
} catch (ClientException $e) {
Expand Down

0 comments on commit f39377c

Please sign in to comment.