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