1 | <?php |
||
8 | class File { |
||
9 | |||
10 | const STATUS_UNKNOWN = 0; |
||
11 | |||
12 | const STATUS_ADDED = 1; |
||
13 | |||
14 | const STATUS_COPIED = 2; |
||
15 | |||
16 | const STATUS_MODIFIED = 3; |
||
17 | |||
18 | const STATUS_RENAMED = 4; |
||
19 | |||
20 | const STATUS_DELETED = 5; |
||
21 | |||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | private static $statusMap = [ |
||
27 | self::STATUS_UNKNOWN => 'unknown', |
||
28 | self::STATUS_ADDED => 'added', |
||
29 | self::STATUS_COPIED => 'copied', |
||
30 | self::STATUS_MODIFIED => 'modified', |
||
31 | self::STATUS_RENAMED => 'renamed', |
||
32 | self::STATUS_DELETED => 'deleted', |
||
33 | ]; |
||
34 | |||
35 | /** |
||
36 | * The full path to the file |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | private $path; |
||
41 | |||
42 | /** |
||
43 | * The files status |
||
44 | * |
||
45 | * @var int |
||
46 | */ |
||
47 | private $status; |
||
48 | |||
49 | |||
50 | /** |
||
51 | * @var FileContent |
||
52 | */ |
||
53 | private $content; |
||
54 | |||
55 | |||
56 | /** |
||
57 | * Initializes a new instance of the File class. |
||
58 | * |
||
59 | * @param string $status |
||
60 | * @param string $filePath |
||
61 | */ |
||
62 | 24 | public function __construct($filePath, $status) { |
|
70 | |||
71 | |||
72 | /** |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getName() { |
||
78 | |||
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | */ |
||
83 | public function getExtension() { |
||
86 | |||
87 | |||
88 | /** |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getStatus() { |
||
94 | |||
95 | |||
96 | /** |
||
97 | * @return string |
||
98 | */ |
||
99 | public function getStatusName() { |
||
102 | |||
103 | |||
104 | /** |
||
105 | * Return empty mime type on deleted file |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getMimeType() { |
||
115 | |||
116 | |||
117 | /** |
||
118 | * @return string |
||
119 | */ |
||
120 | public function getPath() { |
||
123 | |||
124 | |||
125 | /** |
||
126 | * @return FileContent |
||
127 | */ |
||
128 | 24 | public function getContent() { |
|
136 | |||
137 | |||
138 | /** |
||
139 | * Save content to the file |
||
140 | * Perform this action only if content was changed |
||
141 | * @void |
||
142 | */ |
||
143 | public function save() { |
||
149 | |||
150 | } |
||
151 |