From 647d1378bba3473e4396f3c41d120d488dddbd93 Mon Sep 17 00:00:00 2001 From: Maxime Renou Date: Tue, 12 May 2020 17:25:47 +0200 Subject: [PATCH] Fixes --- src/BluescaleMailApi.php | 2 +- src/BluescaleMailChannel.php | 13 ++++++++++--- src/BluescaleMailTemplate.php | 24 ++++++++++++------------ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/BluescaleMailApi.php b/src/BluescaleMailApi.php index dbe79a9..0c5c13c 100644 --- a/src/BluescaleMailApi.php +++ b/src/BluescaleMailApi.php @@ -24,7 +24,7 @@ class BluescaleMailApi * @param BluescaleMailTemplate $template * @param $notifiable * @return \Psr\Http\Message\StreamInterface - * @throws BMailException + * @throws BluescaleMailException */ public function send($template, $notifiable): StreamInterface { diff --git a/src/BluescaleMailChannel.php b/src/BluescaleMailChannel.php index 2d28cf2..df3bf8f 100644 --- a/src/BluescaleMailChannel.php +++ b/src/BluescaleMailChannel.php @@ -7,16 +7,23 @@ use Psr\Http\Message\StreamInterface; class BluescaleMailChannel { + protected $api; + + public function __construct(BluescaleMailApi $api) + { + $this->api = $api; + } + /** * @param $notifiable * @param Notification $notification * @return \Psr\Http\Message\StreamInterface - * @throws BMailException + * @throws BluescaleMailException */ - public function send($notifiable, Notification $notification, BluescaleMailApi $api): StreamInterface + public function send($notifiable, Notification $notification): StreamInterface { $template = $notification->toTemplate($notifiable); - return $api->send($template, $notifiable); + return $this->api->send($template, $notifiable); } } diff --git a/src/BluescaleMailTemplate.php b/src/BluescaleMailTemplate.php index 37a7e5e..ef09161 100644 --- a/src/BluescaleMailTemplate.php +++ b/src/BluescaleMailTemplate.php @@ -47,9 +47,9 @@ class BluescaleMailTemplate implements \JsonSerializable /** * @param string $address * @param string|null $name - * @return BMailTemplate + * @return BluescaleMailTemplate */ - public function sender(string $address, string $name = null): BMailTemplate + public function sender(string $address, string $name = null): BluescaleMailTemplate { $this->sender['address'] = $address; @@ -62,9 +62,9 @@ class BluescaleMailTemplate implements \JsonSerializable /** * @param string $address * @param string|null $name - * @return BMailTemplate + * @return BluescaleMailTemplate */ - public function replyTo(string $address, string $name = null): BMailTemplate + public function replyTo(string $address, string $name = null): BluescaleMailTemplate { $this->replyTo['address'] = $address; @@ -76,9 +76,9 @@ class BluescaleMailTemplate implements \JsonSerializable /** * @param array $recipients - * @return BMailTemplate + * @return BluescaleMailTemplate */ - public function recipients(array $recipients): BMailTemplate + public function recipients(array $recipients): BluescaleMailTemplate { if (!empty($recipients)) { foreach ($recipients as $recipient) { @@ -106,9 +106,9 @@ class BluescaleMailTemplate implements \JsonSerializable /** * @param string $address * @param array $informations - * @return BMailTemplate + * @return BluescaleMailTemplate */ - public function addRecipient(string $address, array $informations = []): BMailTemplate + public function addRecipient(string $address, array $informations = []): BluescaleMailTemplate { $data = [ 'address' => $address @@ -128,9 +128,9 @@ class BluescaleMailTemplate implements \JsonSerializable /** * @param array $parameters - * @return BMailTemplate + * @return BluescaleMailTemplate */ - public function parameters(array $parameters): BMailTemplate + public function parameters(array $parameters): BluescaleMailTemplate { $this->parameters = $parameters; return $this; @@ -139,9 +139,9 @@ class BluescaleMailTemplate implements \JsonSerializable /** * @param string $key * @param string $value - * @return BMailTemplate + * @return BluescaleMailTemplate */ - public function addParameter(string $key, string $value): BMailTemplate + public function addParameter(string $key, string $value): BluescaleMailTemplate { $this->parameters[$key] = $value; return $this;