| Conditions | 3 |
| Paths | 3 |
| Total Lines | 31 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function send() |
||
| 23 | { |
||
| 24 | if (!$this->check()) { |
||
| 25 | return; |
||
| 26 | } |
||
| 27 | |||
| 28 | $data = $this->data; |
||
| 29 | $config = $this->config; |
||
| 30 | |||
| 31 | if ($this->isMailablePossible()) { |
||
| 32 | MailFacade::queue(new LogEmail($data, $config)); |
||
| 33 | return; |
||
| 34 | } |
||
| 35 | |||
| 36 | MailFacade::queue('log-envelope::main', $data, function($message) use ($data, $config) { |
||
| 37 | $subject = sprintf('[%s] @ %s: %s', $data['class'], $data['host'], $data['exception']); |
||
| 38 | |||
| 39 | // to protect from gmail's anchors automatic generation |
||
| 40 | $message->setBody( |
||
| 41 | preg_replace( |
||
| 42 | ['~\.~', '~http~'], |
||
| 43 | ['<span>.</span>', '<span>http</span>'], |
||
| 44 | $message->getBody() |
||
| 45 | ) |
||
| 46 | ); |
||
| 47 | |||
| 48 | $message->to($config['to']) |
||
| 49 | ->from($config['from_email'], $config['from_name']) |
||
| 50 | ->subject($subject); |
||
| 51 | }); |
||
| 52 | } // end send |
||
| 53 | |||
| 60 |