1 | <?php |
||
22 | class Filesystem extends \Symfony\Component\Filesystem\Filesystem |
||
23 | { |
||
24 | /** |
||
25 | * Build an absolute file or directory path separated by the OS specific directory separator. |
||
26 | * |
||
27 | * @param string ...$pathFragments |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | 53 | public function absolutePath($pathFragments) |
|
48 | |||
49 | /** |
||
50 | * Build a file or directory path separated by the OS specific directory separator. |
||
51 | 46 | * |
|
52 | * @param string ...$pathFragments |
||
53 | 46 | * |
|
54 | * @return string |
||
55 | */ |
||
56 | public function appendPath($pathFragments) |
||
60 | |||
61 | /** |
||
62 | * Copy a file or folder recursively. |
||
63 | * |
||
64 | * @param string $originFile The original filename |
||
65 | * @param string $targetFile The target filename |
||
66 | * @param bool $overwriteNewerFiles If true, target files newer than origin files are overwritten |
||
67 | * |
||
68 | * @throws FileNotFoundException When originFile doesn't exist |
||
69 | * @throws IOException When copy fails |
||
70 | */ |
||
71 | public function copy($originFile, $targetFile, $overwriteNewerFiles = false) |
||
100 | |||
101 | /** |
||
102 | * Create an instance of stakx's File object with relative path information. |
||
103 | * |
||
104 | * @param string $filePath |
||
105 | * |
||
106 | * @return File |
||
107 | */ |
||
108 | public function createFileObject($filePath) |
||
112 | |||
113 | /** |
||
114 | * Strip the current working directory from an absolute path. |
||
115 | 84 | * |
|
116 | * @param string $path An absolute path |
||
117 | 84 | * |
|
118 | * @return string |
||
119 | */ |
||
120 | public function getRelativePath($path) |
||
124 | |||
125 | /** |
||
126 | * Get the name of a given file without the extension. |
||
127 | 3 | * |
|
128 | * @param string $filePath A file path |
||
129 | 3 | * |
|
130 | * @return string |
||
131 | */ |
||
132 | public function getBaseName($filePath) |
||
136 | |||
137 | /** |
||
138 | * Get the name of a given file. |
||
139 | * |
||
140 | * @param string $filePath A file path |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | public function getFileName($filePath) |
||
148 | |||
149 | /** |
||
150 | * Get the parent directory of a given file. |
||
151 | 15 | * |
|
152 | * @param string $filePath A file path |
||
153 | 15 | * |
|
154 | * @return string |
||
155 | */ |
||
156 | public function getFolderPath($filePath) |
||
160 | |||
161 | /** |
||
162 | * Get the extension of a given file. |
||
163 | 36 | * |
|
164 | * @param string $filename A file path |
||
165 | 36 | * |
|
166 | * @return string The extension of the file |
||
167 | */ |
||
168 | public function getExtension($filename) |
||
172 | |||
173 | /** |
||
174 | * Check whether or not if a given path is a directory. |
||
175 | * |
||
176 | * @param string $folderPath |
||
177 | * |
||
178 | * @return bool |
||
179 | */ |
||
180 | public function isDir($folderPath) |
||
184 | |||
185 | /** |
||
186 | * Check whether or not a given path is a file. |
||
187 | * |
||
188 | * @param string $filePath |
||
189 | * |
||
190 | * @return bool |
||
191 | */ |
||
192 | public function isFile($filePath) |
||
196 | |||
197 | /** |
||
198 | * Check whether a given file path is a symlink |
||
199 | * |
||
200 | * @param string $filePath |
||
201 | * |
||
202 | * @return bool |
||
203 | */ |
||
204 | public function isSymlink($filePath) |
||
208 | |||
209 | /** |
||
210 | * Only read a file's contents if it's within the current working directory |
||
211 | * |
||
212 | * @param string $filePath |
||
213 | * |
||
214 | * @return bool|string |
||
215 | */ |
||
216 | public function safeReadFile($filePath) |
||
238 | |||
239 | /** |
||
240 | * Get the full path to the file without the extension. |
||
241 | 3 | * |
|
242 | * @param string $filename A file path |
||
243 | 3 | * |
|
244 | 3 | * @return string |
|
245 | 3 | */ |
|
246 | public function removeExtension($filename) |
||
253 | |||
254 | public function path($path) |
||
258 | } |
||
259 |