1 | <?php |
||
20 | class MessageBody implements MessageBodyInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var MessageInterface |
||
24 | */ |
||
25 | protected $message; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $template; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $data; |
||
36 | |||
37 | /** |
||
38 | * To load content from twig templates |
||
39 | */ |
||
40 | use ContentFromTemplateMethods; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $bodyText; |
||
46 | |||
47 | /** |
||
48 | * @var int |
||
49 | */ |
||
50 | protected $length; |
||
51 | |||
52 | /** |
||
53 | * @var TemplateEngineInterface |
||
54 | */ |
||
55 | protected $templateEngine; |
||
56 | |||
57 | /** |
||
58 | * Creates an e-mail message body content |
||
59 | * |
||
60 | * @param string $template |
||
61 | * @param array $data |
||
62 | */ |
||
63 | 10 | public function __construct($template, $data = []) |
|
68 | |||
69 | /** |
||
70 | * Attaches the E-Mail massage that will carry this body |
||
71 | * |
||
72 | * @param MessageInterface $message |
||
73 | * |
||
74 | * @return MessageBodyInterface |
||
75 | */ |
||
76 | 6 | public function setMailMessage(MessageInterface $message) |
|
81 | |||
82 | /** |
||
83 | * Get the string-serialized message body text |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | 8 | public function getBodyText() |
|
97 | |||
98 | /** |
||
99 | * Returns the string representation of this message body |
||
100 | * |
||
101 | * @return mixed |
||
102 | */ |
||
103 | 2 | public function __toString() |
|
107 | |||
108 | /** |
||
109 | * Gets message length |
||
110 | * |
||
111 | * @return int |
||
112 | */ |
||
113 | 2 | public function getLength() |
|
120 | } |