Passed
Push — master ( b940c0...ebe8d1 )
by Sebastian
02:34
created
src/Diff/Styler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         $folder = sprintf(__DIR__.'/../../css/%s', $this->fileName);
42 42
         $path = realpath($folder);
43 43
         
44
-        if($path === false)
44
+        if ($path === false)
45 45
         {
46 46
             throw new DiffException(
47 47
                 'Could not find the highlight CSS file',
Please login to merge, or discard this patch.
src/Diff/Renderer/HTML.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
             switch ($line[1])
49 49
             {
50 50
                 case Diff::UNMODIFIED : $element = 'span'; break;
51
-                case Diff::DELETED    : $element = 'del';  break;
52
-                case Diff::INSERTED   : $element = 'ins';  break;
51
+                case Diff::DELETED    : $element = 'del'; break;
52
+                case Diff::INSERTED   : $element = 'ins'; break;
53 53
             }
54 54
             
55 55
             $html .= sprintf(
Please login to merge, or discard this patch.
src/Diff/Renderer/PlainText.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
             // extend the string with the line
37 37
             switch ($line[1])
38 38
             {
39
-                case Diff::UNMODIFIED : $string .= '  ' . $line[0];break;
40
-                case Diff::DELETED    : $string .= '- ' . $line[0];break;
41
-                case Diff::INSERTED   : $string .= '+ ' . $line[0];break;
39
+                case Diff::UNMODIFIED : $string .= '  '.$line[0]; break;
40
+                case Diff::DELETED    : $string .= '- '.$line[0]; break;
41
+                case Diff::INSERTED   : $string .= '+ '.$line[0]; break;
42 42
             }
43 43
             
44 44
             // extend the string with the separator
Please login to merge, or discard this patch.
src/Diff/Renderer/HTMLTable.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -149,24 +149,24 @@  discard block
 block discarded – undo
149 149
             
150 150
             // extend the HTML with the new row
151 151
             $html .=
152
-            $i2. "<tr>". $nl . 
153
-            $i3.     '<td class="text-diff-'.$leftType. '">'. $leftCell . "</td>".$nl.
154
-            $i3.     '<td class="text-diff-'.$rightType. '">'. $rightCell . "</td>".$nl.
155
-            $i2. "</tr>".$nl;
152
+            $i2."<tr>".$nl. 
153
+            $i3.'<td class="text-diff-'.$leftType.'">'.$leftCell."</td>".$nl.
154
+            $i3.'<td class="text-diff-'.$rightType.'">'.$rightCell."</td>".$nl.
155
+            $i2."</tr>".$nl;
156 156
                                                 
157 157
         }
158 158
         
159
-        return $i1. sprintf($this->container, $nl.$html).$nl;
159
+        return $i1.sprintf($this->container, $nl.$html).$nl;
160 160
     }
161 161
     
162 162
     private function resolveLeftType(string $leftCell, string $rightCell) : string
163 163
     {
164
-        if(empty($leftCell))
164
+        if (empty($leftCell))
165 165
         {
166 166
             return 'empty';
167 167
         }
168 168
         
169
-        else if($leftCell !== $rightCell)
169
+        else if ($leftCell !== $rightCell)
170 170
         {
171 171
             return 'del';
172 172
         }
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
     
177 177
     private function resolveRightType(string $leftCell, string $rightCell) : string
178 178
     {
179
-        if(empty($rightCell))
179
+        if (empty($rightCell))
180 180
         {
181 181
             return 'empty';
182 182
         }
183 183
         
184
-        else if($leftCell !== $rightCell)
184
+        else if ($leftCell !== $rightCell)
185 185
         {
186 186
             return 'ins';
187 187
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                 $this->separator
213 213
             );
214 214
             
215
-            $index ++;
215
+            $index++;
216 216
         }
217 217
         
218 218
         return $html;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     
221 221
     private function resolveTag(int $type) : string
222 222
     {
223
-        switch($type)
223
+        switch ($type)
224 224
         {
225 225
             case Diff::DELETED: return 'del';
226 226
             case Diff::INSERTED: return 'ins';
Please login to merge, or discard this patch.
src/Diff.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     * @param bool $compare
81 81
     * @return Diff
82 82
     */
83
-    public function setCompareCharacters(bool $compare=true) : Diff
83
+    public function setCompareCharacters(bool $compare = true) : Diff
84 84
     {
85 85
         $this->compareCharacters = $compare;
86 86
         
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     */
172 172
     public function toArray() : array
173 173
     {
174
-        if($this->disposed)
174
+        if ($this->disposed)
175 175
         {
176 176
             throw new DiffException(
177 177
                 'The diff has been disposed.',
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
         // skip any common prefix
205 205
         while ($start <= $end1 && $start <= $end2 && $this->sequence1[$start] == $this->sequence2[$start])
206 206
         {
207
-            $start ++;
207
+            $start++;
208 208
         }
209 209
         
210 210
         // skip any common suffix
211 211
         while ($end1 >= $start && $end2 >= $start && $this->sequence1[$end1] == $this->sequence2[$end2])
212 212
         {
213
-            $end1 --;
214
-            $end2 --;
213
+            $end1--;
214
+            $end2--;
215 215
         }
216 216
         
217 217
         // generate the partial diff
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         // generate the full diff
221 221
         $diff = array();
222 222
         
223
-        for ($index = 0; $index < $start; $index ++)
223
+        for ($index = 0; $index < $start; $index++)
224 224
         {
225 225
             $diff[] = array($this->sequence1[$index], self::UNMODIFIED);
226 226
         }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             $diff[] = array_pop($partialDiff);
231 231
         }
232 232
         
233
-        for ($index = $end1 + 1; $index < $totalSequence; $index ++)
233
+        for ($index = $end1 + 1; $index < $totalSequence; $index++)
234 234
         {
235 235
             $diff[] = array($this->sequence1[$index], self::UNMODIFIED);
236 236
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     {
254 254
         $split = preg_split('/\R/', $string);
255 255
         
256
-        if(is_array($split))
256
+        if (is_array($split))
257 257
         {
258 258
             return $split;
259 259
         }
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
         $table = array(array_fill(0, $length2 + 1, 0));
285 285
         
286 286
         // loop over the rows
287
-        for ($index1 = 1; $index1 <= $length1; $index1 ++){
287
+        for ($index1 = 1; $index1 <= $length1; $index1++) {
288 288
             
289 289
             // create the new row
290 290
             $table[$index1] = array(0);
291 291
             
292 292
             // loop over the columns
293
-            for ($index2 = 1; $index2 <= $length2; $index2 ++){
293
+            for ($index2 = 1; $index2 <= $length2; $index2++) {
294 294
                 
295 295
                 // store the longest common subsequence length
296 296
                 if ($this->sequence1[$index1 + $start - 1]
297
-                    == $this->sequence2[$index2 + $start - 1]){
297
+                    == $this->sequence2[$index2 + $start - 1]) {
298 298
                         $table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1;
299
-                }else{
299
+                } else {
300 300
                     $table[$index1][$index2] =
301 301
                     max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]);
302 302
                 }
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
                 $index1 > 0 && $index2 > 0
336 336
                 && $this->sequence1[$index1 + $start - 1]
337 337
                 == $this->sequence2[$index2 + $start - 1]
338
-            ){
338
+            ) {
339 339
                 // update the diff and the indices
340 340
                 $diff[] = array($this->sequence1[$index1 + $start - 1], self::UNMODIFIED);
341
-                $index1 --;
342
-                $index2 --;
341
+                $index1--;
342
+                $index2--;
343 343
             }
344 344
             elseif (
345 345
                 $index2 > 0
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
             ) {
348 348
                 // update the diff and the indices
349 349
                 $diff[] = array($this->sequence2[$index2 + $start - 1], self::INSERTED);
350
-                $index2 --;
350
+                $index2--;
351 351
             }
352 352
             else
353 353
             {
354 354
                 // update the diff and the indices
355 355
                 $diff[] = array($this->sequence1[$index1 + $start - 1], self::DELETED);
356
-                $index1 --;
356
+                $index1--;
357 357
             }
358 358
         }
359 359
         
Please login to merge, or discard this patch.