1: <?php
2:
3: /**
4: * Jyxo PHP Library
5: *
6: * LICENSE
7: *
8: * This source file is subject to the new BSD license that is bundled
9: * with this package in the file license.txt.
10: * It is also available through the world-wide-web at this URL:
11: * https://github.com/jyxo/php/blob/master/license.txt
12: */
13:
14: namespace Jyxo\Mail\Email;
15:
16: /**
17: * Email body.
18: *
19: * @category Jyxo
20: * @package Jyxo\Mail
21: * @subpackage Email
22: * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
23: * @license https://github.com/jyxo/php/blob/master/license.txt
24: * @author Jaroslav HanslĂk
25: */
26: class Body extends \Jyxo\Spl\Object
27: {
28: /**
29: * Main body contents.
30: *
31: * @var string
32: */
33: private $main = '';
34:
35: /**
36: * Alternative body contents.
37: *
38: * @var string
39: */
40: private $alternative = '';
41:
42: /**
43: * Creates email body.
44: *
45: * @param string $main Main contents
46: * @param string $alternative Alternative contents
47: */
48: public function __construct($main, $alternative = '')
49: {
50: $this->setMain($main);
51: $this->setAlternative($alternative);
52: }
53:
54: /**
55: * Returns if the contents is in HTML format.
56: *
57: * @return boolean
58: */
59: public function isHtml()
60: {
61: return \Jyxo\Html::is($this->main);
62: }
63:
64: /**
65: * Returns main body contents.
66: *
67: * @return string
68: */
69: public function getMain()
70: {
71: return $this->main;
72: }
73:
74: /**
75: * Sets main body contents.
76: *
77: * @param string $main Contents
78: * @return \Jyxo\Mail\Email\Body
79: */
80: public function setMain($main)
81: {
82: $this->main = (string) $main;
83:
84: return $this;
85: }
86:
87: /**
88: * Returns alternative body contents.
89: *
90: * @return string
91: */
92: public function getAlternative()
93: {
94: return $this->alternative;
95: }
96:
97: /**
98: * Sets alternative body contents.
99: *
100: * @param string $alternative Contents
101: * @return \Jyxo\Mail\Email\Body
102: */
103: public function setAlternative($alternative)
104: {
105: $this->alternative = (string) $alternative;
106:
107: return $this;
108: }
109: }
110: