|
60 | 60 | <?php |
61 | 61 |
|
62 | 62 | // demo the no-inline-detail diff |
63 | | - $result = DiffHelper::calculate( |
| 63 | + $inlineResult = DiffHelper::calculate( |
64 | 64 | $oldFile, |
65 | 65 | $newFile, |
66 | 66 | 'Inline', |
67 | 67 | $diffOptions, |
68 | 68 | ['detailLevel' => 'none'] + $rendererOptions |
69 | 69 | ); |
70 | 70 |
|
71 | | - echo $result; |
| 71 | + echo $inlineResult; |
72 | 72 |
|
73 | 73 | ?> |
74 | 74 |
|
75 | 75 | <h1>Line-level Diff (Default)</h1> |
76 | 76 | <?php |
77 | 77 |
|
78 | 78 | // demo the word-level diff |
79 | | - $result = DiffHelper::calculate( |
| 79 | + $inlineResult = DiffHelper::calculate( |
80 | 80 | $oldFile, |
81 | 81 | $newFile, |
82 | 82 | 'Inline', |
83 | 83 | $diffOptions, |
84 | 84 | ['detailLevel' => 'line'] + $rendererOptions |
85 | 85 | ); |
86 | 86 |
|
87 | | - echo $result; |
| 87 | + echo $inlineResult; |
88 | 88 |
|
89 | 89 | ?> |
90 | 90 |
|
91 | 91 | <h1>Word-level Diff</h1> |
92 | 92 | <?php |
93 | 93 |
|
94 | 94 | // demo the word-level diff |
95 | | - $result = DiffHelper::calculate( |
| 95 | + $inlineResult = DiffHelper::calculate( |
96 | 96 | $oldFile, |
97 | 97 | $newFile, |
98 | 98 | 'Inline', |
99 | 99 | $diffOptions, |
100 | 100 | ['detailLevel' => 'word'] + $rendererOptions |
101 | 101 | ); |
102 | 102 |
|
103 | | - echo $result; |
| 103 | + echo $inlineResult; |
104 | 104 |
|
105 | 105 | ?> |
106 | 106 |
|
107 | 107 | <h1>Character-level Diff</h1> |
108 | 108 | <?php |
109 | 109 |
|
110 | 110 | // demo the character-level diff |
111 | | - $result = DiffHelper::calculate( |
| 111 | + $inlineResult = DiffHelper::calculate( |
112 | 112 | $oldFile, |
113 | 113 | $newFile, |
114 | 114 | 'Inline', |
115 | 115 | $diffOptions, |
116 | 116 | ['detailLevel' => 'char'] + $rendererOptions |
117 | 117 | ); |
118 | 118 |
|
119 | | - echo $result; |
| 119 | + echo $inlineResult; |
120 | 120 |
|
121 | 121 | ?> |
122 | 122 |
|
123 | 123 | <h1>Side by Side Diff</h1> |
124 | 124 | <?php |
125 | 125 |
|
126 | 126 | // generate a side by side diff |
127 | | - $result = DiffHelper::calculateFiles( |
| 127 | + $sideBySideResult = DiffHelper::calculateFiles( |
128 | 128 | $oldFilePath, |
129 | 129 | $newFilePath, |
130 | 130 | 'SideBySide', |
131 | 131 | $diffOptions, |
132 | 132 | $rendererOptions |
133 | 133 | ); |
134 | 134 |
|
135 | | - echo $result; |
| 135 | + echo $sideBySideResult; |
136 | 136 |
|
137 | 137 | ?> |
138 | 138 |
|
139 | 139 | <h1>Inline Diff</h1> |
140 | 140 | <?php |
141 | 141 |
|
142 | 142 | // generate an inline diff |
143 | | - $result = DiffHelper::calculateFiles( |
| 143 | + $inlineResult = DiffHelper::calculateFiles( |
144 | 144 | $oldFilePath, |
145 | 145 | $newFilePath, |
146 | 146 | 'Inline', |
147 | 147 | $diffOptions, |
148 | 148 | $rendererOptions |
149 | 149 | ); |
150 | 150 |
|
151 | | - echo $result; |
| 151 | + echo $inlineResult; |
152 | 152 |
|
153 | 153 | ?> |
154 | 154 |
|
155 | 155 | <h1>Unified Diff</h1> |
156 | 156 | <pre><?php |
157 | 157 |
|
158 | 158 | // generate a unified diff |
159 | | - $result = DiffHelper::calculateFiles( |
| 159 | + $unifiedResult = DiffHelper::calculateFiles( |
160 | 160 | $oldFilePath, |
161 | 161 | $newFilePath, |
162 | 162 | 'Unified', |
163 | 163 | $diffOptions, |
164 | 164 | $rendererOptions |
165 | 165 | ); |
166 | 166 |
|
167 | | - echo \htmlspecialchars($result); |
| 167 | + echo \htmlspecialchars($unifiedResult); |
168 | 168 |
|
169 | 169 | ?></pre> |
170 | 170 |
|
171 | 171 | <h1>Context Diff</h1> |
172 | 172 | <pre><?php |
173 | 173 |
|
174 | 174 | // generate a context diff |
175 | | - $result = DiffHelper::calculateFiles( |
| 175 | + $contextResult = DiffHelper::calculateFiles( |
176 | 176 | $oldFilePath, |
177 | 177 | $newFilePath, |
178 | 178 | 'Context', |
179 | 179 | $diffOptions, |
180 | 180 | $rendererOptions |
181 | 181 | ); |
182 | 182 |
|
183 | | - echo \htmlspecialchars($result); |
| 183 | + echo \htmlspecialchars($contextResult); |
184 | 184 |
|
185 | 185 | ?></pre> |
186 | 186 |
|
187 | 187 | <h1>JSON Diff</h1> |
188 | 188 | <pre><?php |
189 | 189 |
|
190 | 190 | // generate a JSON diff |
191 | | - $result = DiffHelper::calculateFiles( |
| 191 | + $jsonResult = DiffHelper::calculateFiles( |
192 | 192 | $oldFilePath, |
193 | 193 | $newFilePath, |
194 | 194 | 'Json', |
|
197 | 197 | ); |
198 | 198 |
|
199 | 199 | $beautified = \json_encode( |
200 | | - \json_decode($result, true), |
| 200 | + \json_decode($jsonResult, true), |
201 | 201 | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES | \JSON_PRETTY_PRINT |
202 | 202 | ); |
203 | 203 |
|
|
0 commit comments