@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * Set the request body |
| 85 | 85 | * |
| 86 | - * @param FormBody|string $body |
|
| 86 | + * @param string $body |
|
| 87 | 87 | * @return self |
| 88 | 88 | */ |
| 89 | 89 | public function setBody($body): self |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * This is a dirty hack until I can fully track down where |
| 195 | 195 | * the dual-encoding happens |
| 196 | 196 | * |
| 197 | - * @param FormBody $formBody The form builder object to fix |
|
| 197 | + * @param \Amp\Artax\FormBody $formBody The form builder object to fix |
|
| 198 | 198 | * @return string |
| 199 | 199 | */ |
| 200 | 200 | private function fixBody(FormBody $formBody): string |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * This is a dirty hack until I can fully track down where |
| 71 | 71 | * the dual-encoding happens |
| 72 | 72 | * |
| 73 | - * @param FormBody $formBody The form builder object to fix |
|
| 73 | + * @param \Amp\Artax\FormBody $formBody The form builder object to fix |
|
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | 76 | private function fixBody(FormBody $formBody): string |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param string $type |
| 86 | 86 | * @param string $url |
| 87 | 87 | * @param array $options |
| 88 | - * @return \Amp\Promise |
|
| 88 | + * @return \Amp\Artax\Request |
|
| 89 | 89 | */ |
| 90 | 90 | public function setUpRequest(string $type, string $url, array $options = []) |
| 91 | 91 | { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | /** |
| 198 | 198 | * Remove some boilerplate for get requests |
| 199 | 199 | * |
| 200 | - * @param array $args |
|
| 200 | + * @param string $args |
|
| 201 | 201 | * @return array |
| 202 | 202 | */ |
| 203 | 203 | protected function getRequest(...$args): array |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | $config = $this->container->get('config'); |
| 103 | 103 | $logger = $this->container->getLogger('mal-request'); |
| 104 | 104 | |
| 105 | - $headers = array_merge($this->defaultHeaders, $options['headers'] ?? [], [ |
|
| 105 | + $headers = array_merge($this->defaultHeaders, $options['headers'] ?? [], [ |
|
| 106 | 106 | 'Authorization' => 'Basic ' . |
| 107 | - base64_encode($config->get(['mal','username']) . ':' .$config->get(['mal','password'])) |
|
| 107 | + base64_encode($config->get(['mal', 'username']) . ':' . $config->get(['mal', 'password'])) |
|
| 108 | 108 | ]); |
| 109 | 109 | |
| 110 | 110 | $query = $options['query'] ?? []; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $response = $this->getResponse($type, $url, $options); |
| 185 | 185 | |
| 186 | - if ((int) $response->getStatus() > 299 || (int) $response->getStatus() < 200) |
|
| 186 | + if ((int)$response->getStatus() > 299 || (int)$response->getStatus() < 200) |
|
| 187 | 187 | { |
| 188 | 188 | if ($logger) |
| 189 | 189 | { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - return XML::toArray((string) $response->getBody()); |
|
| 194 | + return XML::toArray((string)$response->getBody()); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $response = $this->getResponse('POST', ...$args); |
| 223 | 223 | $validResponseCodes = [200, 201]; |
| 224 | 224 | |
| 225 | - if ( ! in_array((int) $response->getStatus(), $validResponseCodes)) |
|
| 225 | + if ( ! in_array((int)$response->getStatus(), $validResponseCodes)) |
|
| 226 | 226 | { |
| 227 | 227 | if ($logger) |
| 228 | 228 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | private function getResponse(string $type, string $url, array $options = []) |
| 144 | 144 | { |
| 145 | - $logger = null; |
|
| 145 | + $logger = NULL; |
|
| 146 | 146 | if ($this->getContainer()) |
| 147 | 147 | { |
| 148 | 148 | $logger = $this->container->getLogger('mal-request'); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | private function request(string $type, string $url, array $options = []): array |
| 177 | 177 | { |
| 178 | - $logger = null; |
|
| 178 | + $logger = NULL; |
|
| 179 | 179 | if ($this->getContainer()) |
| 180 | 180 | { |
| 181 | 181 | $logger = $this->container->getLogger('mal-request'); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | protected function postRequest(...$args): array |
| 215 | 215 | { |
| 216 | - $logger = null; |
|
| 216 | + $logger = NULL; |
|
| 217 | 217 | if ($this->getContainer()) |
| 218 | 218 | { |
| 219 | 219 | $logger = $this->container->getLogger('mal-request'); |
@@ -35,16 +35,16 @@ |
||
| 35 | 35 | protected $requestBuilder; |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * The Guzzle http client object |
|
| 39 | - * @var object |
|
| 40 | - */ |
|
| 41 | - protected $client; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Cookie jar object for api requests |
|
| 45 | - * @var object |
|
| 46 | - */ |
|
| 47 | - protected $cookieJar; |
|
| 38 | + * The Guzzle http client object |
|
| 39 | + * @var object |
|
| 40 | + */ |
|
| 41 | + protected $client; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Cookie jar object for api requests |
|
| 45 | + * @var object |
|
| 46 | + */ |
|
| 47 | + protected $cookieJar; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * The base url for api requests |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | private function getResponse(string $type, string $url, array $options = []) |
| 112 | 112 | { |
| 113 | - $logger = null; |
|
| 113 | + $logger = NULL; |
|
| 114 | 114 | $validTypes = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']; |
| 115 | 115 | |
| 116 | 116 | if ( ! in_array($type, $validTypes)) |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | ->get('session') |
| 128 | 128 | ->getSegment(AnimeClient::SESSION_SEGMENT); |
| 129 | 129 | |
| 130 | - if ($sessionSegment->get('auth_token') !== null && $url !== K::AUTH_URL) |
|
| 130 | + if ($sessionSegment->get('auth_token') !== NULL && $url !== K::AUTH_URL) |
|
| 131 | 131 | { |
| 132 | 132 | $token = $sessionSegment->get('auth_token'); |
| 133 | 133 | $defaultOptions['headers']['Authorization'] = "bearer {$token}"; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function request(string $type, string $url, array $options = []): array |
| 162 | 162 | { |
| 163 | - $logger = null; |
|
| 163 | + $logger = NULL; |
|
| 164 | 164 | if ($this->getContainer()) |
| 165 | 165 | { |
| 166 | 166 | $logger = $this->container->getLogger('kitsu-request'); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | protected function postRequest(...$args): array |
| 211 | 211 | { |
| 212 | - $logger = null; |
|
| 212 | + $logger = NULL; |
|
| 213 | 213 | if ($this->getContainer()) |
| 214 | 214 | { |
| 215 | 215 | $logger = $this->container->getLogger('kitsu-request'); |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | use Aviat\AnimeClient\API\Kitsu as K; |
| 21 | 21 | use Aviat\Ion\Json; |
| 22 | 22 | |
| 23 | -class KitsuRequestBuilder extends APIRequestBuilder { |
|
| 23 | +class KitsuRequestBuilder extends APIRequestBuilder { |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * The base url for api requests |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |