12
12
*
13
13
* PHP version 7.2 or greater
14
14
*
15
- * @package jblond\Diff\Renderer\Html
16
- * @author Chris Boulton <[email protected] >
17
- * @author Mario Brandt <[email protected] >
18
- * @author Ferry Cools <[email protected] >
15
+ * @package jblond\Diff\Renderer\Html
16
+ * @author Chris Boulton <[email protected] >
17
+ * @author Mario Brandt <[email protected] >
18
+ * @author Ferry Cools <[email protected] >
19
19
* @copyright (c) 2009 Chris Boulton
20
- * @license New BSD License http://www.opensource.org/licenses/bsd-license.php
21
- * @version 2.2.1
22
- * @link https://github.com/JBlond/php-diff
20
+ * @license New BSD License http://www.opensource.org/licenses/bsd-license.php
21
+ * @version 2.2.1
22
+ * @link https://github.com/JBlond/php-diff
23
23
*/
24
24
class SideBySide extends MainRenderer implements SubRendererInterface
25
25
{
@@ -43,7 +43,7 @@ class SideBySide extends MainRenderer implements SubRendererInterface
43
43
/**
44
44
* SideBySide constructor.
45
45
*
46
- * @param array $options Custom defined options for the inline diff renderer.
46
+ * @param array $options Custom defined options for the inline diff renderer.
47
47
*
48
48
* @see Inline::$subOptions
49
49
*/
@@ -103,27 +103,30 @@ public function generateSkippedLines(): string
103
103
/**
104
104
* Generate a string representation of table rows with lines without differences between both versions.
105
105
*
106
- * @param array $changes Contains the op-codes about the changes between two blocks.
106
+ * Note: Depending on the options, lines can be marked as being equal, while the contents actually differ.
107
+ * (E.g. ignoreWhitespace and ignoreCase)
108
+ *
109
+ * @param array $changes Contains the op-codes about the changes between two blocks.
107
110
*
108
111
* @return string HTML code representing table rows showing text with no difference.
109
112
*/
110
113
public function generateLinesEqual (array $ changes ): string
111
114
{
112
115
$ html = '' ;
113
116
114
- foreach ($ changes ['base ' ]['lines ' ] as $ lineNo => $ line ) {
117
+ foreach ($ changes ['base ' ]['lines ' ] as $ lineNo => $ baseLine ) {
115
118
$ fromLine = $ changes ['base ' ]['offset ' ] + $ lineNo + 1 ;
116
119
$ toLine = $ changes ['changed ' ]['offset ' ] + $ lineNo + 1 ;
117
120
118
121
$ html .= <<<HTML
119
122
<tr>
120
123
<th> $ fromLine</th>
121
124
<td class="Left">
122
- <span> $ line </span>
125
+ <span> $ baseLine </span>
123
126
</td>
124
127
<th> $ toLine</th>
125
128
<td class="Right">
126
- <span> $ line </span>
129
+ <span> { $ changes [ ' changed ' ][ ' lines ' ][ $ lineNo ]} </span>
127
130
</td>
128
131
</tr>
129
132
HTML ;
@@ -135,7 +138,7 @@ public function generateLinesEqual(array $changes): string
135
138
/**
136
139
* Generates a string representation of table rows with lines that are added to the 2nd version.
137
140
*
138
- * @param array $changes Contains the op-codes about the changes between two blocks of text.
141
+ * @param array $changes Contains the op-codes about the changes between two blocks of text.
139
142
*
140
143
* @return string HTML code representing table rows showing with added text.
141
144
*/
@@ -164,7 +167,7 @@ public function generateLinesInsert(array $changes): string
164
167
/**
165
168
* Generates a string representation of table rows with lines that are removed from the 2nd version.
166
169
*
167
- * @param array $changes Contains the op-codes about the changes between two blocks of text.
170
+ * @param array $changes Contains the op-codes about the changes between two blocks of text.
168
171
*
169
172
* @return string HTML code representing table rows showing removed text.
170
173
*/
@@ -193,7 +196,7 @@ public function generateLinesDelete(array $changes): string
193
196
/**
194
197
* Generates a string representation of table rows with lines that are partially modified.
195
198
*
196
- * @param array $changes Contains the op-codes about the changes between two blocks of text.
199
+ * @param array $changes Contains the op-codes about the changes between two blocks of text.
197
200
*
198
201
* @return string Html code representing table rows showing modified text.
199
202
*/
@@ -264,7 +267,7 @@ public function generateLinesReplace(array $changes): string
264
267
/**
265
268
* Generate a string representation of the start of a block.
266
269
*
267
- * @param array $changes Contains the op-codes about the changes between two blocks of text.
270
+ * @param array $changes Contains the op-codes about the changes between two blocks of text.
268
271
*
269
272
* @return string Start of the diff view.
270
273
*/
@@ -276,7 +279,7 @@ public function generateBlockHeader(array $changes): string
276
279
/**
277
280
* Generate a string representation of the end of a block.
278
281
*
279
- * @param array $changes Contains the op-codes about the changes between two blocks of text.
282
+ * @param array $changes Contains the op-codes about the changes between two blocks of text.
280
283
*
281
284
* @return string End of the block.
282
285
*/
0 commit comments