| Conditions | 5 |
| Paths | 4 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | 9 | public function add($input) |
|
| 12 | { |
||
| 13 | 9 | $inputLines = $this->parseInput($input); |
|
| 14 | |||
| 15 | 9 | $commentSection = []; |
|
| 16 | 9 | $lines = []; |
|
| 17 | 9 | foreach($inputLines as $k => $line) { |
|
| 18 | 8 | if ($line === '' || $line[0] === '#') { |
|
| 19 | 7 | $commentSection[] = $line; |
|
| 20 | 7 | continue; |
|
| 21 | } |
||
| 22 | |||
| 23 | 8 | if (!$this->exists($line)) { |
|
| 24 | 7 | $lines = array_merge($lines, $commentSection); |
|
| 25 | 7 | $lines[] = $line; |
|
| 26 | } |
||
| 27 | |||
| 28 | 8 | $commentSection = []; |
|
| 29 | } |
||
| 30 | |||
| 31 | 9 | return parent::add($lines); |
|
| 32 | } |
||
| 33 | } |
||
| 34 |