| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 4 | public function parse() |
|
| 15 | { |
||
| 16 | try { |
||
| 17 | 4 | $this->ensureFileIsReadable(); |
|
| 18 | 2 | } catch (InvalidPathException $e) { |
|
| 19 | 2 | return []; |
|
| 20 | } |
||
| 21 | |||
| 22 | 2 | $filePath = $this->filePath; |
|
| 23 | 2 | $lines = $this->readLinesFromFile($filePath); |
|
| 24 | |||
| 25 | 2 | $data = []; |
|
| 26 | 2 | foreach ($lines as $line) { |
|
| 27 | 2 | if (!$this->isComment($line) && $this->looksLikeSetter($line)) { |
|
| 28 | 2 | list($name, $value) = $this->processFilters($line, null); |
|
| 29 | 2 | $data[$name] = $value; |
|
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | 2 | return $data; |
|
| 34 | } |
||
| 35 | } |
||
| 36 |