| 1 | <?php |
||
| 15 | class SwiftMailer implements Mailer |
||
| 16 | { |
||
| 17 | |||
| 18 | use Configurable; |
||
| 19 | use Injectable; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | * @config |
||
| 24 | */ |
||
| 25 | private static $swift_plugins = array( |
||
| 26 | SwiftPlugin::class, |
||
| 27 | ); |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var Swift_Mailer |
||
| 31 | */ |
||
| 32 | private $swift; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param Email $message |
||
| 36 | * @return bool Whether the sending was "successful" or not |
||
| 37 | */ |
||
| 38 | public function send($message) |
||
| 39 | { |
||
| 40 | $swiftMessage = $message->getSwiftMessage(); |
||
| 41 | $failedRecipients = array(); |
||
| 42 | $result = $this->sendSwift($swiftMessage, $failedRecipients); |
||
| 43 | $message->setFailedRecipients($failedRecipients); |
||
|
|
|||
| 44 | |||
| 45 | return $result != 0; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param Swift_Message $message |
||
| 50 | * @param array $failedRecipients |
||
| 51 | * @return int |
||
| 52 | */ |
||
| 53 | protected function sendSwift($message, &$failedRecipients = null) |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return Swift_Mailer |
||
| 60 | */ |
||
| 61 | public function getSwiftMailer() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param Swift_Mailer $swift |
||
| 68 | * @return $this |
||
| 69 | */ |
||
| 70 | public function setSwiftMailer($swift) |
||
| 80 | } |
||
| 81 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.