1 | <?php |
||
8 | class Newsletter |
||
9 | { |
||
10 | /** @var \DrewM\MailChimp\MailChimp */ |
||
11 | protected $mailChimp; |
||
12 | |||
13 | /** * @var \Spatie\Newsletter\NewsletterListCollection */ |
||
14 | protected $lists; |
||
15 | |||
16 | /** |
||
17 | * @param \DrewM\MailChimp\MailChimp $mailChimp |
||
18 | * @param \Spatie\Newsletter\NewsletterListCollection $lists |
||
19 | */ |
||
20 | public function __construct(MailChimp $mailChimp, NewsletterListCollection $lists) |
||
26 | |||
27 | /** |
||
28 | * @param string $email |
||
29 | * @param array $mergeFields |
||
30 | * @param string $listName |
||
31 | * @param array $options |
||
32 | * |
||
33 | * @return array|bool |
||
34 | * |
||
35 | * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList |
||
36 | */ |
||
37 | public function subscribe($email, $mergeFields = [], $listName = '', $options = []) |
||
61 | |||
62 | /** |
||
63 | * @param string $email |
||
64 | * @param string $listName |
||
65 | * |
||
66 | * @return array|bool |
||
67 | * |
||
68 | * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList |
||
69 | */ |
||
70 | public function getMember($email, $listName = '') |
||
80 | |||
81 | /** |
||
82 | * @param string $email |
||
83 | * @param string $listName |
||
84 | * |
||
85 | * @return bool |
||
86 | */ |
||
87 | public function hasMember($email, $listName = '') |
||
101 | |||
102 | /** |
||
103 | * @param $email |
||
104 | * @param string $listName |
||
105 | * |
||
106 | * @return array|false |
||
107 | * |
||
108 | * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList |
||
109 | */ |
||
110 | public function unsubscribe($email, $listName = '') |
||
118 | |||
119 | /** |
||
120 | * @param string $fromName |
||
121 | * @param string $replyTo |
||
122 | * @param string $subject |
||
123 | * @param string $html |
||
124 | * @param string $listName |
||
125 | * @param array $options |
||
126 | * @param array $contentOptions |
||
127 | * |
||
128 | * @return array|bool |
||
129 | * |
||
130 | * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList |
||
131 | */ |
||
132 | public function createCampaign($fromName, $replyTo, $subject, $html = '', $listName = '', $options = [], $contentOptions = []) |
||
166 | |||
167 | public function updateContent($campaignId, $html, $options = []) |
||
181 | |||
182 | /** |
||
183 | * @return \DrewM\MailChimp\MailChimp |
||
184 | */ |
||
185 | public function getApi() |
||
189 | |||
190 | /** |
||
191 | * @return array|false |
||
192 | */ |
||
193 | public function getLastError() |
||
197 | |||
198 | /** |
||
199 | * @return bool |
||
200 | */ |
||
201 | public function lastActionSucceeded() |
||
205 | |||
206 | /** |
||
207 | * @param string $email |
||
208 | * |
||
209 | * @return string |
||
210 | */ |
||
211 | protected function getSubscriberHash($email) |
||
215 | |||
216 | protected function getDefaultSubscribeStatus() |
||
226 | } |
||
227 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: