diff --git a/src/Providers/DefaultProvider.php b/src/Providers/DefaultProvider.php index 7cedd65..b7caea4 100644 --- a/src/Providers/DefaultProvider.php +++ b/src/Providers/DefaultProvider.php @@ -2,7 +2,9 @@ namespace Moneo\RequestForwarder\Providers; +use GuzzleHttp\Promise\PromiseInterface; use Illuminate\Http\Client\Factory; +use Illuminate\Http\Client\Response; class DefaultProvider implements ProviderInterface { @@ -11,7 +13,10 @@ public function __construct( ) { } - public function send($url, $params, $webhook) + /** + * @throws \Exception + */ + public function send(string $url, array $params, array $webhook): Response { return $this->client ->send($webhook['method'] ?? 'POST', $webhook['url']); diff --git a/src/Providers/Discord.php b/src/Providers/Discord.php index 31be35f..869505a 100644 --- a/src/Providers/Discord.php +++ b/src/Providers/Discord.php @@ -3,6 +3,7 @@ namespace Moneo\RequestForwarder\Providers; use Illuminate\Http\Client\Factory; +use Illuminate\Http\Client\Response; class Discord implements ProviderInterface { @@ -11,7 +12,10 @@ public function __construct( ) { } - public function send($url, $params, $webhook) + /** + * @throws \Exception + */ + public function send(string $url, array $params, array $webhook): Response { $content = $url.PHP_EOL; $content .= json_encode($params); diff --git a/src/Providers/ProviderInterface.php b/src/Providers/ProviderInterface.php index 11242b3..f42e133 100644 --- a/src/Providers/ProviderInterface.php +++ b/src/Providers/ProviderInterface.php @@ -3,11 +3,11 @@ namespace Moneo\RequestForwarder\Providers; use Illuminate\Http\Client\Factory; +use Illuminate\Http\Client\Response; interface ProviderInterface { public function __construct(Factory $client); - /** @return \Illuminate\Http\Client\Response */ - public function send($url, $params, $webhook); + public function send(string $url, array $params, array $webhook): Response; } diff --git a/src/RequestForwarder.php b/src/RequestForwarder.php index 1c85b68..c2d1750 100755 --- a/src/RequestForwarder.php +++ b/src/RequestForwarder.php @@ -15,12 +15,12 @@ public function __construct( ) { } - public function sendAsync(Request $request) + public function sendAsync(Request $request): void { ProcessRequestForwarder::dispatch($request->url(), $request->toArray()); } - public function triggerHooks(string $url, array $params) + public function triggerHooks(string $url, array $params): void { foreach ($this->webhooks as $webhook) { try { diff --git a/src/RequestForwarderServiceProvider.php b/src/RequestForwarderServiceProvider.php index 84c78e9..e59db01 100644 --- a/src/RequestForwarderServiceProvider.php +++ b/src/RequestForwarderServiceProvider.php @@ -20,7 +20,7 @@ public function configurePackage(Package $package): void ->hasConfigFile(); } - public function registeringPackage() + public function registeringPackage(): void { $this->app->bind('laravel_request_forwarder.client', function ($app): Factory { return $app[Factory::class];