1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* GitElephant - An abstraction layer for git written in PHP |
4
|
|
|
* Copyright (C) 2013 Matteo Giachino |
5
|
|
|
* |
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU General Public License as published by |
8
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
9
|
|
|
* (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU General Public License |
17
|
|
|
* along with this program. If not, see [http://www.gnu.org/licenses/]. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace GitElephant\Objects\Diff; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* A single line in the DiffChunk |
24
|
|
|
* |
25
|
|
|
* @author Matteo Giachino <[email protected]> |
26
|
|
|
*/ |
27
|
|
|
abstract class DiffChunkLine |
28
|
|
|
{ |
29
|
|
|
const UNCHANGED = "unchanged"; |
30
|
|
|
const ADDED = "added"; |
31
|
|
|
const DELETED = "deleted"; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* line type |
35
|
|
|
* |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
protected $type; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* line content |
42
|
|
|
* |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $content; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* toString magic method |
49
|
|
|
* |
50
|
|
|
* @return string the line content |
51
|
|
|
*/ |
52
|
|
|
public function __toString() |
53
|
|
|
{ |
54
|
|
|
return $this->getContent(); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* type setter |
59
|
|
|
* |
60
|
|
|
* @param string $type line type |
61
|
|
|
*/ |
62
|
2 |
|
public function setType($type) |
63
|
|
|
{ |
64
|
2 |
|
$this->type = $type; |
65
|
2 |
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* type getter |
69
|
|
|
* |
70
|
|
|
* @return mixed |
71
|
|
|
*/ |
72
|
|
|
public function getType() |
73
|
|
|
{ |
74
|
|
|
return $this->type; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* content setter |
79
|
|
|
* |
80
|
|
|
* @param string $content line content |
81
|
|
|
*/ |
82
|
2 |
|
public function setContent($content) |
83
|
|
|
{ |
84
|
2 |
|
$this->content = $content; |
85
|
2 |
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* content getter |
89
|
|
|
* |
90
|
|
|
* @return mixed |
91
|
|
|
*/ |
92
|
|
|
public function getContent() |
93
|
|
|
{ |
94
|
|
|
return $this->content; |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|