Conditions | 6 |
Paths | 8 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public function beforeSendPerformed(Swift_Events_SendEvent $evt) |
||
36 | { |
||
37 | $message = $evt->getMessage(); |
||
38 | |||
39 | $body = $message->getBody(); |
||
40 | if (!empty($body) && $message->getContentType() !== 'text/plain') { |
||
41 | $html = CssInliner::fromHtml($body)->inlineCss($this->css ?? '')->renderBodyContent(); |
||
42 | $message->setBody($html); |
||
43 | } |
||
44 | |||
45 | foreach ($message->getChildren() as $messagePart) { |
||
46 | if ($messagePart->getContentType() === 'text/html') { |
||
47 | $body = $messagePart->getBody(); |
||
48 | |||
49 | if (empty($body)) { |
||
50 | continue; |
||
51 | } |
||
52 | |||
53 | $html = CssInliner::fromHtml($body)->inlineCss($this->css ?? '')->renderBodyContent(); |
||
54 | $messagePart->setBody($html); |
||
55 | } |
||
67 |