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 Psr\Http\Message\StreamInterface; |
10
|
|
|
use ZBateson\MailMimeParser\Stream\StreamDecoratorFactory; |
11
|
|
|
use ZBateson\MailMimeParser\Header\HeaderFactory; |
12
|
|
|
use ZBateson\MailMimeParser\Message\PartFilterFactory; |
13
|
|
|
use ZBateson\MailMimeParser\Message\Part\MimePart; |
14
|
|
|
use ZBateson\MailMimeParser\Message\Part\PartBuilder; |
15
|
|
|
use ZBateson\MailMimeParser\Message\Writer\MessageWriterService; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Responsible for creating MimePart instances. |
19
|
|
|
* |
20
|
|
|
* @author Zaahid Bateson |
21
|
|
|
*/ |
22
|
|
|
class MimePartFactory extends MessagePartFactory |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var HeaderFactory an instance used for creating MimePart objects |
26
|
|
|
*/ |
27
|
|
|
protected $headerFactory; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var PartFilterFactory an instance used for creating MimePart objects |
31
|
|
|
*/ |
32
|
|
|
protected $partFilterFactory; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Initializes dependencies. |
36
|
|
|
* |
37
|
|
|
* @param StreamDecoratorFactory $sdf |
38
|
|
|
* @param PartStreamFilterManagerFactory $psf |
39
|
|
|
* @param HeaderFactory $hf |
40
|
|
|
* @param PartFilterFactory $pf |
41
|
|
|
*/ |
42
|
1 |
|
public function __construct( |
43
|
|
|
StreamDecoratorFactory $sdf, |
44
|
|
|
PartStreamFilterManagerFactory $psf, |
45
|
|
|
HeaderFactory $hf, |
46
|
|
|
PartFilterFactory $pf |
47
|
|
|
) { |
48
|
1 |
|
parent::__construct($sdf, $psf); |
49
|
1 |
|
$this->headerFactory = $hf; |
50
|
1 |
|
$this->partFilterFactory = $pf; |
51
|
1 |
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Returns the singleton instance for the class. |
55
|
|
|
* |
56
|
|
|
* @param StreamDecoratorFactory $sdf |
57
|
|
|
* @param PartStreamFilterManagerFactory $psf |
58
|
|
|
* @param HeaderFactory $hf |
59
|
|
|
* @param PartFilterFactory $pf |
60
|
|
|
* @param MessageWriterService $ws |
61
|
|
|
* @return MessagePartFactory |
62
|
|
|
*/ |
63
|
|
|
public static function getInstance( |
64
|
|
|
StreamDecoratorFactory $sdf, |
65
|
|
|
PartStreamFilterManagerFactory $psf, |
66
|
|
|
HeaderFactory $hf = null, |
67
|
|
|
PartFilterFactory $pf = null, |
68
|
|
|
MessageWriterService $ws = null, |
|
|
|
|
69
|
|
|
MimePartFactory $mpf = null |
|
|
|
|
70
|
|
|
) { |
71
|
|
|
$instance = static::getCachedInstance(); |
72
|
|
|
if ($instance === null) { |
73
|
|
|
$instance = new static($sdf, $psf, $hf, $pf); |
|
|
|
|
74
|
|
|
static::setCachedInstance($instance); |
75
|
|
|
} |
76
|
|
|
return $instance; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Constructs a new MimePart object and returns it |
81
|
|
|
* |
82
|
|
|
* @param StreamInterface $messageStream |
83
|
|
|
* @param PartBuilder $partBuilder |
84
|
|
|
* @return \ZBateson\MailMimeParser\Message\Part\MimePart |
85
|
|
|
*/ |
86
|
1 |
|
public function newInstance(StreamInterface $messageStream, PartBuilder $partBuilder) |
87
|
|
|
{ |
88
|
1 |
|
return new MimePart( |
89
|
1 |
|
$this->headerFactory, |
90
|
1 |
|
$this->partFilterFactory, |
91
|
1 |
|
$partBuilder, |
92
|
1 |
|
$this->partStreamFilterManagerFactory->newInstance(), |
93
|
1 |
|
$this->streamDecoratorFactory->getLimitedPartStream($messageStream, $partBuilder), |
94
|
1 |
|
$this->streamDecoratorFactory->getLimitedContentStream($messageStream, $partBuilder) |
95
|
|
|
); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* |
100
|
|
|
* @return MimePart |
101
|
|
|
*/ |
102
|
|
|
public function newChildInstance() |
103
|
|
|
{ |
104
|
|
|
return new MimePart( |
|
|
|
|
105
|
|
|
$this->headerFactory, |
106
|
|
|
$this->partFilterFactory, |
107
|
|
|
null, |
|
|
|
|
108
|
|
|
$this->partStreamFilterManagerFactory->newInstance() |
109
|
|
|
); |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths