@@ -80,7 +80,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |