| Conditions | 6 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function lines(array $old, array $new) |
||
| 18 | { |
||
| 19 | $out = []; |
||
| 20 | for ($i=0; $i < count($old) || $i < count($new); $i++) { |
||
| 21 | if ($i >= count($old)) { |
||
| 22 | $out[] = ['col' => 0, 'str' => $new[$i]]; // write out the entire line for extra lines |
||
| 23 | } elseif ($i >= count($new)) { |
||
| 24 | $out[] = ['col' => 0, 'str' => '']; // clear the line if the new array has less entries than the old one |
||
| 25 | } else { |
||
| 26 | $col = $this->firstDifference($old[$i], $new[$i]); |
||
| 27 | if ($col === -1) { |
||
| 28 | $out[] = null; |
||
| 29 | } else { |
||
| 30 | $out[] = ['col' => $col, 'str' => mb_substr($new[$i], $col)]; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |
||
| 34 | return $out; |
||
| 35 | } |
||
| 36 | |||
| 68 |