Conditions | 6 |
Paths | 6 |
Total Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function sendEmail(Email $content): void |
||
32 | { |
||
33 | $message = new \Swift_Message(); |
||
34 | |||
35 | try { |
||
36 | $message->setTo($content->getFrom()); |
||
37 | } catch (\Swift_RfcComplianceException $e) { |
||
38 | throw new EmailNotSentException('recipients', $e->getMessage()); |
||
39 | } |
||
40 | |||
41 | try { |
||
42 | $message->setFrom($data->getSender()); |
||
|
|||
43 | } catch (\Swift_RfcComplianceException $e) { |
||
44 | throw new EmailNotSentException('sender', $e->getMessage()); |
||
45 | } |
||
46 | |||
47 | $message->setSubject($data->getSubject()); |
||
48 | |||
49 | if ($data->hasAttachments()) { |
||
50 | foreach ($data->getAttachments() as $attachment) { |
||
51 | $message->attach( |
||
52 | \Swift_Attachment::fromPath($attachment->inputUri, $attachment->mimeType) |
||
53 | ->setFilename($attachment->fileName) |
||
54 | ); |
||
55 | } |
||
56 | } |
||
57 | |||
58 | if (!$this->internalMailer->send($message)) { |
||
59 | throw new EmailNotSentException('send', 'invalid mailer configuration?'); |
||
60 | } |
||
61 | } |
||
62 | } |
||
63 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.