1 | <?php |
||
5 | class File extends Handler |
||
6 | { |
||
7 | /** |
||
8 | * Check whether the file exists. |
||
9 | * |
||
10 | * @return bool |
||
11 | */ |
||
12 | 3 | public function exists() |
|
16 | |||
17 | /** |
||
18 | * Read the file. |
||
19 | * |
||
20 | * @return string file contents |
||
21 | */ |
||
22 | 24 | public function read() |
|
26 | |||
27 | /** |
||
28 | * Read the file as a stream. |
||
29 | * |
||
30 | * @return resource file stream |
||
31 | */ |
||
32 | 6 | public function readStream() |
|
36 | |||
37 | /** |
||
38 | * Write the new file. |
||
39 | * |
||
40 | * @param string $content |
||
41 | * |
||
42 | * @return bool success boolean |
||
43 | */ |
||
44 | 3 | public function write($content) |
|
48 | |||
49 | /** |
||
50 | * Write the new file using a stream. |
||
51 | * |
||
52 | * @param resource $resource |
||
53 | * |
||
54 | * @return bool success boolean |
||
55 | */ |
||
56 | 3 | public function writeStream($resource) |
|
60 | |||
61 | /** |
||
62 | * Update the file contents. |
||
63 | * |
||
64 | * @param string $content |
||
65 | * |
||
66 | * @return bool success boolean |
||
67 | */ |
||
68 | 6 | public function update($content) |
|
72 | |||
73 | /** |
||
74 | * Update the file contents with a stream. |
||
75 | * |
||
76 | * @param resource $resource |
||
77 | * |
||
78 | * @return bool success boolean |
||
79 | */ |
||
80 | 6 | public function updateStream($resource) |
|
84 | |||
85 | /** |
||
86 | * Create the file or update if exists. |
||
87 | * |
||
88 | * @param string $content |
||
89 | * |
||
90 | * @return bool success boolean |
||
91 | */ |
||
92 | 3 | public function put($content) |
|
96 | |||
97 | /** |
||
98 | * Create the file or update if exists using a stream. |
||
99 | * |
||
100 | * @param resource $resource |
||
101 | * |
||
102 | * @return bool success boolean |
||
103 | */ |
||
104 | 3 | public function putStream($resource) |
|
108 | |||
109 | /** |
||
110 | * Rename the file. |
||
111 | * |
||
112 | * @param string $newpath |
||
113 | * |
||
114 | * @return bool success boolean |
||
115 | */ |
||
116 | 6 | public function rename($newpath) |
|
126 | |||
127 | /** |
||
128 | * Copy the file. |
||
129 | * |
||
130 | * @param string $newpath |
||
131 | * |
||
132 | * @return File|false new file or false |
||
133 | */ |
||
134 | 6 | public function copy($newpath) |
|
142 | |||
143 | /** |
||
144 | * Get the file's timestamp. |
||
145 | * |
||
146 | * @return int unix timestamp |
||
147 | */ |
||
148 | 6 | public function getTimestamp() |
|
152 | |||
153 | /** |
||
154 | * Get the file's mimetype. |
||
155 | * |
||
156 | * @return string mimetime |
||
157 | */ |
||
158 | 6 | public function getMimetype() |
|
162 | |||
163 | /** |
||
164 | * Get the file's visibility. |
||
165 | * |
||
166 | * @return string visibility |
||
167 | */ |
||
168 | 6 | public function getVisibility() |
|
172 | |||
173 | /** |
||
174 | * Get the file's metadata. |
||
175 | * |
||
176 | * @return array |
||
177 | */ |
||
178 | 6 | public function getMetadata() |
|
182 | |||
183 | /** |
||
184 | * Get the file size. |
||
185 | * |
||
186 | * @return int file size |
||
187 | */ |
||
188 | 6 | public function getSize() |
|
192 | |||
193 | /** |
||
194 | * Delete the file. |
||
195 | * |
||
196 | * @return bool success boolean |
||
197 | */ |
||
198 | 6 | public function delete() |
|
202 | } |
||
203 |