| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 10 | public static function getCorrectYamlContent(array $yamlLines): array |
|
| 16 | { |
||
| 17 | 10 | $reversedYamlLines = array_reverse($yamlLines, true); |
|
| 18 | 10 | $keys = array_keys($reversedYamlLines); |
|
| 19 | 10 | $lastKey = end($keys); |
|
| 20 | |||
| 21 | 10 | foreach ($reversedYamlLines as $key => $yamlLine) { |
|
| 22 | 10 | if (YamlService::isLineNotBlank($yamlLine)) { |
|
| 23 | 9 | $yamlLines = array_slice($yamlLines, 0, $key + 1); |
|
| 24 | 9 | $yamlLines[] = ''; |
|
| 25 | 9 | break; |
|
| 26 | } |
||
| 27 | 9 | if ($key === $lastKey) { |
|
| 28 | 1 | $yamlLines = ['']; |
|
| 29 | 1 | break; |
|
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | 10 | return $yamlLines; |
|
| 34 | } |
||
| 36 |