|
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; |
|
8
|
|
|
|
|
9
|
|
|
use ZBateson\MailMimeParser\Header\HeaderFactory; |
|
10
|
|
|
use ZBateson\MailMimeParser\Message\PartFilterFactory; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Responsible for creating MimePart instances. |
|
14
|
|
|
* |
|
15
|
|
|
* @author Zaahid Bateson |
|
16
|
|
|
*/ |
|
17
|
|
|
class MimePartFactory extends MessagePartFactory |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @var \ZBateson\MailMimeParser\Header\HeaderFactory the HeaderFactory |
|
21
|
|
|
* instance |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $headerFactory; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var \ZBateson\MailMimeParser\Header\HeaderFactory the PartFilterFactory |
|
27
|
|
|
* instance |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $partFilterFactory; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Creates a MimePartFactory instance with its dependencies. |
|
33
|
|
|
* |
|
34
|
|
|
* @param PartStreamFilterManagerFactory $psf |
|
35
|
|
|
* @param HeaderFactory $hf |
|
36
|
|
|
* @param PartFilterFactory $pf |
|
37
|
|
|
*/ |
|
38
|
1 |
|
public function __construct(PartStreamFilterManagerFactory $psf, HeaderFactory $hf, PartFilterFactory $pf) |
|
39
|
|
|
{ |
|
40
|
1 |
|
parent::__construct($psf); |
|
41
|
1 |
|
$this->headerFactory = $hf; |
|
42
|
1 |
|
$this->partFilterFactory = $pf; |
|
|
|
|
|
|
43
|
1 |
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Constructs a new MimePart object and returns it |
|
47
|
|
|
* |
|
48
|
|
|
* @param string $messageObjectId |
|
49
|
|
|
* @param PartBuilder $partBuilder |
|
50
|
|
|
* @return \ZBateson\MailMimeParser\Message\Part\MimePart |
|
51
|
|
|
*/ |
|
52
|
1 |
|
public function newInstance($messageObjectId, PartBuilder $partBuilder) |
|
53
|
|
|
{ |
|
54
|
1 |
|
return new MimePart( |
|
55
|
1 |
|
$this->headerFactory, |
|
56
|
1 |
|
$this->partFilterFactory, |
|
|
|
|
|
|
57
|
1 |
|
$messageObjectId, |
|
58
|
1 |
|
$partBuilder, |
|
59
|
1 |
|
$this->partStreamFilterManagerFactory->newInstance() |
|
60
|
1 |
|
); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
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..