1 | <?php |
||
15 | class Parser |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $filePath; |
||
22 | |||
23 | |||
24 | /** |
||
25 | * Parser constructor. |
||
26 | * |
||
27 | * @param string $filePath |
||
28 | * |
||
29 | * @throws FileNotFoundException if the specified file could not be found or is not readable |
||
30 | */ |
||
31 | public function __construct($filePath) |
||
39 | |||
40 | |||
41 | /** |
||
42 | * @return Configuration |
||
43 | */ |
||
44 | public function parse() |
||
68 | |||
69 | |||
70 | /** |
||
71 | * Reads the configuration and yields one line at a time |
||
72 | * |
||
73 | * @return \Generator |
||
74 | */ |
||
75 | private function getConfigurationLines() |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @return array the normalized configuration lines |
||
87 | */ |
||
88 | private function getNormalizedConfigurationLines() |
||
104 | |||
105 | |||
106 | /** |
||
107 | * @param string $line |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | private static function normalizeLine($line) |
||
115 | |||
116 | |||
117 | /** |
||
118 | * @param string $line |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | private static function shouldOmitLine($line) |
||
134 | |||
135 | |||
136 | /** |
||
137 | * @param string $line |
||
138 | * |
||
139 | * @return Parameter |
||
140 | */ |
||
141 | private static function parseParameter($line) |
||
155 | |||
156 | } |
||
157 |