| Total Complexity | 4 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 14 | final class Analyser |
||
| 15 | { |
||
| 16 | /** @var ParserInterface[] */ |
||
| 17 | private $listParser; |
||
| 18 | |||
| 19 | /** @var ResultParser */ |
||
| 20 | private $result; |
||
| 21 | |||
| 22 | public function __construct(ParserInterface ...$listParser) |
||
| 23 | { |
||
| 24 | $this->listParser = $listParser; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function execute(PathInterface $filePath): void |
||
| 28 | { |
||
| 29 | $resultParser = new ResultParser(); |
||
| 30 | $this->result = $resultParser; |
||
| 31 | foreach ($this->listParser as $currentParser) { |
||
| 32 | $currentParser->parseFile($filePath); |
||
| 33 | $resultOfcurrentParsedFile = $currentParser->getListResult(); |
||
| 34 | |||
| 35 | $this->result->append($resultOfcurrentParsedFile); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getResult(): ResultAnalyserInterface |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |