diff --git a/src/API/Kitsu/KitsuTrait.php b/src/API/Kitsu/KitsuTrait.php index 065b2ab7..24a7a41b 100644 --- a/src/API/Kitsu/KitsuTrait.php +++ b/src/API/Kitsu/KitsuTrait.php @@ -65,7 +65,7 @@ trait KitsuTrait { ->get('session') ->getSegment(SESSION_SEGMENT); - if ($sessionSegment->get('auth_token') !== null && $url !== K::AUTH_URL) + if ($sessionSegment->get('auth_token') !== NULL && $url !== K::AUTH_URL) { $token = $sessionSegment->get('auth_token'); $request = $request->setAuth('bearer', $token); @@ -104,14 +104,6 @@ trait KitsuTrait { $response = wait((new Client)->request($request)); - /* $logger->debug('Kitsu api response', [ - 'status' => $response->getStatus(), - 'reason' => $response->getReason(), - 'body' => $response->getBody(), - 'headers' => $response->getAllHeaders(), - 'requestHeaders' => $request->getAllHeaders(), - ]); */ - return $response; } @@ -125,7 +117,7 @@ trait KitsuTrait { */ private function request(string $type, string $url, array $options = []): array { - $logger = null; + $logger = NULL; if ($this->getContainer()) { $logger = $this->container->getLogger('kitsu-request'); @@ -133,7 +125,7 @@ trait KitsuTrait { $response = $this->getResponse($type, $url, $options); - if ((int) $response->getStatus() > 299 || (int) $response->getStatus() < 200) + if ((int) $response->getStatus() > 299 OR (int) $response->getStatus() < 200) { if ($logger) { @@ -147,7 +139,7 @@ trait KitsuTrait { /** * Remove some boilerplate for get requests * - * @param array $args + * @param mixed ...$args * @return array */ protected function getRequest(...$args): array @@ -158,7 +150,7 @@ trait KitsuTrait { /** * Remove some boilerplate for patch requests * - * @param array $args + * @param mixed ...$args * @return array */ protected function patchRequest(...$args): array @@ -169,12 +161,12 @@ trait KitsuTrait { /** * Remove some boilerplate for post requests * - * @param array $args + * @param mixed ...$args * @return array */ protected function postRequest(...$args): array { - $logger = null; + $logger = NULL; if ($this->getContainer()) { $logger = $this->container->getLogger('kitsu-request'); @@ -197,7 +189,7 @@ trait KitsuTrait { /** * Remove some boilerplate for delete requests * - * @param array $args + * @param mixed ...$args * @return bool */ protected function deleteRequest(...$args): bool diff --git a/src/API/Kitsu/ListItem.php b/src/API/Kitsu/ListItem.php index 6af8284f..134feac9 100644 --- a/src/API/Kitsu/ListItem.php +++ b/src/API/Kitsu/ListItem.php @@ -37,7 +37,7 @@ class ListItem extends AbstractListItem { ->get('session') ->getSegment(SESSION_SEGMENT); - if ($sessionSegment->get('auth_token') !== null) + if ( ! is_null($sessionSegment->get('auth_token'))) { $token = $sessionSegment->get('auth_token'); return "bearer {$token}"; diff --git a/src/API/Kitsu/Model.php b/src/API/Kitsu/Model.php index b276477d..8c1a98f1 100644 --- a/src/API/Kitsu/Model.php +++ b/src/API/Kitsu/Model.php @@ -68,7 +68,9 @@ class Model { /** - * Constructor. + * Constructor + * + * @param ListItem $listItem */ public function __construct(ListItem $listItem) { @@ -136,7 +138,7 @@ class Model { return $data; } - return false; + return FALSE; } /** @@ -189,7 +191,7 @@ class Model { } } - return null; + return NULL; } /** @@ -233,6 +235,8 @@ class Model { /** * Get and transform the entirety of the user's anime list * + * @param int $limit + * @param int $offset * @return Request */ public function getFullAnimeList(int $limit = 100, int $offset = 0): Request diff --git a/src/API/Kitsu/Transformer/AnimeListTransformer.php b/src/API/Kitsu/Transformer/AnimeListTransformer.php index 2bb0a261..4b5e2dae 100644 --- a/src/API/Kitsu/Transformer/AnimeListTransformer.php +++ b/src/API/Kitsu/Transformer/AnimeListTransformer.php @@ -33,7 +33,6 @@ class AnimeListTransformer extends AbstractTransformer { */ public function transform($item) { -/* ?>
= json_encode($item, \JSON_PRETTY_PRINT) ?>(bool) $item['attributes']['reconsuming'], 'rewatched' => (int) $item['attributes']['reconsumeCount'], 'user_rating' => ($rating === 0) ? '-' : (int) $rating, - 'private' => (bool) $item['attributes']['private'] ?? false, + 'private' => (bool) $item['attributes']['private'] ?? FALSE, ]; } @@ -113,7 +112,7 @@ class AnimeListTransformer extends AbstractTransformer { $untransformed = [ 'id' => $item['id'], - 'mal_id' => $item['mal_id'] ?? null, + 'mal_id' => $item['mal_id'] ?? NULL, 'data' => [ 'status' => $item['watching_status'], 'reconsuming' => $rewatching, diff --git a/src/API/Kitsu/Transformer/MangaListTransformer.php b/src/API/Kitsu/Transformer/MangaListTransformer.php index bdf67040..b0f74ce3 100644 --- a/src/API/Kitsu/Transformer/MangaListTransformer.php +++ b/src/API/Kitsu/Transformer/MangaListTransformer.php @@ -35,7 +35,6 @@ class MangaListTransformer extends AbstractTransformer { */ public function transform($item) { -/*?>
= print_r($item, TRUE) ?>