@@ -100,9 +100,9 @@ |
||
100 | 100 | /** |
101 | 101 | * Cache the api response data if cache set to true in config file. |
102 | 102 | * |
103 | - * @param string $urlSuffix API URL method |
|
104 | 103 | * @param array $options Options |
105 | 104 | * @param string $method method name |
105 | + * @param string $apiEndPoint |
|
106 | 106 | * @return Collection / GuzzleHttp\Exception\ClientException |
107 | 107 | */ |
108 | 108 | public function cache($apiEndPoint, array $options, $method) |
@@ -3,9 +3,6 @@ |
||
3 | 3 | namespace Xklusive\BattlenetApi; |
4 | 4 | |
5 | 5 | use GuzzleHttp\Client; |
6 | -use GuzzleHttp\Psr7\Response; |
|
7 | - |
|
8 | -use Psr\Http\Message\ResponseInterface; |
|
9 | 6 | use Illuminate\Contracts\Cache\Repository; |
10 | 7 | |
11 | 8 | /** |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $statusCode = $e->getResponse()->getStatusCode(); |
83 | 83 | $reasonPhrase = $e->getResponse()->getReasonPhrase(); |
84 | 84 | |
85 | - if ( array_key_exists($statusCode, $statusCodes) ) { |
|
86 | - if ( $statusCodes[$statusCode]['message'] == $reasonPhrase) { |
|
85 | + if (array_key_exists($statusCode, $statusCodes)) { |
|
86 | + if ($statusCodes[$statusCode]['message'] == $reasonPhrase) { |
|
87 | 87 | $maxAttempts = $statusCodes[$statusCode]['retry']; |
88 | 88 | $attempts++; |
89 | 89 | continue; |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | $this->apiEndPoint = $this->gameParam.$apiEndPoint; |
112 | 112 | |
113 | 113 | $this->options['cache']['method'] = snake_case($method); |
114 | - $uniqCacheKey = implode('.',[$this->cacheKey,implode('.',$this->options['cache'])]); |
|
114 | + $uniqCacheKey = implode('.', [$this->cacheKey, implode('.', $this->options['cache'])]); |
|
115 | 115 | |
116 | 116 | if (true === $this->hasToCache()) { |
117 | 117 | return $this->cache->remember( |
118 | 118 | $uniqCacheKey, |
119 | 119 | $this->getCacheDuration(), |
120 | - function () { |
|
120 | + function() { |
|
121 | 121 | return $this->api(); |
122 | 122 | } |
123 | 123 | ); |
@@ -541,7 +541,7 @@ |
||
541 | 541 | * |
542 | 542 | * @param array $options Options |
543 | 543 | * |
544 | - * @return Illuminate\Support\Collection api response |
|
544 | + * @return null|\Xklusive\BattlenetApi\Collection api response |
|
545 | 545 | */ |
546 | 546 | public function getProfileCharacters(array $options = []) |
547 | 547 | { |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function getGuildMembers($realm, $guildName, array $options = []) |
170 | 170 | { |
171 | - if ( array_key_exists('fields', $options) && strpos($options['fields'], 'members') === false ) { |
|
172 | - $options['fields'] = implode(',',[$options['fields'],'members']); |
|
171 | + if (array_key_exists('fields', $options) && strpos($options['fields'], 'members') === false) { |
|
172 | + $options['fields'] = implode(',', [$options['fields'], 'members']); |
|
173 | 173 | } else { |
174 | 174 | $options['fields'] = 'members'; |
175 | 175 | } |
@@ -545,15 +545,15 @@ discard block |
||
545 | 545 | */ |
546 | 546 | public function getProfileCharacters(array $options = []) |
547 | 547 | { |
548 | - $access_token = array_key_exists('access_token', $options) |
|
548 | + $access_token = array_key_exists('access_token', $options) |
|
549 | 549 | ? $options['access_token'] |
550 | 550 | : auth()->user()->bnet_token; |
551 | 551 | |
552 | - $access_scope = array_key_exists('access_scope', $options) |
|
552 | + $access_scope = array_key_exists('access_scope', $options) |
|
553 | 553 | ? $options['access_scope'] |
554 | 554 | : auth()->user()->bnet_scope; |
555 | 555 | |
556 | - $user_id = array_key_exists('user_id', $options) |
|
556 | + $user_id = array_key_exists('user_id', $options) |
|
557 | 557 | ? $options['user_id'] |
558 | 558 | : auth()->user()->id; |
559 | 559 |