| 1 | <?php |
||
| 9 | class ExternalParser extends AbstractSectionParser |
||
| 10 | { |
||
| 11 | private Parser |
||
|
|
|||
| 12 | $parser; |
||
| 13 | |||
| 14 | private array |
||
| 15 | $variables, |
||
| 16 | $filesStatus; |
||
| 17 | |||
| 18 | 280 | public function __construct(Parser $parser) |
|
| 19 | { |
||
| 20 | 280 | parent::__construct(); |
|
| 21 | |||
| 22 | 280 | $this->parser = $parser; |
|
| 23 | 280 | $this->variables = []; |
|
| 24 | 280 | $this->filesStatus = []; |
|
| 25 | 280 | } |
|
| 26 | |||
| 27 | 209 | public function parseLine(string $line): void |
|
| 28 | { |
||
| 29 | 209 | $file = trim($line); |
|
| 30 | |||
| 31 | 209 | $found = false; |
|
| 32 | 209 | if($this->parser->getFileSystem()->has($file)) |
|
| 33 | { |
||
| 34 | 16 | $found = true; |
|
| 35 | 16 | $this->variables = $this->parser->parse($file); |
|
| 36 | } |
||
| 37 | |||
| 38 | 209 | $this->filesStatus[$file] = [ |
|
| 39 | 209 | 'found' => $found, |
|
| 40 | 209 | 'referencedFrom' => $this->currentFilePath, |
|
| 41 | ]; |
||
| 42 | 209 | } |
|
| 43 | |||
| 44 | 184 | public function getExternalVariables(): array |
|
| 45 | { |
||
| 46 | 184 | return $this->variables; |
|
| 47 | } |
||
| 48 | |||
| 49 | 246 | public function getExternalFilesStatus(): array |
|
| 50 | { |
||
| 51 | 246 | return $this->filesStatus; |
|
| 52 | } |
||
| 54 |