From 185416f09d1b5cba61351b26a7221a9955d6853a Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Mon, 20 Mar 2017 19:08:33 -0400 Subject: [PATCH] Miscellaneous code cleanup --- app/views/anime/details.php | 2 +- app/views/me.php | 4 ++-- src/API/APIRequestBuilder.php | 7 +------ src/API/JsonAPI.php | 2 -- src/API/Kitsu.php | 4 ---- src/API/Kitsu/KitsuRequestBuilder.php | 1 - src/API/Kitsu/KitsuTrait.php | 9 ++------- 7 files changed, 6 insertions(+), 23 deletions(-) diff --git a/app/views/anime/details.php b/app/views/anime/details.php index c9390200..63232096 100644 --- a/app/views/anime/details.php +++ b/app/views/anime/details.php @@ -84,7 +84,7 @@

Characters

- +
generate('character', ['slug' => $char['slug']]) ?> a($link, $char['name']); ?> diff --git a/app/views/me.php b/app/views/me.php index fbe4d8a8..47434cc1 100644 --- a/app/views/me.php +++ b/app/views/me.php @@ -35,9 +35,9 @@
About:
html($attributes['bio']) ?>
-
+
-
+
*/ ?>
\ No newline at end of file diff --git a/src/API/APIRequestBuilder.php b/src/API/APIRequestBuilder.php index def21ea4..7b85405f 100644 --- a/src/API/APIRequestBuilder.php +++ b/src/API/APIRequestBuilder.php @@ -17,12 +17,7 @@ namespace Aviat\AnimeClient\API; use Amp; -use Amp\Artax\{ - Client, - FormBody, - Request -}; -use Aviat\Ion\Di\ContainerAware; +use Amp\Artax\{FormBody, Request}; use Aviat\Ion\Json; use InvalidArgumentException; use Psr\Log\LoggerAwareTrait; diff --git a/src/API/JsonAPI.php b/src/API/JsonAPI.php index 2776c4ec..7ca78704 100644 --- a/src/API/JsonAPI.php +++ b/src/API/JsonAPI.php @@ -16,8 +16,6 @@ namespace Aviat\AnimeClient\API; -use Aviat\Ion\Json; - /** * Class encapsulating Json API data structure for a request or response */ diff --git a/src/API/Kitsu.php b/src/API/Kitsu.php index dd7d2622..cc9ea7ca 100644 --- a/src/API/Kitsu.php +++ b/src/API/Kitsu.php @@ -19,10 +19,6 @@ namespace Aviat\AnimeClient\API; use Aviat\AnimeClient\API\Kitsu\Enum\AnimeAiringStatus; use DateTimeImmutable; -const AUTH_URL = 'https://kitsu.io/api/oauth/token'; -const AUTH_USER_ID_KEY = 'kitsu-auth-userid'; -const AUTH_TOKEN_CACHE_KEY = 'kitsu-auth-token'; - /** * Data massaging helpers for the Kitsu API */ diff --git a/src/API/Kitsu/KitsuRequestBuilder.php b/src/API/Kitsu/KitsuRequestBuilder.php index 5f82ebee..a7a0f585 100644 --- a/src/API/Kitsu/KitsuRequestBuilder.php +++ b/src/API/Kitsu/KitsuRequestBuilder.php @@ -20,7 +20,6 @@ use Aviat\AnimeClient\API\{ APIRequestBuilder, Kitsu as K }; -use Aviat\Ion\Json; class KitsuRequestBuilder extends APIRequestBuilder { diff --git a/src/API/Kitsu/KitsuTrait.php b/src/API/Kitsu/KitsuTrait.php index f7842351..75233ee6 100644 --- a/src/API/Kitsu/KitsuTrait.php +++ b/src/API/Kitsu/KitsuTrait.php @@ -24,14 +24,12 @@ use Amp\Artax\{Client, Request}; use Aviat\AnimeClient\AnimeClient; use Aviat\AnimeClient\API\Kitsu as K; use Aviat\Ion\Json; -use InvalidArgumentException; -use RuntimeException; trait KitsuTrait { /** * The request builder for the MAL API - * @var MALRequestBuilder + * @var KitsuRequestBuilder */ protected $requestBuilder; @@ -57,8 +55,6 @@ trait KitsuTrait { */ public function setUpRequest(string $type, string $url, array $options = []): Request { - $config = $this->container->get('config'); - $request = $this->requestBuilder->newRequest($type, $url); $sessionSegment = $this->getContainer() @@ -100,7 +96,6 @@ trait KitsuTrait { private function getResponse(string $type, string $url, array $options = []) { $request = $this->setUpRequest($type, $url, $options); - $logger = $this->container->getLogger('kitsu-request'); $response = wait((new Client)->request($request)); @@ -133,7 +128,7 @@ trait KitsuTrait { } } - return JSON::decode($response->getBody(), TRUE); + return Json::decode($response->getBody(), TRUE); } /**