1 | <?php |
||
8 | class Util |
||
9 | { |
||
10 | /** |
||
11 | * Get normalized pathinfo. |
||
12 | * |
||
13 | * @param string $path |
||
14 | * |
||
15 | * @return array pathinfo |
||
16 | */ |
||
17 | 12 | public static function pathinfo($path) |
|
25 | |||
26 | /** |
||
27 | * Normalize a dirname return value. |
||
28 | * |
||
29 | * @param string $dirname |
||
30 | * |
||
31 | * @return string normalized dirname |
||
32 | */ |
||
33 | 36 | public static function normalizeDirname($dirname) |
|
37 | |||
38 | /** |
||
39 | * Get a normalized dirname from a path. |
||
40 | * |
||
41 | * @param string $path |
||
42 | * |
||
43 | * @return string dirname |
||
44 | */ |
||
45 | 33 | public static function dirname($path) |
|
49 | |||
50 | /** |
||
51 | * Map result arrays. |
||
52 | * |
||
53 | * @param array $object |
||
54 | * @param array $map |
||
55 | * |
||
56 | * @return array mapped result |
||
57 | */ |
||
58 | 6 | public static function map(array $object, array $map) |
|
72 | |||
73 | /** |
||
74 | * Normalize path. |
||
75 | * |
||
76 | * @param string $path |
||
77 | * |
||
78 | * @throws LogicException |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 252 | public static function normalizePath($path) |
|
99 | |||
100 | /** |
||
101 | * Normalize relative directories in a path. |
||
102 | * |
||
103 | * @param string $path |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | 252 | public static function normalizeRelativePath($path) |
|
121 | |||
122 | /** |
||
123 | * Normalize prefix. |
||
124 | * |
||
125 | * @param string $prefix |
||
126 | * @param string $separator |
||
127 | * |
||
128 | * @return string normalized path |
||
129 | */ |
||
130 | 3 | public static function normalizePrefix($prefix, $separator) |
|
134 | |||
135 | /** |
||
136 | * Get content size. |
||
137 | * |
||
138 | * @param string $contents |
||
139 | * |
||
140 | * @return int content size |
||
141 | */ |
||
142 | 3 | public static function contentSize($contents) |
|
146 | |||
147 | /** |
||
148 | * Guess MIME Type based on the path of the file and it's content. |
||
149 | * |
||
150 | * @param string $path |
||
151 | * @param string|resource $content |
||
152 | * |
||
153 | * @return string|null MIME Type or NULL if no extension detected |
||
154 | */ |
||
155 | 27 | public static function guessMimeType($path, $content) |
|
165 | |||
166 | /** |
||
167 | * Emulate directories. |
||
168 | * |
||
169 | * @param array $listing |
||
170 | * |
||
171 | * @return array listing with emulated directories |
||
172 | */ |
||
173 | 3 | public static function emulateDirectories(array $listing) |
|
194 | |||
195 | /** |
||
196 | * Ensure a Config instance. |
||
197 | * |
||
198 | * @param null|array|Config $config |
||
199 | * |
||
200 | * @return Config config instance |
||
201 | * |
||
202 | * @throw LogicException |
||
203 | */ |
||
204 | 6 | public static function ensureConfig($config) |
|
220 | |||
221 | /** |
||
222 | * Rewind a stream. |
||
223 | * |
||
224 | * @param resource $resource |
||
225 | */ |
||
226 | 36 | public static function rewindStream($resource) |
|
232 | |||
233 | 18 | public static function isSeekableStream($resource) |
|
239 | |||
240 | /** |
||
241 | * Get the size of a stream. |
||
242 | * |
||
243 | * @param resource $resource |
||
244 | * |
||
245 | * @return int stream size |
||
246 | */ |
||
247 | 3 | public static function getStreamSize($resource) |
|
253 | |||
254 | /** |
||
255 | * Emulate the directories of a single object. |
||
256 | * |
||
257 | * @param array $object |
||
258 | * @param array $directories |
||
259 | * @param array $listedDirectories |
||
260 | * |
||
261 | * @return array |
||
262 | */ |
||
263 | 3 | protected static function emulateObjectDirectories(array $object, array $directories, array $listedDirectories) |
|
288 | } |
||
289 |