1 | <?php |
||
19 | class Change |
||
20 | { |
||
21 | /** |
||
22 | * Optional file header. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | private $header; |
||
27 | |||
28 | /** |
||
29 | * Pre range ['from' => x, 'to' => y] |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | private $pre; |
||
34 | |||
35 | /** |
||
36 | * Post range ['from' => x, 'to' => y] |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | private $post; |
||
41 | |||
42 | /** |
||
43 | * List of changed lines. |
||
44 | * |
||
45 | * @var \SebastianFeldmann\Git\Diff\Line[] |
||
46 | */ |
||
47 | private $lines = []; |
||
48 | |||
49 | /** |
||
50 | * Chan |
||
51 | * ge constructor. |
||
52 | * |
||
53 | * @param string $ranges |
||
54 | * @param string $header |
||
55 | */ |
||
56 | 12 | public function __construct(string $ranges, string $header = '') |
|
61 | |||
62 | /** |
||
63 | * Header getter. |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 3 | public function getHeader(): string |
|
71 | |||
72 | /** |
||
73 | * Pre range getter. |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | 1 | public function getPre(): array |
|
81 | |||
82 | /** |
||
83 | * Post range getter. |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | 1 | public function getPost(): array |
|
91 | |||
92 | /** |
||
93 | * Return list of changed lines. |
||
94 | * |
||
95 | * @return \SebastianFeldmann\Git\Diff\Line[] |
||
96 | */ |
||
97 | 9 | public function getLines(): array |
|
101 | |||
102 | /** |
||
103 | * Add a line to the change. |
||
104 | * |
||
105 | * @param \SebastianFeldmann\Git\Diff\Line $line |
||
106 | */ |
||
107 | 9 | public function addLine(Line $line) |
|
111 | |||
112 | /** |
||
113 | * Parse ranges and split them into pre and post range. |
||
114 | * |
||
115 | * @param string $ranges |
||
116 | */ |
||
117 | 12 | private function splitRanges(string $ranges) |
|
126 | } |
||
127 |