@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * This is a dirty hack until I can fully track down where |
| 51 | 51 | * the dual-encoding happens |
| 52 | 52 | * |
| 53 | - * @param FormBody $formBody The form builder object to fix |
|
| 53 | + * @param \Amp\Artax\FormBody $formBody The form builder object to fix |
|
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | 56 | private function fixBody(FormBody $formBody): string |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | /** |
| 158 | 158 | * Remove some boilerplate for get requests |
| 159 | 159 | * |
| 160 | - * @param array $args |
|
| 160 | + * @param string $args |
|
| 161 | 161 | * @return array |
| 162 | 162 | */ |
| 163 | 163 | 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 | * |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $request = $this->requestBuilder |
| 95 | 95 | ->newRequest($type, $url) |
| 96 | - ->setBasicAuth($config->get(['mal','username']), $config->get(['mal','password'])); |
|
| 96 | + ->setBasicAuth($config->get(['mal', 'username']), $config->get(['mal', 'password'])); |
|
| 97 | 97 | |
| 98 | 98 | if (array_key_exists('query', $options)) |
| 99 | 99 | { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $response = $this->getResponse($type, $url, $options); |
| 158 | 158 | |
| 159 | - if ((int) $response->getStatus() > 299 || (int) $response->getStatus() < 200) |
|
| 159 | + if ((int)$response->getStatus() > 299 || (int)$response->getStatus() < 200) |
|
| 160 | 160 | { |
| 161 | 161 | if ($logger) |
| 162 | 162 | { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - return XML::toArray((string) $response->getBody()); |
|
| 167 | + return XML::toArray((string)$response->getBody()); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $response = $this->getResponse('POST', ...$args); |
| 196 | 196 | $validResponseCodes = [200, 201]; |
| 197 | 197 | |
| 198 | - if ( ! in_array((int) $response->getStatus(), $validResponseCodes)) |
|
| 198 | + if ( ! in_array((int)$response->getStatus(), $validResponseCodes)) |
|
| 199 | 199 | { |
| 200 | 200 | if ($logger) |
| 201 | 201 | { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * Create a list item |
| 28 | 28 | * |
| 29 | 29 | * @param array $data - |
| 30 | - * @return bool |
|
| 30 | + * @return Request |
|
| 31 | 31 | */ |
| 32 | 32 | public function create(array $data): Request; |
| 33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @param string $id - The id of the list item to update |
| 46 | 46 | * @param array $data - The data with which to update the list item |
| 47 | - * @return Response |
|
| 47 | + * @return Request |
|
| 48 | 48 | */ |
| 49 | 49 | public function update(string $id, array $data): Request; |
| 50 | 50 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * Delete a list item |
| 53 | 53 | * |
| 54 | 54 | * @param string $id - The id of the list item to delete |
| 55 | - * @return bool |
|
| 55 | + * @return Request |
|
| 56 | 56 | */ |
| 57 | 57 | public function delete(string $id): Request; |
| 58 | 58 | } |
| 59 | 59 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Hummingbird Anime Client |
| 4 | 4 | * |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $params = []; |
| 283 | 283 | |
| 284 | - switch($failure->failedRule) { |
|
| 284 | + switch ($failure->failedRule) { |
|
| 285 | 285 | case 'Aura\Router\Rule\Allows': |
| 286 | 286 | $params = [ |
| 287 | 287 | 'http_code' => 405, |
@@ -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 | * |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $config = loadToml($CONF_DIR); |
| 74 | 74 | $config_array = array_merge($base_config, $config); |
| 75 | 75 | |
| 76 | - $di = function ($config_array) use ($APP_DIR) { |
|
| 76 | + $di = function($config_array) use ($APP_DIR) { |
|
| 77 | 77 | $container = new Container(); |
| 78 | 78 | |
| 79 | 79 | // ------------------------------------------------------------------------- |
@@ -194,7 +194,7 @@ |
||
| 194 | 194 | * @param string|null $malId |
| 195 | 195 | * @return bool |
| 196 | 196 | */ |
| 197 | - public function deleteLibraryItem(string $id, string $malId = null): bool |
|
| 197 | + public function deleteLibraryItem(string $id, string $malId = NULL): bool |
|
| 198 | 198 | { |
| 199 | 199 | $requests = []; |
| 200 | 200 | |
@@ -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 | * |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $response = $this->getResponse($type, $url, $options); |
| 136 | 136 | |
| 137 | - if ((int) $response->getStatus() > 299 || (int) $response->getStatus() < 200) |
|
| 137 | + if ((int)$response->getStatus() > 299 || (int)$response->getStatus() < 200) |
|
| 138 | 138 | { |
| 139 | 139 | if ($logger) |
| 140 | 140 | { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $response = $this->getResponse('POST', ...$args); |
| 185 | 185 | $validResponseCodes = [200, 201]; |
| 186 | 186 | |
| 187 | - if ( ! in_array((int) $response->getStatus(), $validResponseCodes)) |
|
| 187 | + if ( ! in_array((int)$response->getStatus(), $validResponseCodes)) |
|
| 188 | 188 | { |
| 189 | 189 | if ($logger) |
| 190 | 190 | { |
@@ -204,6 +204,6 @@ discard block |
||
| 204 | 204 | protected function deleteRequest(...$args): bool |
| 205 | 205 | { |
| 206 | 206 | $response = $this->getResponse('DELETE', ...$args); |
| 207 | - return ((int) $response->getStatus() === 204); |
|
| 207 | + return ((int)$response->getStatus() === 204); |
|
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | \ No newline at end of file |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ->get('session') |
| 66 | 66 | ->getSegment(SESSION_SEGMENT); |
| 67 | 67 | |
| 68 | - if ($sessionSegment->get('auth_token') !== null && $url !== K::AUTH_URL) |
|
| 68 | + if ($sessionSegment->get('auth_token') !== NULL && $url !== K::AUTH_URL) |
|
| 69 | 69 | { |
| 70 | 70 | $token = $sessionSegment->get('auth_token'); |
| 71 | 71 | $request = $request->setAuth('bearer', $token); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | private function request(string $type, string $url, array $options = []): array |
| 128 | 128 | { |
| 129 | - $logger = null; |
|
| 129 | + $logger = NULL; |
|
| 130 | 130 | if ($this->getContainer()) |
| 131 | 131 | { |
| 132 | 132 | $logger = $this->container->getLogger('kitsu-request'); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | protected function postRequest(...$args): array |
| 177 | 177 | { |
| 178 | - $logger = null; |
|
| 178 | + $logger = NULL; |
|
| 179 | 179 | if ($this->getContainer()) |
| 180 | 180 | { |
| 181 | 181 | $logger = $this->container->getLogger('kitsu-request'); |
@@ -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 | * |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | $genres = array_column($anime['relationships']['genres'], 'name') ?? []; |
| 42 | 42 | sort($genres); |
| 43 | 43 | |
| 44 | - $rating = (int) 2 * $item['attributes']['rating']; |
|
| 44 | + $rating = (int)2 * $item['attributes']['rating']; |
|
| 45 | 45 | |
| 46 | - $total_episodes = array_key_exists('episodeCount', $anime) && (int) $anime['episodeCount'] !== 0 |
|
| 47 | - ? (int) $anime['episodeCount'] |
|
| 46 | + $total_episodes = array_key_exists('episodeCount', $anime) && (int)$anime['episodeCount'] !== 0 |
|
| 47 | + ? (int)$anime['episodeCount'] |
|
| 48 | 48 | : '-'; |
| 49 | 49 | |
| 50 | 50 | $MALid = NULL; |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | 'id' => $item['id'], |
| 70 | 70 | 'mal_id' => $MALid, |
| 71 | 71 | 'episodes' => [ |
| 72 | - 'watched' => (int) $item['attributes']['progress'] !== '0' |
|
| 73 | - ? (int) $item['attributes']['progress'] |
|
| 72 | + 'watched' => (int)$item['attributes']['progress'] !== '0' |
|
| 73 | + ? (int)$item['attributes']['progress'] |
|
| 74 | 74 | : '-', |
| 75 | 75 | 'total' => $total_episodes, |
| 76 | 76 | 'length' => $anime['episodeLength'], |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | ], |
| 93 | 93 | 'watching_status' => $item['attributes']['status'], |
| 94 | 94 | 'notes' => $item['attributes']['notes'], |
| 95 | - 'rewatching' => (bool) $item['attributes']['reconsuming'], |
|
| 96 | - 'rewatched' => (int) $item['attributes']['reconsumeCount'], |
|
| 97 | - 'user_rating' => ($rating === 0) ? '-' : (int) $rating, |
|
| 98 | - 'private' => (bool) $item['attributes']['private'] ?? false, |
|
| 95 | + 'rewatching' => (bool)$item['attributes']['reconsuming'], |
|
| 96 | + 'rewatched' => (int)$item['attributes']['reconsumeCount'], |
|
| 97 | + 'user_rating' => ($rating === 0) ? '-' : (int)$rating, |
|
| 98 | + 'private' => (bool)$item['attributes']['private'] ?? false, |
|
| 99 | 99 | ]; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'rewatching' => (bool) $item['attributes']['reconsuming'], |
| 96 | 96 | 'rewatched' => (int) $item['attributes']['reconsumeCount'], |
| 97 | 97 | 'user_rating' => ($rating === 0) ? '-' : (int) $rating, |
| 98 | - 'private' => (bool) $item['attributes']['private'] ?? false, |
|
| 98 | + 'private' => (bool) $item['attributes']['private'] ?? FALSE, |
|
| 99 | 99 | ]; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $untransformed = [ |
| 115 | 115 | 'id' => $item['id'], |
| 116 | - 'mal_id' => $item['mal_id'] ?? null, |
|
| 116 | + 'mal_id' => $item['mal_id'] ?? NULL, |
|
| 117 | 117 | 'data' => [ |
| 118 | 118 | 'status' => $item['watching_status'], |
| 119 | 119 | 'reconsuming' => $rewatching, |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | ->get('session') |
| 38 | 38 | ->getSegment(SESSION_SEGMENT); |
| 39 | 39 | |
| 40 | - if ($sessionSegment->get('auth_token') !== null) |
|
| 40 | + if ($sessionSegment->get('auth_token') !== NULL) |
|
| 41 | 41 | { |
| 42 | 42 | $token = $sessionSegment->get('auth_token'); |
| 43 | 43 | return "bearer {$token}"; |
@@ -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 | * |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $data = $this->getRequest("anime/{$kitsuAnimeId}", $options); |
| 182 | 182 | $mappings = array_column($data['included'], 'attributes'); |
| 183 | 183 | |
| 184 | - foreach($mappings as $map) |
|
| 184 | + foreach ($mappings as $map) |
|
| 185 | 185 | { |
| 186 | 186 | if ($map['externalSite'] === 'myanimelist/anime') |
| 187 | 187 | { |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $included = JsonAPI::organizeIncludes($data['included']); |
| 262 | 262 | $included = JsonAPI::inlineIncludedRelationships($included, 'anime'); |
| 263 | 263 | |
| 264 | - foreach($data['data'] as $i => &$item) |
|
| 264 | + foreach ($data['data'] as $i => &$item) |
|
| 265 | 265 | { |
| 266 | 266 | $item['included'] = $included; |
| 267 | 267 | } |