1 | <?php |
||
20 | class File |
||
21 | { |
||
22 | const OP_DELETED = 'deleted'; |
||
23 | const OP_CREATED = 'created'; |
||
24 | const OP_MODIFIED = 'modified'; |
||
25 | const OP_RENAMED = 'renamed'; |
||
26 | const OP_COPIED = 'copied'; |
||
27 | |||
28 | /** |
||
29 | * List of changes. |
||
30 | * |
||
31 | * @var \SebastianFeldmann\Git\Diff\Change[] |
||
32 | */ |
||
33 | private $changes = []; |
||
34 | |||
35 | /** |
||
36 | * Filename |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | private $name; |
||
41 | |||
42 | /** |
||
43 | * Operation performed on the file. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | private $operation; |
||
48 | |||
49 | /** |
||
50 | * File constructor. |
||
51 | * |
||
52 | * @param string $name |
||
53 | * @param string $operation |
||
54 | */ |
||
55 | 12 | public function __construct(string $name, string $operation) |
|
60 | |||
61 | /** |
||
62 | * Returns the filename. |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | 1 | public function getName(): string |
|
70 | |||
71 | /** |
||
72 | * Returns the performed operation. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | 8 | public function getOperation(): string |
|
80 | |||
81 | /** |
||
82 | * Returns the list of changes in this file. |
||
83 | * |
||
84 | * @return \SebastianFeldmann\Git\Diff\Change[] |
||
85 | */ |
||
86 | 10 | public function getChanges(): array |
|
90 | |||
91 | /** |
||
92 | * Add a change to the list of changes. |
||
93 | * |
||
94 | * @param \SebastianFeldmann\Git\Diff\Change $change |
||
95 | */ |
||
96 | 9 | public function addChange(Change $change) |
|
100 | } |
||
101 |