@@ -116,16 +116,23 @@ protected function renderTableEqual(array $change): string
116
116
foreach ($ change ['old ' ]['lines ' ] as $ no => $ oldLine ) {
117
117
$ newLine = $ change ['new ' ]['lines ' ][$ no ];
118
118
119
- $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
120
- $ newLineNum = $ change ['new ' ]['offset ' ] + $ no + 1 ;
119
+ if ($ this ->options ['lineNumbers ' ]) {
120
+ $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
121
+ $ newLineNum = $ change ['new ' ]['offset ' ] + $ no + 1 ;
121
122
122
- $ html .=
123
- '<tr> ' .
124
- $ this ->renderLineNumberColumn ('old ' , $ oldLineNum ) .
125
- '<td class="old"> ' . $ oldLine . '</td> ' .
126
- $ this ->renderLineNumberColumn ('new ' , $ newLineNum ) .
127
- '<td class="new"> ' . $ newLine . '</td> ' .
128
- '</tr> ' ;
123
+ $ html .=
124
+ '<tr> ' .
125
+ $ this ->renderLineNumberColumn ('old ' , $ oldLineNum ) .
126
+ '<td class="old"> ' . $ oldLine . '</td> ' .
127
+ $ this ->renderLineNumberColumn ('new ' , $ newLineNum ) .
128
+ '<td class="new"> ' . $ newLine . '</td> ' .
129
+ '</tr> ' ;
130
+ } else {
131
+ $ html .=
132
+ '<tr> ' .
133
+ '<td class="new" colspan="2"> ' . $ newLine . '</td> ' .
134
+ '</tr> ' ;
135
+ }
129
136
}
130
137
131
138
return $ html ;
@@ -141,15 +148,22 @@ protected function renderTableInsert(array $change): string
141
148
$ html = '' ;
142
149
143
150
foreach ($ change ['new ' ]['lines ' ] as $ no => $ newLine ) {
144
- $ newLineNum = $ change ['new ' ]['offset ' ] + $ no + 1 ;
151
+ if ($ this ->options ['lineNumbers ' ]) {
152
+ $ newLineNum = $ change ['new ' ]['offset ' ] + $ no + 1 ;
145
153
146
- $ html .=
147
- '<tr> ' .
148
- $ this ->renderLineNumberColumn ('' , null ) .
149
- '<td class="old"></td> ' .
150
- $ this ->renderLineNumberColumn ('new ' , $ newLineNum ) .
151
- '<td class="new"> ' . $ newLine . '</td> ' .
152
- '</tr> ' ;
154
+ $ html .=
155
+ '<tr> ' .
156
+ $ this ->renderLineNumberColumn ('' , null ) .
157
+ '<td class="old"></td> ' .
158
+ $ this ->renderLineNumberColumn ('new ' , $ newLineNum ) .
159
+ '<td class="new"> ' . $ newLine . '</td> ' .
160
+ '</tr> ' ;
161
+ } else {
162
+ $ html .=
163
+ '<tr> ' .
164
+ '<td class="new" colspan="2"> ' . $ newLine . '</td> ' .
165
+ '</tr> ' ;
166
+ }
153
167
}
154
168
155
169
return $ html ;
@@ -165,15 +179,22 @@ protected function renderTableDelete(array $change): string
165
179
$ html = '' ;
166
180
167
181
foreach ($ change ['old ' ]['lines ' ] as $ no => $ oldLine ) {
168
- $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
182
+ if ($ this ->options ['lineNumbers ' ]) {
183
+ $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
169
184
170
- $ html .=
171
- '<tr> ' .
172
- $ this ->renderLineNumberColumn ('old ' , $ oldLineNum ) .
173
- '<td class="old"> ' . $ oldLine . '</td> ' .
174
- $ this ->renderLineNumberColumn ('' , null ) .
175
- '<td class="new"></td> ' .
176
- '</tr> ' ;
185
+ $ html .=
186
+ '<tr> ' .
187
+ $ this ->renderLineNumberColumn ('old ' , $ oldLineNum ) .
188
+ '<td class="old"> ' . $ oldLine . '</td> ' .
189
+ $ this ->renderLineNumberColumn ('' , null ) .
190
+ '<td class="new"></td> ' .
191
+ '</tr> ' ;
192
+ } else {
193
+ $ html .=
194
+ '<tr> ' .
195
+ '<td class="old" colspan="2"> ' . $ oldLine . '</td> ' .
196
+ '</tr> ' ;
197
+ }
177
198
}
178
199
179
200
return $ html ;
0 commit comments