| Conditions | 5 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function appendContent(string $addedLine, $beforeFinalComment = true) : CommitMessage |
||
| 25 | { |
||
| 26 | $content = $this->message->getLines(); |
||
| 27 | $linecounter = count($content); |
||
| 28 | if ($beforeFinalComment) { |
||
| 29 | foreach (array_reverse($content) as $line) { |
||
| 30 | if (strpos($line, $this->message->getCommentCharacter()) === 0) { |
||
| 31 | --$linecounter; |
||
| 32 | continue; |
||
| 33 | } |
||
| 34 | if (strlen(trim($line)) === 0) { |
||
| 35 | --$linecounter; |
||
| 36 | continue; |
||
| 37 | } |
||
| 38 | |||
| 39 | break; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | array_splice($content, $linecounter + 1, 0, [$addedLine]); |
||
| 44 | |||
| 45 | return new CommitMessage(implode("\n", $content), $this->message->getCommentCharacter()); |
||
| 46 | } |
||
| 47 | } |