fix: return type and typing on send

This commit is contained in:
Nicholas Ciechanowski 2023-10-28 22:47:32 +11:00
parent f4f7373272
commit dcf8c28f1a

View File

@ -3,22 +3,24 @@
namespace App\Helpers; namespace App\Helpers;
use App\Models\Quote; use App\Models\Quote;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
class Slack class Slack
{ {
private string $url; private string $url;
public function __construct() { public function __construct()
{
$this->url = config('bot.webhook'); $this->url = config('bot.webhook');
} }
private function send($text): \GuzzleHttp\Promise\PromiseInterface|\Illuminate\Http\Client\Response private function send(string $text): Response
{ {
return Http::post($this->url, ['text' => $text]); return Http::post($this->url, ['text' => $text]);
} }
public function sendText(string $text): \GuzzleHttp\Promise\PromiseInterface|\Illuminate\Http\Client\Response public function sendText(string $text): Response
{ {
activity() activity()
->event('send') ->event('send')
@ -27,7 +29,7 @@ class Slack
return $this->send($text); return $this->send($text);
} }
public function sendQuote(Quote $quote): \GuzzleHttp\Promise\PromiseInterface|\Illuminate\Http\Client\Response public function sendQuote(Quote $quote): Response
{ {
activity() activity()
->performedOn($quote) ->performedOn($quote)