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: /**
15: * Email body.
16: *
17: * @category Jyxo
18: * @package Jyxo_Mail
19: * @subpackage Email
20: * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
21: * @license https://github.com/jyxo/php/blob/master/license.txt
22: * @author Jaroslav HanslĂk
23: */
24: class Jyxo_Mail_Email_Body extends Jyxo_Spl_Object
25: {
26: /**
27: * Main body contents.
28: *
29: * @var string
30: */
31: private $main = '';
32:
33: /**
34: * Alternative body contents.
35: *
36: * @var string
37: */
38: private $alternative = '';
39:
40: /**
41: * Creates email body.
42: *
43: * @param string $main Main contents
44: * @param string $alternative Alternative contents
45: */
46: public function __construct($main, $alternative = '')
47: {
48: $this->setMain($main);
49: $this->setAlternative($alternative);
50: }
51:
52: /**
53: * Returns if the contents is in HTML format.
54: *
55: * @return boolean
56: */
57: public function isHtml()
58: {
59: return Jyxo_Html::is($this->main);
60: }
61:
62: /**
63: * Returns main body contents.
64: *
65: * @return string
66: */
67: public function getMain()
68: {
69: return $this->main;
70: }
71:
72: /**
73: * Sets main body contents.
74: *
75: * @param string $main Contents
76: * @return Jyxo_Mail_Email_Body
77: */
78: public function setMain($main)
79: {
80: $this->main = (string) $main;
81:
82: return $this;
83: }
84:
85: /**
86: * Returns alternative body contents.
87: *
88: * @return string
89: */
90: public function getAlternative()
91: {
92: return $this->alternative;
93: }
94:
95: /**
96: * Sets alternative body contents.
97: *
98: * @param string $alternative Contents
99: * @return Jyxo_Mail_Email_Body
100: */
101: public function setAlternative($alternative)
102: {
103: $this->alternative = (string) $alternative;
104:
105: return $this;
106: }
107: }
108: