| Conditions | 5 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 6 | public static function addBlankLineIndentsByHisParent(array $fileLines, int $key): string |
|
| 17 | { |
||
| 18 | 6 | $currentLine = $fileLines[$key]; |
|
| 19 | 6 | $arrayKeys = array_keys($fileLines); |
|
| 20 | 6 | $lastKey = end($arrayKeys); |
|
| 21 | 6 | $indents = ''; |
|
| 22 | |||
| 23 | 6 | if (YamlService::isLineNotBlank($currentLine)) { |
|
| 24 | 6 | return $currentLine; |
|
| 25 | } |
||
| 26 | |||
| 27 | 6 | while ($key < $lastKey) { |
|
| 28 | 6 | $key++; |
|
| 29 | 6 | $line = $fileLines[$key]; |
|
| 30 | |||
| 31 | 6 | if (YamlService::isLineNotBlank($line) && YamlService::isLineComment($line) === false) { |
|
| 32 | 5 | $countOfRowIndents = YamlService::rowIndentsOf($line); |
|
| 33 | 5 | $indents = YamlService::createCorrectIndentsByCountOfIndents($countOfRowIndents); |
|
| 34 | 5 | break; |
|
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | 6 | return $indents . $currentLine; |
|
| 39 | } |
||
| 41 |