1 | <?php |
||
15 | class LocalFileService extends AbstractFileService |
||
16 | { |
||
17 | /** |
||
18 | * Write data to a specific relative location |
||
19 | * |
||
20 | * @param mixed $data Data to be written |
||
21 | * @param string $filename File name |
||
22 | * @param string $uploadDir Relative file path |
||
23 | * @return string|false Relative path to created file, false if there were errors |
||
24 | */ |
||
25 | public function write($data, $filename = '', $uploadDir = '') |
||
37 | |||
38 | /** |
||
39 | * Check existing current file in current file system |
||
40 | * @param $filename string Filename |
||
41 | * @return boolean File exists or not |
||
42 | */ |
||
43 | public function exists($filename) |
||
47 | |||
48 | /** |
||
49 | * Read the file from current file system |
||
50 | * @param $filePath string Path to file |
||
51 | * @param $filename string |
||
52 | * @return string |
||
53 | */ |
||
54 | public function read($filePath, $filename = null) |
||
58 | |||
59 | /** |
||
60 | * Delete file from current file system |
||
61 | * @param $filename string File for deleting |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function delete($filename) |
||
68 | |||
69 | /** |
||
70 | * Get file extension in current file system |
||
71 | * @param $filePath string Path |
||
72 | * @return string|bool false if extension not found, otherwise file extension |
||
73 | */ |
||
74 | public function extension($filePath) |
||
78 | |||
79 | /** |
||
80 | * Define if $filePath is directory |
||
81 | * @param string $filePath Path |
||
82 | * @return boolean Is $path a directory or not |
||
83 | */ |
||
84 | public function isDir($filePath) |
||
88 | |||
89 | /** |
||
90 | * Get all entries in $path |
||
91 | * @param string $path Folfer path for listing |
||
92 | * @return array Collection of entries int folder |
||
93 | */ |
||
94 | protected function directoryFiles($path) |
||
106 | |||
107 | /** |
||
108 | * Get recursive $path listing collection |
||
109 | * @param string $path Path for listing contents |
||
110 | * @param array $restrict Collection of restricted paths |
||
111 | * @param array $result Collection of restricted paths |
||
112 | * @return array $path recursive directory listing |
||
113 | */ |
||
114 | public function dir($path, $restrict = array(), & $result = array()) |
||
133 | |||
134 | /** |
||
135 | * Create catalog in selected location |
||
136 | * @param string $path Path for new catalog |
||
137 | * @return boolean Result of catalog creating |
||
138 | */ |
||
139 | public function mkDir($path) |
||
147 | } |
||
148 |