| Conditions | 7 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function lines(array $old, array $new, $options = OutputInterface::OUTPUT_NORMAL) |
||
| 32 | { |
||
| 33 | $diff = $this->diff->lines($old, $new); |
||
| 34 | |||
| 35 | if (($options & OutputInterface::OUTPUT_NORMAL) == OutputInterface::OUTPUT_NORMAL) { |
||
| 36 | // replace col number with strip_tags version to represent what is outputted to the user |
||
| 37 | for ($i = 0; $i < count($new); $i++) { |
||
|
|
|||
| 38 | if (isset($diff[$i]) && !is_null($new[$i]) && $diff[$i]['col'] > 0) { |
||
| 39 | $tags = $this->getUnclosedTags(mb_substr($new[$i], 0, $diff[$i]['col'])); |
||
| 40 | if (count($tags) > 0) { |
||
| 41 | $diff[$i]['str'] = '<' . implode('><', $tags) . '>' . $diff[$i]['str']; |
||
| 42 | } |
||
| 43 | $diff[$i]['col'] = mb_strlen(strip_tags(mb_substr($new[$i], 0, $diff[$i]['col']))); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | return $diff; |
||
| 49 | } |
||
| 50 | |||
| 66 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: