Exception
1 year ago
Output
1 year ago
Chunk.php
1 year ago
Diff.php
1 year ago
Differ.php
1 year ago
Line.php
1 year ago
LongestCommonSubsequenceCalculator.php
1 year ago
MemoryEfficientLongestCommonSubsequenceCalculator.php
1 year ago
Parser.php
1 year ago
TimeEfficientLongestCommonSubsequenceCalculator.php
1 year ago
Chunk.php
90 lines
| 1 | <?php declare(strict_types=1); |
| 2 | /* |
| 3 | * This file is part of sebastian/diff. |
| 4 | * |
| 5 | * (c) Sebastian Bergmann <sebastian@phpunit.de> |
| 6 | * |
| 7 | * For the full copyright and license information, please view the LICENSE |
| 8 | * file that was distributed with this source code. |
| 9 | */ |
| 10 | namespace SebastianBergmann\Diff; |
| 11 | |
| 12 | final class Chunk |
| 13 | { |
| 14 | /** |
| 15 | * @var int |
| 16 | */ |
| 17 | private $start; |
| 18 | |
| 19 | /** |
| 20 | * @var int |
| 21 | */ |
| 22 | private $startRange; |
| 23 | |
| 24 | /** |
| 25 | * @var int |
| 26 | */ |
| 27 | private $end; |
| 28 | |
| 29 | /** |
| 30 | * @var int |
| 31 | */ |
| 32 | private $endRange; |
| 33 | |
| 34 | /** |
| 35 | * @var Line[] |
| 36 | */ |
| 37 | private $lines; |
| 38 | |
| 39 | public function __construct(int $start = 0, int $startRange = 1, int $end = 0, int $endRange = 1, array $lines = []) |
| 40 | { |
| 41 | $this->start = $start; |
| 42 | $this->startRange = $startRange; |
| 43 | $this->end = $end; |
| 44 | $this->endRange = $endRange; |
| 45 | $this->lines = $lines; |
| 46 | } |
| 47 | |
| 48 | public function getStart(): int |
| 49 | { |
| 50 | return $this->start; |
| 51 | } |
| 52 | |
| 53 | public function getStartRange(): int |
| 54 | { |
| 55 | return $this->startRange; |
| 56 | } |
| 57 | |
| 58 | public function getEnd(): int |
| 59 | { |
| 60 | return $this->end; |
| 61 | } |
| 62 | |
| 63 | public function getEndRange(): int |
| 64 | { |
| 65 | return $this->endRange; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @return Line[] |
| 70 | */ |
| 71 | public function getLines(): array |
| 72 | { |
| 73 | return $this->lines; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @param Line[] $lines |
| 78 | */ |
| 79 | public function setLines(array $lines): void |
| 80 | { |
| 81 | foreach ($lines as $line) { |
| 82 | if (!$line instanceof Line) { |
| 83 | throw new InvalidArgumentException; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | $this->lines = $lines; |
| 88 | } |
| 89 | } |
| 90 |