| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2.2894 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 9 | protected function sendMail(User $user) |
|
| 37 | { |
||
| 38 | 9 | $type = $this->mailService->getType(); |
|
| 39 | 9 | $event = $this->make(MailEvent::class, [$type, $user, $this->mailService, null]); |
|
| 40 | 9 | $user->trigger(MailEvent::EVENT_BEFORE_SEND_MAIL, $event); |
|
| 41 | try { |
||
| 42 | 9 | $this->mailService->run(); |
|
| 43 | } catch (Exception $e) { |
||
| 44 | $event = $this->make(MailEvent::class, [$type, $user, $this->mailService, $e]); |
||
| 45 | Yii::error($e->getMessage(), 'usuario'); |
||
| 46 | $user->trigger(MailEvent::EVENT_AFTER_SEND_MAIL, $event); |
||
| 47 | return false; |
||
| 48 | } |
||
| 49 | 9 | $user->trigger(MailEvent::EVENT_AFTER_SEND_MAIL, $event); |
|
| 50 | 9 | return true; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |