Total Complexity | 12 |
Total Lines | 100 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
20 | final class Line |
||
21 | { |
||
22 | public const ADDED = 1; |
||
23 | public const REMOVED = 2; |
||
24 | public const UNCHANGED = 3; |
||
25 | |||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | private $type; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $content; |
||
35 | |||
36 | /** |
||
37 | * @var int |
||
38 | */ |
||
39 | protected $index; |
||
40 | |||
41 | /** |
||
42 | * Line constructor. |
||
43 | * @param int $type |
||
44 | * @param string $content |
||
45 | * @param int $index |
||
46 | */ |
||
47 | 14 | public function __construct($type = self::UNCHANGED, $content = '', $index = null) |
|
48 | { |
||
49 | 14 | $this->type = $type; |
|
50 | 14 | $this->content = $content; |
|
51 | 14 | $this->index = $index; |
|
52 | 14 | } |
|
53 | |||
54 | /** |
||
55 | * @return int |
||
56 | */ |
||
57 | 13 | public function getIndex() |
|
58 | { |
||
59 | 13 | return $this->index; |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param array $diff |
||
64 | * |
||
65 | * @return Line[] |
||
66 | */ |
||
67 | 13 | public static function createArray($diff) |
|
94 | } |
||
95 | |||
96 | /** |
||
97 | * @return string |
||
98 | */ |
||
99 | 8 | public function getContent(): string |
|
100 | { |
||
101 | 8 | return $this->content; |
|
102 | } |
||
103 | |||
104 | /** |
||
105 | * @return int |
||
106 | */ |
||
107 | 13 | public function getType(): int |
|
110 | } |
||
111 | |||
112 | /** |
||
113 | * @param Line $other |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | 8 | public function isSame(Line $other): bool |
|
120 | } |
||
121 | } |
||
122 |