Skip to content

Commit 8288d2e

Browse files
committed
Merge pull request #14 from LogansUA/feature-refactoring
Refactoring
2 parents adb65fd + 32d21cb commit 8288d2e

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/Service/Service.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@ class Service
1818
*/
1919
protected $blizzardClient;
2020

21-
/**
22-
* @var array $defaultOption Array of default options
23-
*/
24-
protected $defaultOption = [];
25-
2621
/**
2722
* @var string $serviceParam Service parameter
2823
*/
2924
protected $serviceParam;
3025

3126
/**
32-
* WorldOfWarcraft constructor
27+
* Service constructor
3328
*
3429
* @param BlizzardClient $blizzardClient Configured blizzard client
3530
*/
@@ -50,11 +45,13 @@ public function __construct(BlizzardClient $blizzardClient)
5045
*/
5146
protected function request($urlSuffix, array $options)
5247
{
53-
$options = $this->generateQueryOptions($options);
48+
$client = new Client([
49+
'base_uri' => $this->blizzardClient->getApiUrl(),
50+
]);
5451

55-
$requestUrl = $this->blizzardClient->getApiUrl().$this->serviceParam.$urlSuffix;
52+
$options = $this->generateQueryOptions($options);
5653

57-
$result = (new Client())->get($requestUrl, $options);
54+
$result = $client->get($this->serviceParam.$urlSuffix, $options);
5855

5956
return $result;
6057
}
@@ -89,11 +86,9 @@ private function generateQueryOptions(array $options = [])
8986
*/
9087
private function getDefaultOptions()
9188
{
92-
$defaultOption = [
89+
return [
9390
'locale' => $this->blizzardClient->getLocale(),
9491
'apiKey' => $this->blizzardClient->getApiKey(),
9592
];
96-
97-
return $defaultOption;
9893
}
9994
}

0 commit comments

Comments
 (0)