PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / trunk
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress vtrunk
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / vendor / zbateson / mail-mime-parser / src / Parser / Proxy / ParserUUEncodedPartProxyFactory.php

ParserUUEncodedPartProxyFactory.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress trunk, at vendor/zbateson/mail-mime-parser/src/Parser/Proxy/ParserUUEncodedPartProxyFactory.php

63 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This file is part of the ZBateson\MailMimeParser project.
4 *
5 * @license http://opensource.org/licenses/bsd-license.php BSD
6 */
7
8 namespace ZBateson\MailMimeParser\Parser\Proxy;
9
10 use ZBateson\MailMimeParser\Message\UUEncodedPart;
11 use ZBateson\MailMimeParser\Parser\IParser;
12 use ZBateson\MailMimeParser\Parser\Part\ParserPartStreamContainerFactory;
13 use ZBateson\MailMimeParser\Parser\PartBuilder;
14 use ZBateson\MailMimeParser\Stream\StreamFactory;
15
16 /**
17 * Responsible for creating proxied IUUEncodedPart instances wrapped in a
18 * ParserUUEncodedPartProxy and used by NonMimeParser.
19 *
20 * @author Zaahid Bateson
21 */
22 class ParserUUEncodedPartProxyFactory extends ParserPartProxyFactory
23 {
24 /**
25 * @var StreamFactory the StreamFactory instance
26 */
27 protected $streamFactory;
28
29 /**
30 * @var ParserPartStreamContainerFactory
31 */
32 protected $parserPartStreamContainerFactory;
33
34 public function __construct(StreamFactory $sdf, ParserPartStreamContainerFactory $parserPartStreamContainerFactory)
35 {
36 $this->streamFactory = $sdf;
37 $this->parserPartStreamContainerFactory = $parserPartStreamContainerFactory;
38 }
39
40 /**
41 * Constructs a new ParserUUEncodedPartProxy wrapping an IUUEncoded object.
42 *
43 * @return ParserPartProxy
44 */
45 public function newInstance(PartBuilder $partBuilder, IParser $parser)
46 {
47 $parserProxy = new ParserUUEncodedPartProxy($partBuilder, $parser);
48 $streamContainer = $this->parserPartStreamContainerFactory->newInstance($parserProxy);
49
50 $part = new UUEncodedPart(
51 $parserProxy->getUnixFileMode(),
52 $parserProxy->getFileName(),
53 $partBuilder->getParent()->getPart(),
54 $streamContainer
55 );
56 $parserProxy->setPart($part);
57
58 $streamContainer->setStream($this->streamFactory->newMessagePartStream($part));
59 $part->attach($streamContainer);
60 return $parserProxy;
61 }
62 }
63