From 956a3c4144f524f38951001341e53972734170c1 Mon Sep 17 00:00:00 2001 From: Constantine Nathanson Date: Sun, 19 Nov 2023 20:20:35 +0200 Subject: [PATCH] Remove redundant `teapot/status-code` dependency Fixes #391 --- composer.json | 1 - src/Api/BaseApiClient.php | 4 +- src/Api/Utils/HttpStatusCode.php | 104 ++++++++++++++++++++++ tests/Integration/IntegrationTestCase.php | 2 +- 4 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 src/Api/Utils/HttpStatusCode.php diff --git a/composer.json b/composer.json index 9d91f734..e2cc5254 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,6 @@ "guzzlehttp/guzzle": "^6.5.8|^7.4.5", "guzzlehttp/promises": "^1.5.3|^2.0", "guzzlehttp/psr7": "^1.9.1|^2.5", - "teapot/status-code": "^1|^2", "ext-json": "*", "monolog/monolog": "^1|^2|^3", "psr/log" : "^1|^2|^3" diff --git a/src/Api/BaseApiClient.php b/src/Api/BaseApiClient.php index 6e83f2eb..22bffdcf 100644 --- a/src/Api/BaseApiClient.php +++ b/src/Api/BaseApiClient.php @@ -33,8 +33,6 @@ use InvalidArgumentException; use JsonSerializable; use Psr\Http\Message\ResponseInterface; -use Teapot\StatusCode\Http as HttpStatusCode; -use Teapot\StatusCode\Vendor\Twitter as TwitterStatusCode; /** * Class BaseApiClient @@ -60,7 +58,7 @@ class BaseApiClient HttpStatusCode::FORBIDDEN => NotAllowed::class, HttpStatusCode::NOT_FOUND => NotFound::class, HttpStatusCode::CONFLICT => AlreadyExists::class, - TwitterStatusCode::ENHANCE_YOUR_CALM => RateLimited::class, // RFC6585::TOO_MANY_REQUESTS + HttpStatusCode::ENHANCE_YOUR_CALM => RateLimited::class, // RFC6585::TOO_MANY_REQUESTS HttpStatusCode::INTERNAL_SERVER_ERROR => GeneralError::class, ]; diff --git a/src/Api/Utils/HttpStatusCode.php b/src/Api/Utils/HttpStatusCode.php new file mode 100644 index 00000000..ba37ad84 --- /dev/null +++ b/src/Api/Utils/HttpStatusCode.php @@ -0,0 +1,104 @@ +