diff --git a/app/Notification/AppNotificationInterface.php b/app/Notification/AppNotificationInterface.php index 3d7acc9..ea4caef 100644 --- a/app/Notification/AppNotificationInterface.php +++ b/app/Notification/AppNotificationInterface.php @@ -5,11 +5,11 @@ use App\Notification\Client\HTTPClientAdapterInterface; -use App\Notification\Client\ResponseAdapterInterface; +use App\Notification\Client\HTTPResponseInterface; interface AppNotificationInterface { public function __construct(HTTPClientAdapterInterface $client, string $message, string $messageType); - public function notify(): ResponseAdapterInterface; + public function notify(): HTTPResponseInterface; } diff --git a/app/Notification/Client/Guzzle/GuzzleHTTPClient.php b/app/Notification/Client/Guzzle/GuzzleHTTPClient.php index 4be067c..41fee05 100644 --- a/app/Notification/Client/Guzzle/GuzzleHTTPClient.php +++ b/app/Notification/Client/Guzzle/GuzzleHTTPClient.php @@ -5,9 +5,8 @@ use App\Notification\Client\HTTPClientAdapterInterface; -use App\Notification\Client\ResponseAdapterInterface; +use App\Notification\Client\HTTPResponseInterface; use GuzzleHttp\Client; -use Psr\Http\Message\ResponseInterface; class GuzzleHTTPClient implements HTTPClientAdapterInterface { @@ -18,15 +17,15 @@ public function __construct() $this->client = new Client(); } - public function post(string $url, array $params): ResponseAdapterInterface + public function post(string $url, array $params): HTTPResponseInterface { - $clientResponse = $this->client->post( + $guzzleResponse = $this->client->post( $url, [ 'json' => $params ] ); - return new GuzzleResponse($clientResponse); + return new HTTPResponse($guzzleResponse); } } diff --git a/app/Notification/Client/Guzzle/GuzzleResponse.php b/app/Notification/Client/Guzzle/HTTPResponse.php similarity index 85% rename from app/Notification/Client/Guzzle/GuzzleResponse.php rename to app/Notification/Client/Guzzle/HTTPResponse.php index a641b21..2342b07 100644 --- a/app/Notification/Client/Guzzle/GuzzleResponse.php +++ b/app/Notification/Client/Guzzle/HTTPResponse.php @@ -4,10 +4,10 @@ namespace App\Notification\Client\Guzzle; -use App\Notification\Client\ResponseAdapterInterface; +use App\Notification\Client\HTTPResponseInterface; use Psr\Http\Message\ResponseInterface; -class GuzzleResponse implements ResponseAdapterInterface +class HTTPResponse implements HTTPResponseInterface { private ResponseInterface $clientResponse; diff --git a/app/Notification/Client/HTTPClientAdapterInterface.php b/app/Notification/Client/HTTPClientAdapterInterface.php index 25c7c16..a76c24f 100644 --- a/app/Notification/Client/HTTPClientAdapterInterface.php +++ b/app/Notification/Client/HTTPClientAdapterInterface.php @@ -6,5 +6,5 @@ interface HTTPClientAdapterInterface { - public function post(string $url, array $params): ResponseAdapterInterface; + public function post(string $url, array $params): HTTPResponseInterface; } diff --git a/app/Notification/Client/HTTPResponseInterface.php b/app/Notification/Client/HTTPResponseInterface.php new file mode 100644 index 0000000..6f32925 --- /dev/null +++ b/app/Notification/Client/HTTPResponseInterface.php @@ -0,0 +1,14 @@ +client = $client; } - public function notify(): ResponseAdapterInterface + public function notify(): HTTPResponseInterface { return $this->client->post( getenv('SLACK_API_WEBHOOK'),