@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | public function testGetters(): void |
| 19 | 19 | { |
| 20 | - $diff = new RangeDifference(0, 1, 2, 3, 4, 5,6); |
|
| 20 | + $diff = new RangeDifference(0, 1, 2, 3, 4, 5, 6); |
|
| 21 | 21 | |
| 22 | 22 | $this->assertSame(0, $diff->getKind()); |
| 23 | 23 | $this->assertSame(1, $diff->getRightStart()); |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function testGetMaxLength(): void |
| 35 | 35 | { |
| 36 | - $diff = new RangeDifference(0, 1, 2, 3, 4, 5,6); |
|
| 36 | + $diff = new RangeDifference(0, 1, 2, 3, 4, 5, 6); |
|
| 37 | 37 | |
| 38 | 38 | $this->assertSame(6, $diff->getMaxLength()); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function testIsEqual(): void |
| 42 | 42 | { |
| 43 | - $diff1 = new RangeDifference(0, 1, 2, 3, 4, 5,6); |
|
| 44 | - $diff2 = new RangeDifference(0, 1, 2, 3, 4, 5,6); |
|
| 45 | - $diff3 = new RangeDifference(1, 1, 2, 3, 4, 5,6); |
|
| 43 | + $diff1 = new RangeDifference(0, 1, 2, 3, 4, 5, 6); |
|
| 44 | + $diff2 = new RangeDifference(0, 1, 2, 3, 4, 5, 6); |
|
| 45 | + $diff3 = new RangeDifference(1, 1, 2, 3, 4, 5, 6); |
|
| 46 | 46 | |
| 47 | 47 | $this->assertTrue($diff1->isEqual($diff2)); |
| 48 | 48 | $this->assertFalse($diff1->isEqual($diff3)); |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | public function testLineAdditions(): void |
| 19 | 19 | { |
| 20 | - $s1 = 'abc' . PHP_EOL . 'def' . PHP_EOL . 'xyz'; |
|
| 21 | - $s2 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123' . PHP_EOL . 'xyz'; |
|
| 20 | + $s1 = 'abc'.PHP_EOL.'def'.PHP_EOL.'xyz'; |
|
| 21 | + $s2 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123'.PHP_EOL.'xyz'; |
|
| 22 | 22 | |
| 23 | 23 | $l1 = TextLineLCS::getTextLines($s1); |
| 24 | 24 | $l2 = TextLineLCS::getTextLines($s2); |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function testLineDeletion(): void |
| 40 | 40 | { |
| 41 | - $s1 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123' . PHP_EOL . 'xyz'; |
|
| 42 | - $s2 = 'abc' . PHP_EOL . 'def' . PHP_EOL . 'xyz'; |
|
| 41 | + $s1 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123'.PHP_EOL.'xyz'; |
|
| 42 | + $s2 = 'abc'.PHP_EOL.'def'.PHP_EOL.'xyz'; |
|
| 43 | 43 | |
| 44 | 44 | $l1 = TextLineLCS::getTextLines($s1); |
| 45 | 45 | $l2 = TextLineLCS::getTextLines($s2); |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function testLineAppendEnd(): void |
| 67 | 67 | { |
| 68 | - $s1 = 'abc' . PHP_EOL . 'def'; |
|
| 69 | - $s2 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123'; |
|
| 68 | + $s1 = 'abc'.PHP_EOL.'def'; |
|
| 69 | + $s2 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123'; |
|
| 70 | 70 | |
| 71 | 71 | $l1 = TextLineLCS::getTextLines($s1); |
| 72 | 72 | $l2 = TextLineLCS::getTextLines($s2); |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function testLineDeleteEnd(): void |
| 93 | 93 | { |
| 94 | - $s1 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123'; |
|
| 95 | - $s2 = 'abc' . PHP_EOL . 'def'; |
|
| 94 | + $s1 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123'; |
|
| 95 | + $s2 = 'abc'.PHP_EOL.'def'; |
|
| 96 | 96 | |
| 97 | 97 | $l1 = TextLineLCS::getTextLines($s1); |
| 98 | 98 | $l2 = TextLineLCS::getTextLines($s2); |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | public function testLineAppendStart(): void |
| 119 | 119 | { |
| 120 | - $s1 = 'abc' . PHP_EOL . 'def'; |
|
| 121 | - $s2 = '123' . PHP_EOL . 'abc' . PHP_EOL . 'def'; |
|
| 120 | + $s1 = 'abc'.PHP_EOL.'def'; |
|
| 121 | + $s2 = '123'.PHP_EOL.'abc'.PHP_EOL.'def'; |
|
| 122 | 122 | |
| 123 | 123 | $l1 = TextLineLCS::getTextLines($s1); |
| 124 | 124 | $l2 = TextLineLCS::getTextLines($s2); |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | public function testLineDeleteStart(): void |
| 145 | 145 | { |
| 146 | - $s1 = '123' . PHP_EOL . 'abc' . PHP_EOL . 'def'; |
|
| 147 | - $s2 = 'abc' . PHP_EOL . 'def'; |
|
| 146 | + $s1 = '123'.PHP_EOL.'abc'.PHP_EOL.'def'; |
|
| 147 | + $s2 = 'abc'.PHP_EOL.'def'; |
|
| 148 | 148 | |
| 149 | 149 | $l1 = TextLineLCS::getTextLines($s1); |
| 150 | 150 | $l2 = TextLineLCS::getTextLines($s2); |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | $begin = $end + 1; |
| 154 | 154 | $end = static::getEOL($text, $begin); |
| 155 | 155 | |
| 156 | - if ($end === $begin && "\r" === \mb_substr($text, $begin - 1, 1) && "\n" === \mb_substr($text, $begin, 1)) { |
|
| 156 | + if ($end === $begin && "\r" === \mb_substr($text, $begin - 1, 1) && "\n" === \mb_substr($text, $begin, 1)) { |
|
| 157 | 157 | // We have \r followed by \n, skip it. |
| 158 | 158 | $begin = $end + 1; |
| 159 | 159 | $end = static::getEOL($text, $begin); |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $this->maxDifferences = (int)(($length1 + $length2 + 1) / 2); |
|
| 58 | + $this->maxDifferences = (int) (($length1 + $length2 + 1) / 2); |
|
| 59 | 59 | |
| 60 | 60 | if ($length1 * $length2 > self::TOO_LONG) { |
| 61 | 61 | // Limit complexity to D^POW_LIMIT for long sequences. |
| 62 | - $this->maxDifferences = (int)\pow($this->maxDifferences, self::POW_LIMIT - 1.0); |
|
| 62 | + $this->maxDifferences = (int) \pow($this->maxDifferences, self::POW_LIMIT - 1.0); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $this->initializeLcs($length1); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $delta = $N - $M; |
| 170 | 170 | $isEven = ($delta & 1) === 1 ? false : true; |
| 171 | 171 | |
| 172 | - $limit = \min($this->maxDifferences, (int)(($N + $M + 1) / 2)); |
|
| 172 | + $limit = \min($this->maxDifferences, (int) (($N + $M + 1) / 2)); |
|
| 173 | 173 | |
| 174 | 174 | // Offset to make it odd/even. |
| 175 | 175 | // a 0 or 1 that we add to the start offset to make it odd/even |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | $maxProgress = array_fill( |
| 318 | 318 | 0, |
| 319 | - (int)(\max($forwardEndDiag - $forwardStartDiag, $backwardEndDiag - $backwardStartDiag) / 2 + 1), |
|
| 319 | + (int) (\max($forwardEndDiag - $forwardStartDiag, $backwardEndDiag - $backwardStartDiag) / 2 + 1), |
|
| 320 | 320 | [0, 0, 0]); |
| 321 | 321 | // The first entry is current, it is initialized with 0s. |
| 322 | 322 | $numProgress = 0; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - return $maxProgress[(int)($numProgress / 2)]; |
|
| 376 | + return $maxProgress[(int) ($numProgress / 2)]; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /** |
@@ -224,7 +224,7 @@ |
||
| 224 | 224 | */ |
| 225 | 225 | $nextLine = $lcsSide[$i - 1] + 1; |
| 226 | 226 | |
| 227 | - if ($nextLine !== $lcsSide[$j] && $comparator->rangesEqual($nextLine - 1, $comparator, $lcsSide[$j] -1)) { |
|
| 227 | + if ($nextLine !== $lcsSide[$j] && $comparator->rangesEqual($nextLine - 1, $comparator, $lcsSide[$j] - 1)) { |
|
| 228 | 228 | $lcsSide[$i] = $nextLine; |
| 229 | 229 | } else { |
| 230 | 230 | $lcsSide[$i] = $lcsSide[$j]; |