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