1 | <?php |
||
19 | class Filesystem extends \Symfony\Component\Filesystem\Filesystem |
||
20 | { |
||
21 | /** |
||
22 | * Build an absolute file or directory path separated by the OS specific directory separator. |
||
23 | * |
||
24 | * @param string ...$pathFragments |
||
25 | * |
||
26 | * @return string |
||
27 | */ |
||
28 | 54 | public function absolutePath($pathFragments) |
|
45 | |||
46 | /** |
||
47 | * Build a file or directory path separated by the OS specific directory separator. |
||
48 | * |
||
49 | * @param string ...$pathFragments |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | 44 | public function appendPath($pathFragments) |
|
57 | |||
58 | /** |
||
59 | * Copy a file or folder recursively. |
||
60 | * |
||
61 | * @param string $originFile The original filename |
||
62 | * @param string $targetFile The target filename |
||
63 | * @param bool $overwriteNewerFiles If true, target files newer than origin files are overwritten |
||
64 | * |
||
65 | * @throws FileNotFoundException When originFile doesn't exist |
||
66 | * @throws IOException When copy fails |
||
67 | */ |
||
68 | public function copy($originFile, $targetFile, $overwriteNewerFiles = false) |
||
97 | |||
98 | /** |
||
99 | * Create an instance of stakx's File object with relative path information. |
||
100 | * |
||
101 | * @param string $filePath |
||
102 | * |
||
103 | * @return File |
||
104 | */ |
||
105 | public function createFileObject($filePath) |
||
109 | |||
110 | /** |
||
111 | * Strip the current working directory from an absolute path. |
||
112 | * |
||
113 | * @param string $path An absolute path |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | 84 | public function getRelativePath($path) |
|
121 | |||
122 | /** |
||
123 | * Get the name of a given file without the extension. |
||
124 | * |
||
125 | * @param string $filePath A file path |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | 3 | public function getBaseName($filePath) |
|
133 | |||
134 | /** |
||
135 | * Get the name of a given file. |
||
136 | * |
||
137 | * @param string $filePath A file path |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | 1 | public function getFileName($filePath) |
|
142 | { |
||
143 | 1 | return pathinfo($filePath, PATHINFO_BASENAME); |
|
144 | } |
||
145 | |||
146 | /** |
||
147 | * Get the parent directory of a given file. |
||
148 | * |
||
149 | * @param string $filePath A file path |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | 15 | public function getFolderPath($filePath) |
|
157 | |||
158 | /** |
||
159 | * Get the extension of a given file. |
||
160 | * |
||
161 | * @param string $filename A file path |
||
162 | * |
||
163 | * @return string The extension of the file |
||
164 | */ |
||
165 | 35 | public function getExtension($filename) |
|
169 | |||
170 | /** |
||
171 | * Check whether or not if a given path is a directory. |
||
172 | * |
||
173 | * @param string $folderPath |
||
174 | * |
||
175 | * @return bool |
||
176 | */ |
||
177 | public function isDir($folderPath) |
||
181 | |||
182 | /** |
||
183 | * Check whether or not a given path is a file. |
||
184 | * |
||
185 | * @param string $filePath |
||
186 | * |
||
187 | * @return bool |
||
188 | */ |
||
189 | public function isFile($filePath) |
||
193 | |||
194 | /** |
||
195 | * Check whether a given file path is a symlink. |
||
196 | * |
||
197 | * @param string $filePath |
||
198 | * |
||
199 | * @return bool |
||
200 | */ |
||
201 | public function isSymlink($filePath) |
||
205 | |||
206 | /** |
||
207 | * Get the full path to the file without the extension. |
||
208 | * |
||
209 | * @param string $filename A file path |
||
210 | * |
||
211 | * @return string |
||
212 | */ |
||
213 | 3 | public function removeExtension($filename) |
|
220 | |||
221 | 6 | public function path($path) |
|
225 | |||
226 | 2 | public function getInternalResource($name) |
|
232 | |||
233 | /** |
||
234 | * A vfsStream friendly way of getting the realpath() of something. |
||
235 | * |
||
236 | * @param string $path |
||
237 | * |
||
238 | * @return string |
||
239 | */ |
||
240 | 178 | public function realpath($path) |
|
244 | |||
245 | /** |
||
246 | * Check whether a given path is on the virtual filesystem. |
||
247 | * |
||
248 | * @param string $path |
||
249 | * |
||
250 | * @return bool |
||
251 | */ |
||
252 | 184 | public function isVFS($path) |
|
256 | } |
||
257 |