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\Parser; |
8
|
|
|
|
9
|
|
|
use ZBateson\MailMimeParser\Message\PartHeaderContainer; |
10
|
|
|
use ZBateson\MailMimeParser\Message\Factory\PartHeaderContainerFactory; |
11
|
|
|
use ZBateson\MailMimeParser\Parser\Proxy\ParserMimePartFactory; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Description of MimeParserFactory |
15
|
|
|
* |
16
|
|
|
* @author Zaahid Bateson |
17
|
|
|
*/ |
18
|
|
|
class MimeParserFactory implements IParserFactory |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @var PartHeaderContainerFactory |
22
|
|
|
*/ |
23
|
|
|
protected $partHeaderContainerFactory; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var PartBuilderFactory |
27
|
|
|
*/ |
28
|
|
|
protected $partBuilderFactory; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var HeaderParser |
32
|
|
|
*/ |
33
|
|
|
protected $headerParser; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var ParsedMimePartFactory for ParsedMimePart objects |
|
|
|
|
37
|
|
|
*/ |
38
|
|
|
protected $parserMimePartFactory; |
39
|
|
|
|
40
|
|
|
public function __construct( |
41
|
|
|
PartBuilderFactory $pbf, |
42
|
|
|
PartHeaderContainerFactory $phcf, |
43
|
|
|
HeaderParser $hp, |
44
|
|
|
ParserMimePartFactory $f |
45
|
|
|
) { |
46
|
|
|
$this->partBuilderFactory = $pbf; |
47
|
|
|
$this->partHeaderContainerFactory = $phcf; |
48
|
|
|
$this->headerParser = $hp; |
49
|
|
|
$this->parserMimePartFactory = $f; |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function newInstance() |
53
|
|
|
{ |
54
|
|
|
return new MimeParser( |
55
|
|
|
$this->partBuilderFactory, |
56
|
|
|
$this->partHeaderContainerFactory, |
57
|
|
|
$this->headerParser, |
58
|
|
|
$this->parserMimePartFactory, |
59
|
|
|
$this |
60
|
|
|
); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function canParse(PartHeaderContainer $messageHeaders) |
64
|
|
|
{ |
65
|
|
|
return ($messageHeaders->exists('Content-Type') || |
66
|
|
|
$messageHeaders->exists('Mime-Version')); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
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