| Conditions | 5 |
| Paths | 5 |
| Total Lines | 30 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | public function render() : string |
||
| 37 | { |
||
| 38 | $html = ''; |
||
| 39 | |||
| 40 | $diff = $this->diff->toArray(); |
||
| 41 | |||
| 42 | // loop over the lines in the diff |
||
| 43 | foreach ($diff as $line) |
||
| 44 | { |
||
| 45 | $element = ''; |
||
| 46 | |||
| 47 | // extend the HTML with the line |
||
| 48 | switch ($line[1]) |
||
| 49 | { |
||
| 50 | case Diff::UNMODIFIED : $element = 'span'; break; |
||
| 51 | case Diff::DELETED : $element = 'del'; break; |
||
| 52 | case Diff::INSERTED : $element = 'ins'; break; |
||
| 53 | } |
||
| 54 | |||
| 55 | $html .= sprintf( |
||
| 56 | '<%1$s>%2$s</%1$s>', |
||
| 57 | $element, |
||
| 58 | htmlspecialchars((string)$line[0]) |
||
| 59 | ); |
||
| 60 | |||
| 61 | // extend the HTML with the separator |
||
| 62 | $html .= $this->separator; |
||
| 63 | } |
||
| 64 | |||
| 65 | return sprintf($this->container, $html); |
||
| 66 | } |
||
| 68 |