1 | <?php |
||
20 | class Laravel implements Iface, DirIface, MetaIface |
||
21 | { |
||
22 | private $fs; |
||
23 | private $tempdir; |
||
24 | |||
25 | |||
26 | /** |
||
27 | * Initializes the object |
||
28 | * |
||
29 | * @param \Illuminate\Contracts\Filesystem\Filesystem $fs Laravel file system object |
||
30 | * @param string $tempdir Directory for storing temporary files |
||
31 | */ |
||
32 | public function __construct( \Illuminate\Contracts\Filesystem\Filesystem $fs, $tempdir ) |
||
37 | |||
38 | |||
39 | /** |
||
40 | * Tests if the given path is a directory |
||
41 | * |
||
42 | * @param string $path Path to the file or directory |
||
43 | * @return boolean True if directory, false if not |
||
44 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
45 | */ |
||
46 | public function isdir( $path ) |
||
50 | |||
51 | |||
52 | /** |
||
53 | * Creates a new directory for the given path |
||
54 | * |
||
55 | * @param string $path Path to the directory |
||
56 | * @return void |
||
57 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
58 | */ |
||
59 | public function mkdir( $path ) |
||
67 | |||
68 | |||
69 | /** |
||
70 | * Deletes the directory for the given path |
||
71 | * |
||
72 | * @param string $path Path to the directory |
||
73 | * @return void |
||
74 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
75 | */ |
||
76 | public function rmdir( $path ) |
||
84 | |||
85 | |||
86 | /** |
||
87 | * Returns an iterator over the entries in the given path |
||
88 | * |
||
89 | * {@inheritDoc} |
||
90 | * |
||
91 | * @param string $path Path to the filesystem or directory |
||
92 | * @return \Iterator|array Iterator over the entries or array with entries |
||
93 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
94 | */ |
||
95 | public function scan( $path = null ) |
||
103 | |||
104 | |||
105 | /** |
||
106 | * Returns the file size |
||
107 | * |
||
108 | * @param string $path Path to the file |
||
109 | * @return integer Size in bytes |
||
110 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
111 | */ |
||
112 | public function size( $path ) |
||
120 | |||
121 | |||
122 | /** |
||
123 | * Returns the Unix time stamp for the file |
||
124 | * |
||
125 | * @param string $path Path to the file |
||
126 | * @return integer Unix time stamp in seconds |
||
127 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
128 | */ |
||
129 | public function time( $path ) |
||
137 | |||
138 | |||
139 | /** |
||
140 | * Deletes the file for the given path |
||
141 | * |
||
142 | * @param string $path Path to the file |
||
143 | * @return void |
||
144 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
145 | */ |
||
146 | public function rm( $path ) |
||
154 | |||
155 | |||
156 | /** |
||
157 | * Tests if a file exists at the given path |
||
158 | * |
||
159 | * @param string $path Path to the file |
||
160 | * @return boolean True if it exists, false if not |
||
161 | */ |
||
162 | public function has( $path ) |
||
166 | |||
167 | |||
168 | /** |
||
169 | * Returns the content of the file |
||
170 | * |
||
171 | * {@inheritDoc} |
||
172 | * |
||
173 | * @param string $path Path to the file |
||
174 | * @return string File content |
||
175 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
176 | */ |
||
177 | public function read( $path ) |
||
185 | |||
186 | |||
187 | /** |
||
188 | * Reads the content of the remote file and writes it to a local one |
||
189 | * |
||
190 | * @param string $path Path to the remote file |
||
191 | * @return string Path of the local file |
||
192 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
193 | */ |
||
194 | public function readf( $path ) |
||
206 | |||
207 | |||
208 | /** |
||
209 | * Returns the stream descriptor for the file |
||
210 | * |
||
211 | * {@inheritDoc} |
||
212 | * |
||
213 | * @param string $path Path to the file |
||
214 | * @return resource File stream descriptor |
||
215 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
216 | */ |
||
217 | public function reads( $path ) |
||
239 | |||
240 | |||
241 | /** |
||
242 | * Writes the given content to the file |
||
243 | * |
||
244 | * {@inheritDoc} |
||
245 | * |
||
246 | * @param string $path Path to the file |
||
247 | * @param string $content New file content |
||
248 | * @return void |
||
249 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
250 | */ |
||
251 | public function write( $path, $content ) |
||
259 | |||
260 | |||
261 | /** |
||
262 | * Writes the content of the local file to the remote path |
||
263 | * |
||
264 | * {@inheritDoc} |
||
265 | * |
||
266 | * @param string $path Path to the remote file |
||
267 | * @param string $local Path to the local file |
||
268 | * @return void |
||
269 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
270 | */ |
||
271 | public function writef( $path, $local ) |
||
279 | |||
280 | |||
281 | /** |
||
282 | * Write the content of the stream descriptor into the remote file |
||
283 | * |
||
284 | * {@inheritDoc} |
||
285 | * |
||
286 | * @param string $path Path to the file |
||
287 | * @param resource $stream File stream descriptor |
||
288 | * @return void |
||
289 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
290 | */ |
||
291 | public function writes( $path, $stream ) |
||
304 | |||
305 | |||
306 | /** |
||
307 | * Renames a file, moves it to a new location or both at once |
||
308 | * |
||
309 | * @param string $from Path to the original file |
||
310 | * @param string $to Path to the new file |
||
311 | * @return void |
||
312 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
313 | */ |
||
314 | public function move( $from, $to ) |
||
322 | |||
323 | |||
324 | /** |
||
325 | * Copies a file to a new location |
||
326 | * |
||
327 | * @param string $from Path to the original file |
||
328 | * @param string $to Path to the new file |
||
329 | * @return void |
||
330 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
||
331 | */ |
||
332 | public function copy( $from, $to ) |
||
340 | } |
||
341 |