@@ -122,15 +122,15 @@ protected function renderTableEqual(array $change): string
122122 {
123123 $ html = '' ;
124124
125- foreach ($ change ['base ' ]['lines ' ] as $ no => $ line ) {
126- $ oldLineNum = $ change ['base ' ]['offset ' ] + $ no + 1 ;
127- $ newLine = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
125+ foreach ($ change ['old ' ]['lines ' ] as $ no => $ line ) {
126+ $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
127+ $ newLine = $ change ['new ' ]['offset ' ] + $ no + 1 ;
128128
129129 $ html .=
130130 '<tr> ' .
131- '<th class="f-num "> ' . $ oldLineNum . '</th> ' .
131+ '<th class="n-old "> ' . $ oldLineNum . '</th> ' .
132132 '<td class="old"> ' . $ line . '</td> ' .
133- '<th class="t-num "> ' . $ newLine . '</th> ' .
133+ '<th class="n-new "> ' . $ newLine . '</th> ' .
134134 '<td class="new"> ' . $ line . '</td> ' .
135135 '</tr> ' ;
136136 }
@@ -149,14 +149,14 @@ protected function renderTableInsert(array $change): string
149149 {
150150 $ html = '' ;
151151
152- foreach ($ change ['changed ' ]['lines ' ] as $ no => $ newLine ) {
153- $ newLineNum = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
152+ foreach ($ change ['new ' ]['lines ' ] as $ no => $ newLine ) {
153+ $ newLineNum = $ change ['new ' ]['offset ' ] + $ no + 1 ;
154154
155155 $ html .=
156156 '<tr> ' .
157157 '<th></th> ' .
158158 '<td class="old"></td> ' .
159- '<th class="t-num "> ' . $ newLineNum . '</th> ' .
159+ '<th class="n-new "> ' . $ newLineNum . '</th> ' .
160160 '<td class="new"> ' . $ newLine . '</td> ' .
161161 '</tr> ' ;
162162 }
@@ -175,12 +175,12 @@ protected function renderTableDelete(array $change): string
175175 {
176176 $ html = '' ;
177177
178- foreach ($ change ['base ' ]['lines ' ] as $ no => $ oldLine ) {
179- $ oldLineNum = $ change ['base ' ]['offset ' ] + $ no + 1 ;
178+ foreach ($ change ['old ' ]['lines ' ] as $ no => $ oldLine ) {
179+ $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
180180
181181 $ html .=
182182 '<tr> ' .
183- '<th class="f-num "> ' . $ oldLineNum . '</th> ' .
183+ '<th class="n-old "> ' . $ oldLineNum . '</th> ' .
184184 '<td class="old"> ' . $ oldLine . '</td> ' .
185185 '<th></th> ' .
186186 '<td class="new"></td> ' .
@@ -201,43 +201,43 @@ protected function renderTableReplace(array $change): string
201201 {
202202 $ html = '' ;
203203
204- if (\count ($ change ['base ' ]['lines ' ]) >= \count ($ change ['changed ' ]['lines ' ])) {
205- foreach ($ change ['base ' ]['lines ' ] as $ no => $ oldLine ) {
206- $ oldLineNum = $ change ['base ' ]['offset ' ] + $ no + 1 ;
204+ if (\count ($ change ['old ' ]['lines ' ]) >= \count ($ change ['new ' ]['lines ' ])) {
205+ foreach ($ change ['old ' ]['lines ' ] as $ no => $ oldLine ) {
206+ $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
207207
208- if (isset ($ change ['changed ' ]['lines ' ][$ no ])) {
209- $ newLineNum = $ change ['base ' ]['offset ' ] + $ no + 1 ;
210- $ newLine = '<span> ' . $ change ['changed ' ]['lines ' ][$ no ] . '</span> ' ;
208+ if (isset ($ change ['new ' ]['lines ' ][$ no ])) {
209+ $ newLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
210+ $ newLine = '<span> ' . $ change ['new ' ]['lines ' ][$ no ] . '</span> ' ;
211211 } else {
212212 $ newLineNum = '' ;
213213 $ newLine = '' ;
214214 }
215215
216216 $ html .=
217217 '<tr> ' .
218- '<th class="f-num "> ' . $ oldLineNum . '</th> ' .
218+ '<th class="n-old "> ' . $ oldLineNum . '</th> ' .
219219 '<td class="old"><span> ' . $ oldLine . '</span></td> ' .
220- '<th class="t-num "> ' . $ newLineNum . '</th> ' .
220+ '<th class="n-new "> ' . $ newLineNum . '</th> ' .
221221 '<td class="new"> ' . $ newLine . '</td> ' .
222222 '</tr> ' ;
223223 }
224224 } else {
225- foreach ($ change ['changed ' ]['lines ' ] as $ no => $ newLine ) {
226- $ newLineNum = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
225+ foreach ($ change ['new ' ]['lines ' ] as $ no => $ newLine ) {
226+ $ newLineNum = $ change ['new ' ]['offset ' ] + $ no + 1 ;
227227
228- if (isset ($ change ['base ' ]['lines ' ][$ no ])) {
229- $ oldLineNum = $ change ['base ' ]['offset ' ] + $ no + 1 ;
230- $ oldLine = '<span> ' . $ change ['base ' ]['lines ' ][$ no ] . '</span> ' ;
228+ if (isset ($ change ['old ' ]['lines ' ][$ no ])) {
229+ $ oldLineNum = $ change ['old ' ]['offset ' ] + $ no + 1 ;
230+ $ oldLine = '<span> ' . $ change ['old ' ]['lines ' ][$ no ] . '</span> ' ;
231231 } else {
232232 $ oldLineNum = '' ;
233233 $ oldLine = '' ;
234234 }
235235
236236 $ html .=
237237 '<tr> ' .
238- '<th class="f-num "> ' . $ oldLineNum . '</th> ' .
238+ '<th class="n-old "> ' . $ oldLineNum . '</th> ' .
239239 '<td class="old"><span> ' . $ oldLine . '</span></td> ' .
240- '<th class="t-num "> ' . $ newLineNum . '</th> ' .
240+ '<th class="n-new "> ' . $ newLineNum . '</th> ' .
241241 '<td class="new"> ' . $ newLine . '</td> ' .
242242 '</tr> ' ;
243243 }
0 commit comments