Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Services\Notification\Contracts; |
| 4 | |
| 5 | /** |
| 6 | * One outbound channel (email, an SMS provider, WhatsApp). Mirrors the |
| 7 | * shape of App\Services\Payment\Contracts\PaymentGatewayContract — same |
| 8 | * "config schema declared, isImplemented() tells the truth" discipline. |
| 9 | */ |
| 10 | interface NotificationChannelContract |
| 11 | { |
| 12 | public function key(): string; |
| 13 | |
| 14 | public function label(): string; |
| 15 | |
| 16 | /** @return array<string, array<string, mixed>> same shape as a settings schema field */ |
| 17 | public function configSchema(): array; |
| 18 | |
| 19 | /** |
| 20 | * @param string $to email address or phone number, whichever this channel expects |
| 21 | * @param array<string, mixed> $config |
| 22 | * @return array{ok: bool, response: string} — never throws; a failed send is ['ok' => false, 'response' => '<reason>'] |
| 23 | */ |
| 24 | public function send(string $to, string $subject, string $body, array $config): array; |
| 25 | |
| 26 | /** False for a channel whose config schema/card exist but isn't wired to a real send yet. */ |
| 27 | public function isImplemented(): bool; |
| 28 | } |