1 | <?php |
||
15 | class JSONLogParser implements OutputContainerBearerInterface |
||
16 | { |
||
17 | /** @var JSONLogFetcher */ |
||
18 | private $logLocator; |
||
19 | |||
20 | /** @var JSONParserChainElementInterface[] */ |
||
21 | private $parsers; |
||
22 | |||
23 | /** @var OutputContainerInterface */ |
||
24 | private $abnormalTerminatedOutputContainer; |
||
25 | |||
26 | /** |
||
27 | * JSONLogParser constructor. |
||
28 | * @param JSONLogFetcher $logLocator |
||
29 | * @param OutputContainerInterface $abnormalTerminatedOutputContainer |
||
30 | */ |
||
31 | 21 | public function __construct(JSONLogFetcher $logLocator, OutputContainerInterface $abnormalTerminatedOutputContainer) |
|
37 | |||
38 | /** |
||
39 | * @param JSONParserChainElementInterface $parser |
||
40 | */ |
||
41 | 19 | public function addParser(JSONParserChainElementInterface $parser) |
|
45 | |||
46 | /** |
||
47 | * @return JSONParserChainElementInterface[] |
||
48 | */ |
||
49 | 10 | public function getParsersForPrinting() |
|
53 | |||
54 | /** |
||
55 | * @return OutputContainerInterface |
||
56 | */ |
||
57 | 8 | public function getOutputContainer() |
|
61 | |||
62 | /** |
||
63 | * @return OutputContainerInterface |
||
64 | */ |
||
65 | 14 | public function getAbnormalTerminatedOutputContainer() |
|
69 | |||
70 | /** |
||
71 | * @param ProcessEvent $processEvent |
||
72 | */ |
||
73 | 7 | public function onProcessTerminated(ProcessEvent $processEvent) |
|
77 | |||
78 | /** |
||
79 | * @param ParaunitProcessAbstract $process |
||
80 | */ |
||
81 | 18 | public function parse(ParaunitProcessAbstract $process) |
|
106 | |||
107 | /** |
||
108 | * @param ProcessResultInterface $process |
||
109 | * @param \stdClass $logItem |
||
110 | * @return bool False if the parsing is still waiting for a test to give results |
||
111 | */ |
||
112 | 14 | private function extractTestResult(ProcessResultInterface $process, \stdClass $logItem) |
|
122 | |||
123 | /** |
||
124 | * @param ParaunitProcessAbstract $process |
||
125 | * @param string $culpableFunctionName |
||
126 | */ |
||
127 | 6 | private function reportAbnormalTermination(ParaunitProcessAbstract $process, $culpableFunctionName = 'Unknown function -- test log not found') |
|
136 | } |
||
137 |