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 attachment.
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: abstract class Jyxo_Mail_Email_Attachment extends Jyxo_Spl_Object
25: {
26: /**
27: * Ordinary attachment.
28: *
29: * @var string
30: */
31: const DISPOSITION_ATTACHMENT = 'attachment';
32:
33: /**
34: * Inline attachment.
35: *
36: * @var string
37: */
38: const DISPOSITION_INLINE = 'inline';
39:
40: /**
41: * Type.
42: *
43: * @var string
44: */
45: protected $disposition = '';
46:
47: /**
48: * Contents.
49: *
50: * @var string
51: */
52: protected $content = '';
53:
54: /**
55: * Name.
56: *
57: * @var string
58: */
59: protected $name = '';
60:
61: /**
62: * Id.
63: *
64: * @var string
65: */
66: protected $cid = '';
67:
68: /**
69: * Content mime-type.
70: *
71: * @var string
72: */
73: protected $mimeType = '';
74:
75: /**
76: * Content encoding.
77: *
78: * @var string
79: */
80: protected $encoding = '';
81:
82: /**
83: * Returns type.
84: *
85: * @return string
86: */
87: public function getDisposition()
88: {
89: return $this->disposition;
90: }
91:
92: /**
93: * Returns contents.
94: *
95: * @return string
96: */
97: public function getContent()
98: {
99: return $this->content;
100: }
101:
102: /**
103: * Sets contents.
104: *
105: * @param string $content Contents
106: * @return Jyxo_Mail_Email_Attachment
107: */
108: public function setContent($content)
109: {
110: $this->content = (string) $content;
111:
112: return $this;
113: }
114:
115: /**
116: * Returns name.
117: *
118: * @return string
119: */
120: public function getName()
121: {
122: return $this->name;
123: }
124:
125: /**
126: * Sets name.
127: *
128: * @param string $name Name
129: * @return Jyxo_Mail_Email_Attachment
130: */
131: public function setName($name)
132: {
133: $this->name = (string) $name;
134:
135: return $this;
136: }
137:
138: /**
139: * Returns Id.
140: *
141: * @return string
142: */
143: public function getCid()
144: {
145: return $this->cid;
146: }
147:
148: /**
149: * Returns content mime-type.
150: *
151: * @return string
152: */
153: public function getMimeType()
154: {
155: return $this->mimeType;
156: }
157:
158: /**
159: * Sets content mime-type.
160: *
161: * @param string $mimeType Mime-type
162: * @return Jyxo_Mail_Email_Attachment
163: */
164: public function setMimeType($mimeType)
165: {
166: $this->mimeType = (string) $mimeType;
167:
168: return $this;
169: }
170:
171: /**
172: * Returns contents encoding.
173: *
174: * @return string
175: */
176: public function getEncoding()
177: {
178: return $this->encoding;
179: }
180:
181: /**
182: * Returns if the attachment is inline.
183: *
184: * @return boolean
185: */
186: public function isInline()
187: {
188: return self::DISPOSITION_INLINE === $this->disposition;
189: }
190: }
191: