11<?php
2+
23declare (strict_types=1 );
4+
35namespace jblond \Diff \Renderer \Html ;
46
57/**
1113 * @author Chris Boulton <[email protected] > 1214 * @copyright (c) 2009 Chris Boulton
1315 * @license New BSD License http://www.opensource.org/licenses/bsd-license.php
14- * @version 1.12
16+ * @version 1.13
1517 * @link https://github.com/JBlond/php-diff
1618 */
1719class Inline extends HtmlArray
@@ -22,7 +24,7 @@ class Inline extends HtmlArray
2224 *
2325 * @return string The generated inline diff.
2426 */
25- public function render () : string
27+ public function render (): string
2628 {
2729 $ changes = parent ::render ();
2830 return parent ::renderHtml ($ changes , $ this );
@@ -35,7 +37,7 @@ public function render() : string
3537 *
3638 * @return string Html code representation of the table's header.
3739 */
38- public function generateTableHeader () : string
40+ public function generateTableHeader (): string
3941 {
4042 $ html = '<table class="Differences DifferencesInline"> ' ;
4143 $ html .= '<thead> ' ;
@@ -53,7 +55,7 @@ public function generateTableHeader() : string
5355 *
5456 * @return string Html code representing empty table body.
5557 */
56- public function generateSkippedTable () : string
58+ public function generateSkippedTable (): string
5759 {
5860 $ html = '<tbody class="Skipped"> ' ;
5961 $ html .= '<th>…</th> ' ;
@@ -69,16 +71,16 @@ public function generateSkippedTable() : string
6971 * @param array &$change Array with data about changes.
7072 * @return string Html code representing one or more rows of text with no difference.
7173 */
72- public function generateTableRowsEqual (array &$ change ) : string
74+ public function generateTableRowsEqual (array &$ change ): string
7375 {
7476 $ html = "" ;
7577 foreach ($ change ['base ' ]['lines ' ] as $ no => $ line ) {
7678 $ fromLine = $ change ['base ' ]['offset ' ] + $ no + 1 ;
7779 $ toLine = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
7880 $ html .= '<tr> ' ;
79- $ html .= '<th> ' . $ fromLine. '</th> ' ;
80- $ html .= '<th> ' . $ toLine. '</th> ' ;
81- $ html .= '<td class="Left"> ' . $ line. '</td> ' ;
81+ $ html .= '<th> ' . $ fromLine . '</th> ' ;
82+ $ html .= '<th> ' . $ toLine . '</th> ' ;
83+ $ html .= '<td class="Left"> ' . $ line . '</td> ' ;
8284 $ html .= '</tr> ' ;
8385 }
8486 return $ html ;
@@ -90,15 +92,15 @@ public function generateTableRowsEqual(array &$change) : string
9092 * @param array &$change Array with data about changes.
9193 * @return string Html code representing one or more rows of added text.
9294 */
93- public function generateTableRowsInsert (array &$ change ) : string
95+ public function generateTableRowsInsert (array &$ change ): string
9496 {
9597 $ html = "" ;
9698 foreach ($ change ['changed ' ]['lines ' ] as $ no => $ line ) {
9799 $ toLine = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
98100 $ html .= '<tr> ' ;
99101 $ html .= '<th> </th> ' ;
100- $ html .= '<th> ' . $ toLine. '</th> ' ;
101- $ html .= '<td class="Right"><ins> ' . $ line. '</ins> </td> ' ;
102+ $ html .= '<th> ' . $ toLine . '</th> ' ;
103+ $ html .= '<td class="Right"><ins> ' . $ line . '</ins> </td> ' ;
102104 $ html .= '</tr> ' ;
103105 }
104106 return $ html ;
@@ -110,15 +112,15 @@ public function generateTableRowsInsert(array &$change) : string
110112 * @param array &$change Array with data about changes.
111113 * @return string Html code representing one or more rows of removed text.
112114 */
113- public function generateTableRowsDelete (array &$ change ) : string
115+ public function generateTableRowsDelete (array &$ change ): string
114116 {
115117 $ html = "" ;
116118 foreach ($ change ['base ' ]['lines ' ] as $ no => $ line ) {
117119 $ fromLine = $ change ['base ' ]['offset ' ] + $ no + 1 ;
118120 $ html .= '<tr> ' ;
119- $ html .= '<th> ' . $ fromLine. '</th> ' ;
121+ $ html .= '<th> ' . $ fromLine . '</th> ' ;
120122 $ html .= '<th> </th> ' ;
121- $ html .= '<td class="Left"><del> ' . $ line. '</del> </td> ' ;
123+ $ html .= '<td class="Left"><del> ' . $ line . '</del> </td> ' ;
122124 $ html .= '</tr> ' ;
123125 }
124126 return $ html ;
@@ -130,25 +132,25 @@ public function generateTableRowsDelete(array &$change) : string
130132 * @param array &$change Array with data about changes.
131133 * @return string Html code representing one or more rows of modified.
132134 */
133- public function generateTableRowsReplace (array &$ change ) : string
135+ public function generateTableRowsReplace (array &$ change ): string
134136 {
135137 $ html = "" ;
136138
137139 foreach ($ change ['base ' ]['lines ' ] as $ no => $ line ) {
138140 $ fromLine = $ change ['base ' ]['offset ' ] + $ no + 1 ;
139141 $ html .= '<tr> ' ;
140- $ html .= '<th> ' . $ fromLine. '</th> ' ;
142+ $ html .= '<th> ' . $ fromLine . '</th> ' ;
141143 $ html .= '<th> </th> ' ;
142- $ html .= '<td class="Left"><span> ' . $ line. '</span></td> ' ;
144+ $ html .= '<td class="Left"><span> ' . $ line . '</span></td> ' ;
143145 $ html .= '</tr> ' ;
144146 }
145147
146148 foreach ($ change ['changed ' ]['lines ' ] as $ no => $ line ) {
147149 $ toLine = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
148150 $ html .= '<tr> ' ;
149151 $ html .= '<th> </th> ' ;
150- $ html .= '<th> ' . $ toLine. '</th> ' ;
151- $ html .= '<td class="Right"><span> ' . $ line. '</span></td> ' ;
152+ $ html .= '<th> ' . $ toLine . '</th> ' ;
153+ $ html .= '<td class="Right"><span> ' . $ line . '</span></td> ' ;
152154 $ html .= '</tr> ' ;
153155 }
154156
0 commit comments