1 | <?php namespace RuleCom\Notifier\Channels; |
||
5 | class Email implements Channel |
||
6 | { |
||
7 | /** |
||
8 | * @var Client |
||
9 | */ |
||
10 | private $guzzle; |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $apiKey; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $subject = ''; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $from = ['name' => '', 'email' => '']; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private $to = ['name' => '', 'email' => '']; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | private $content = ['html' => '', 'plain' => '']; |
||
36 | |||
37 | public function __construct(Client $guzzle) |
||
41 | |||
42 | /** |
||
43 | * @param string $apiKey |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function apiKey($apiKey) |
||
51 | |||
52 | /** |
||
53 | * @param string $subject |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function subject($subject) |
||
61 | |||
62 | /** |
||
63 | * @param array $from |
||
64 | * @return $this |
||
65 | */ |
||
66 | public function from(array $from) |
||
71 | |||
72 | /** |
||
73 | * @param array $to |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function to(array $to) |
||
81 | |||
82 | /** |
||
83 | * @param array $content |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function content($content) |
||
91 | |||
92 | /** |
||
93 | * Dispatches notification message to Rule |
||
94 | */ |
||
95 | public function dispatch() |
||
114 | |||
115 | /** |
||
116 | * @return array |
||
117 | */ |
||
118 | private function extractRecipients() |
||
126 | } |
||
127 |