@@ 16-69 (lines=54) @@ | ||
13 | * |
|
14 | * @author Chris Corbyn |
|
15 | */ |
|
16 | class Swift_EmbeddedFile extends Swift_Mime_EmbeddedFile |
|
17 | { |
|
18 | /** |
|
19 | * Create a new EmbeddedFile. |
|
20 | * |
|
21 | * Details may be optionally provided to the constructor. |
|
22 | * |
|
23 | * @param string|Swift_OutputByteStream $data |
|
24 | * @param string $filename |
|
25 | * @param string $contentType |
|
26 | */ |
|
27 | public function __construct($data = null, $filename = null, $contentType = null) |
|
28 | { |
|
29 | call_user_func_array( |
|
30 | array($this, 'Swift_Mime_EmbeddedFile::__construct'), |
|
31 | Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.embeddedfile') |
|
32 | ); |
|
33 | ||
34 | $this->setBody($data); |
|
35 | $this->setFilename($filename); |
|
36 | ||
37 | if ($contentType) { |
|
38 | $this->setContentType($contentType); |
|
39 | } |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * Create a new EmbeddedFile. |
|
44 | * |
|
45 | * @param string|Swift_OutputByteStream $data |
|
46 | * @param string $filename |
|
47 | * @param string $contentType |
|
48 | * |
|
49 | * @return Swift_Mime_EmbeddedFile |
|
50 | */ |
|
51 | public static function newInstance($data = null, $filename = null, $contentType = null) |
|
52 | { |
|
53 | return new self($data, $filename, $contentType); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Create a new EmbeddedFile from a filesystem path. |
|
58 | * |
|
59 | * @param string $path |
|
60 | * |
|
61 | * @return Swift_Mime_EmbeddedFile |
|
62 | */ |
|
63 | public static function fromPath($path) |
|
64 | { |
|
65 | return self::newInstance()->setFile( |
|
66 | new Swift_ByteStream_FileByteStream($path) |
|
67 | ); |
|
68 | } |
|
69 | } |
|
70 |
@@ 16-59 (lines=44) @@ | ||
13 | * |
|
14 | * @author Chris Corbyn |
|
15 | */ |
|
16 | class Swift_MimePart extends Swift_Mime_MimePart |
|
17 | { |
|
18 | /** |
|
19 | * Create a new MimePart. |
|
20 | * |
|
21 | * Details may be optionally passed into the constructor. |
|
22 | * |
|
23 | * @param string $body |
|
24 | * @param string $contentType |
|
25 | * @param string $charset |
|
26 | */ |
|
27 | public function __construct($body = null, $contentType = null, $charset = null) |
|
28 | { |
|
29 | call_user_func_array( |
|
30 | array($this, 'Swift_Mime_MimePart::__construct'), |
|
31 | Swift_DependencyContainer::getInstance() |
|
32 | ->createDependenciesFor('mime.part') |
|
33 | ); |
|
34 | ||
35 | if (!isset($charset)) { |
|
36 | $charset = Swift_DependencyContainer::getInstance() |
|
37 | ->lookup('properties.charset'); |
|
38 | } |
|
39 | $this->setBody($body); |
|
40 | $this->setCharset($charset); |
|
41 | if ($contentType) { |
|
42 | $this->setContentType($contentType); |
|
43 | } |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Create a new MimePart. |
|
48 | * |
|
49 | * @param string $body |
|
50 | * @param string $contentType |
|
51 | * @param string $charset |
|
52 | * |
|
53 | * @return self |
|
54 | */ |
|
55 | public static function newInstance($body = null, $contentType = null, $charset = null) |
|
56 | { |
|
57 | return new self($body, $contentType, $charset); |
|
58 | } |
|
59 | } |
|
60 |