1 | <?php |
||
7 | class IncludeParser extends AbstractSectionParser |
||
8 | { |
||
9 | private array |
||
|
|||
10 | $files; |
||
11 | |||
12 | 280 | public function __construct() |
|
13 | { |
||
14 | 280 | parent::__construct(); |
|
15 | |||
16 | 280 | $this->files = []; |
|
17 | 280 | } |
|
18 | |||
19 | 211 | protected function parseLine(string $line): void |
|
20 | { |
||
21 | 211 | $this->checkFilenameIsValid($line); |
|
22 | |||
23 | 210 | $this->files[] = $line; |
|
24 | 210 | } |
|
25 | |||
26 | 211 | private function checkFilenameIsValid(string $filename): void |
|
27 | { |
||
28 | 211 | if(! preg_match('~.*\.conf$~', $filename)) |
|
29 | { |
||
30 | 1 | $this->triggerError("$filename is not a valid file name", 'Invalid dependency'); |
|
31 | } |
||
32 | 210 | } |
|
33 | |||
34 | 248 | public function getCollectedFiles(): array |
|
35 | { |
||
36 | 248 | return $this->files; |
|
37 | } |
||
38 | } |
||
39 |