1
1
<?php
2
+
2
3
declare (strict_types=1 );
4
+
3
5
namespace jblond \Diff \Renderer \Html ;
4
6
5
7
/**
@@ -22,7 +24,7 @@ class Inline extends HtmlArray
22
24
*
23
25
* @return string The generated inline diff.
24
26
*/
25
- public function render () : string
27
+ public function render (): string
26
28
{
27
29
$ changes = parent ::render ();
28
30
return parent ::renderHtml ($ changes , $ this );
@@ -35,7 +37,7 @@ public function render() : string
35
37
*
36
38
* @return string Html code representation of the table's header.
37
39
*/
38
- public function generateTableHeader () : string
40
+ public function generateTableHeader (): string
39
41
{
40
42
$ html = '<table class="Differences DifferencesInline"> ' ;
41
43
$ html .= '<thead> ' ;
@@ -53,7 +55,7 @@ public function generateTableHeader() : string
53
55
*
54
56
* @return string Html code representing empty table body.
55
57
*/
56
- public function generateSkippedTable () : string
58
+ public function generateSkippedTable (): string
57
59
{
58
60
$ html = '<tbody class="Skipped"> ' ;
59
61
$ html .= '<th>…</th> ' ;
@@ -69,16 +71,16 @@ public function generateSkippedTable() : string
69
71
* @param array &$change Array with data about changes.
70
72
* @return string Html code representing one or more rows of text with no difference.
71
73
*/
72
- public function generateTableRowsEqual (array &$ change ) : string
74
+ public function generateTableRowsEqual (array &$ change ): string
73
75
{
74
76
$ html = "" ;
75
77
foreach ($ change ['base ' ]['lines ' ] as $ no => $ line ) {
76
78
$ fromLine = $ change ['base ' ]['offset ' ] + $ no + 1 ;
77
79
$ toLine = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
78
80
$ 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> ' ;
82
84
$ html .= '</tr> ' ;
83
85
}
84
86
return $ html ;
@@ -90,15 +92,15 @@ public function generateTableRowsEqual(array &$change) : string
90
92
* @param array &$change Array with data about changes.
91
93
* @return string Html code representing one or more rows of added text.
92
94
*/
93
- public function generateTableRowsInsert (array &$ change ) : string
95
+ public function generateTableRowsInsert (array &$ change ): string
94
96
{
95
97
$ html = "" ;
96
98
foreach ($ change ['changed ' ]['lines ' ] as $ no => $ line ) {
97
99
$ toLine = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
98
100
$ html .= '<tr> ' ;
99
101
$ 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> ' ;
102
104
$ html .= '</tr> ' ;
103
105
}
104
106
return $ html ;
@@ -110,15 +112,15 @@ public function generateTableRowsInsert(array &$change) : string
110
112
* @param array &$change Array with data about changes.
111
113
* @return string Html code representing one or more rows of removed text.
112
114
*/
113
- public function generateTableRowsDelete (array &$ change ) : string
115
+ public function generateTableRowsDelete (array &$ change ): string
114
116
{
115
117
$ html = "" ;
116
118
foreach ($ change ['base ' ]['lines ' ] as $ no => $ line ) {
117
119
$ fromLine = $ change ['base ' ]['offset ' ] + $ no + 1 ;
118
120
$ html .= '<tr> ' ;
119
- $ html .= '<th> ' . $ fromLine. '</th> ' ;
121
+ $ html .= '<th> ' . $ fromLine . '</th> ' ;
120
122
$ html .= '<th> </th> ' ;
121
- $ html .= '<td class="Left"><del> ' . $ line. '</del> </td> ' ;
123
+ $ html .= '<td class="Left"><del> ' . $ line . '</del> </td> ' ;
122
124
$ html .= '</tr> ' ;
123
125
}
124
126
return $ html ;
@@ -130,25 +132,25 @@ public function generateTableRowsDelete(array &$change) : string
130
132
* @param array &$change Array with data about changes.
131
133
* @return string Html code representing one or more rows of modified.
132
134
*/
133
- public function generateTableRowsReplace (array &$ change ) : string
135
+ public function generateTableRowsReplace (array &$ change ): string
134
136
{
135
137
$ html = "" ;
136
138
137
139
foreach ($ change ['base ' ]['lines ' ] as $ no => $ line ) {
138
140
$ fromLine = $ change ['base ' ]['offset ' ] + $ no + 1 ;
139
141
$ html .= '<tr> ' ;
140
- $ html .= '<th> ' . $ fromLine. '</th> ' ;
142
+ $ html .= '<th> ' . $ fromLine . '</th> ' ;
141
143
$ html .= '<th> </th> ' ;
142
- $ html .= '<td class="Left"><span> ' . $ line. '</span></td> ' ;
144
+ $ html .= '<td class="Left"><span> ' . $ line . '</span></td> ' ;
143
145
$ html .= '</tr> ' ;
144
146
}
145
147
146
148
foreach ($ change ['changed ' ]['lines ' ] as $ no => $ line ) {
147
149
$ toLine = $ change ['changed ' ]['offset ' ] + $ no + 1 ;
148
150
$ html .= '<tr> ' ;
149
151
$ 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> ' ;
152
154
$ html .= '</tr> ' ;
153
155
}
154
156
0 commit comments