Completed
Push — output_parsers_refactor ( ea70d9...668933 )
by Alessandro
02:32
created

ProcessOutputParser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Paraunit\Parser;
4
5
use Paraunit\Lifecycle\ProcessEvent;
6
7
/**
8
 * Class ProcessOutputParser.
9
 */
10
class ProcessOutputParser
11
{
12
    /** @var JSONParserChainElementInterface[] */
13
    protected $parsers;
14
15
    public function __construct()
16
    {
17
        $this->parsers = array();
18
    }
19
20
    /**
21
     * @param JSONParserChainElementInterface $parser
22
     */
23
    public function addParser(JSONParserChainElementInterface $parser)
24
    {
25
        $this->parsers[] = $parser;
26
    }
27
28
    /**
29
     * @return JSONParserChainElementInterface[]
30
     */
31
    public function getParsers()
32
    {
33
        return $this->parsers;
34
    }
35
36
    /**
37
     * @param ProcessEvent $processEvent
38
     */
39
    public function onProcessTerminated(ProcessEvent $processEvent)
40
    {
41
        foreach ($this->parsers as $parser) {
42
            if ( ! $parser->parsingFoundResult($processEvent->getProcess())) {
0 ignored issues
show
Bug introduced by
The call to parsingFoundResult() misses a required argument $log.

This check looks for function calls that miss required arguments.

Loading history...
43
                return;
44
            }
45
        }
46
    }
47
}
48