1 | <?php |
||
9 | class Mailer extends SilverstripeMailer |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | * @config |
||
14 | */ |
||
15 | private static $api_domain = ''; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | * @config |
||
20 | */ |
||
21 | private static $api_endpoint = 'api.mailgun.net'; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | * @config |
||
26 | */ |
||
27 | private static $api_key = ''; |
||
28 | |||
29 | /** |
||
30 | * @var boolean |
||
31 | * @config |
||
32 | */ |
||
33 | private static $api_ssl = true; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | * @config |
||
38 | */ |
||
39 | private static $api_version = 'v3'; |
||
40 | |||
41 | /** |
||
42 | * An array of temporary file handles opened to store attachments |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $tempFileHandles = []; |
||
46 | |||
47 | /** |
||
48 | * @var Mailgun\Mailgun |
||
49 | */ |
||
50 | protected $mailgunClient; |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function __construct() |
||
65 | |||
66 | /** |
||
67 | * @param Mailgun\Mailgun $client |
||
|
|||
68 | * @return self |
||
69 | */ |
||
70 | public function setMailgunClient(Mailgun $client) |
||
75 | |||
76 | /** |
||
77 | * @return Mailgun\Mailgun |
||
78 | */ |
||
79 | public function getMailgunClient() |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function sendPlain($to, $from, $subject, $plainContent, $attachments = [], $headers = []) |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | public function sendHTML($to, $from, $subject, $htmlContent, $attachments = [], $headers = [], $plainContent = '') |
||
99 | |||
100 | /** |
||
101 | * @param string $to |
||
102 | * @param string $from |
||
103 | * @param string $subject |
||
104 | * @param string $content |
||
105 | * @param string $plainContent |
||
106 | * @param array $attachments |
||
107 | * @param array $headers |
||
108 | */ |
||
109 | protected function sendMessage($to, $from, $subject, $content, $plainContent, $attachments, $headers) |
||
130 | |||
131 | /** |
||
132 | * @param Mailgun\Messages\MessageBuilder $messageBuilder |
||
133 | * @param string $to |
||
134 | * @param string $from |
||
135 | * @param string $subject |
||
136 | * @param string $content |
||
137 | * @param string $plainContent |
||
138 | * @param array $attachments |
||
139 | * @param array $headers |
||
140 | */ |
||
141 | protected function buildMessage(MessageBuilder $builder, $to, $from, $subject, $content, $plainContent, $headers) |
||
178 | |||
179 | /** |
||
180 | * Prepare attachments for sending. SilverStripe extracts the content and |
||
181 | * passes that to the mailer, so to save encoding it we just write them all |
||
182 | * to individual files and let Mailgun deal with the rest. |
||
183 | * |
||
184 | * @todo Can we handle this better? |
||
185 | * @param array $attachments |
||
186 | * @return array |
||
187 | */ |
||
188 | protected function prepareAttachments(array $attachments) |
||
203 | |||
204 | /** |
||
205 | * @param string $contents |
||
206 | * @return string |
||
207 | */ |
||
208 | protected function writeToTempFile($contents) |
||
221 | |||
222 | /** |
||
223 | * @return void |
||
224 | */ |
||
225 | protected function closeTempFileHandles() |
||
233 | } |
||
234 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.