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
|
|
|
namespace ZBateson\MailMimeParser\Message\Part\Factory; |
8
|
|
|
|
9
|
|
|
use ZBateson\MailMimeParser\Stream\StreamDecoratorFactory; |
10
|
|
|
use ZBateson\MailMimeParser\Header\HeaderFactory; |
11
|
|
|
use ZBateson\MailMimeParser\Message\MessageFactory; |
12
|
|
|
use ZBateson\MailMimeParser\Message\PartFilterFactory; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Responsible for creating singleton instances of MessagePartFactory and its |
16
|
|
|
* subclasses. |
17
|
|
|
* |
18
|
|
|
* @author Zaahid Bateson |
19
|
|
|
*/ |
20
|
|
|
class PartFactoryService |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var \ZBateson\MailMimeParser\Header\HeaderFactory the HeaderFactory |
24
|
|
|
* object used for created headers |
25
|
|
|
*/ |
26
|
|
|
protected $headerFactory; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var \ZBateson\MailMimeParser\Header\HeaderFactory the PartFilterFactory |
30
|
|
|
* instance |
31
|
|
|
*/ |
32
|
|
|
protected $partFilterFactory; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var PartStreamFilterManagerFactory the PartStreamFilterManagerFactory |
36
|
|
|
* instance |
37
|
|
|
*/ |
38
|
|
|
protected $partStreamFilterManagerFactory; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var StreamDecoratorFactory the StreamDecoratorFactory instance |
42
|
|
|
*/ |
43
|
|
|
protected $streamDecoratorFactory; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Sets up dependencies. |
47
|
|
|
* |
48
|
|
|
* @param HeaderFactory $headerFactory |
49
|
|
|
* @param PartFilterFactory $partFilterFactory |
50
|
|
|
* @param StreamDecoratorFactory $streamDecoratorFactory |
51
|
|
|
* @param PartStreamFilterManagerFactory $partStreamFilterManagerFactory |
52
|
|
|
*/ |
53
|
|
|
public function __construct( |
54
|
|
|
HeaderFactory $headerFactory, |
55
|
|
|
PartFilterFactory $partFilterFactory, |
56
|
|
|
StreamDecoratorFactory $streamDecoratorFactory, |
57
|
|
|
PartStreamFilterManagerFactory $partStreamFilterManagerFactory |
58
|
|
|
) { |
59
|
|
|
$this->headerFactory = $headerFactory; |
60
|
|
|
$this->partFilterFactory = $partFilterFactory; |
|
|
|
|
61
|
|
|
$this->streamDecoratorFactory = $streamDecoratorFactory; |
62
|
|
|
$this->partStreamFilterManagerFactory = $partStreamFilterManagerFactory; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Returns the MessageFactory singleton instance. |
67
|
|
|
* |
68
|
|
|
* @return MessageFactory |
69
|
|
|
*/ |
70
|
1 |
|
public function getMessageFactory() |
71
|
|
|
{ |
72
|
1 |
|
return MessageFactory::getInstance( |
73
|
1 |
|
$this->streamDecoratorFactory, |
74
|
1 |
|
$this->partStreamFilterManagerFactory, |
75
|
1 |
|
$this->headerFactory, |
76
|
1 |
|
$this->partFilterFactory |
|
|
|
|
77
|
|
|
); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Returns the MimePartFactory singleton instance. |
82
|
|
|
* |
83
|
|
|
* @return MimePartFactory |
84
|
|
|
*/ |
85
|
1 |
|
public function getMimePartFactory() |
86
|
|
|
{ |
87
|
1 |
|
return MimePartFactory::getInstance( |
88
|
1 |
|
$this->streamDecoratorFactory, |
89
|
1 |
|
$this->partStreamFilterManagerFactory, |
90
|
1 |
|
$this->headerFactory, |
91
|
1 |
|
$this->partFilterFactory |
|
|
|
|
92
|
|
|
); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Returns the NonMimePartFactory singleton instance. |
97
|
|
|
* |
98
|
|
|
* @return NonMimePartFactory |
99
|
|
|
*/ |
100
|
1 |
|
public function getNonMimePartFactory() |
101
|
|
|
{ |
102
|
1 |
|
return NonMimePartFactory::getInstance( |
103
|
1 |
|
$this->streamDecoratorFactory, |
104
|
1 |
|
$this->partStreamFilterManagerFactory |
105
|
|
|
); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Returns the UUEncodedPartFactory singleton instance. |
110
|
|
|
* |
111
|
|
|
* @return UUEncodedPartFactory |
112
|
|
|
*/ |
113
|
1 |
|
public function getUUEncodedPartFactory() |
114
|
|
|
{ |
115
|
1 |
|
return UUEncodedPartFactory::getInstance( |
116
|
1 |
|
$this->streamDecoratorFactory, |
117
|
1 |
|
$this->partStreamFilterManagerFactory |
118
|
|
|
); |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..