1 | <?php |
||
12 | class FileManager implements FileManagerInterface |
||
13 | { |
||
14 | /** |
||
15 | * Wrapper for reading file. |
||
16 | * |
||
17 | * @param string $file Full path to file |
||
18 | * |
||
19 | * @return string Asset content |
||
20 | */ |
||
21 | 1 | public function read($file) |
|
25 | |||
26 | /** |
||
27 | * Wrapper for writing file. |
||
28 | * |
||
29 | * @param string $asset Full path to file |
||
30 | * |
||
31 | * @param string $content Asset content |
||
32 | */ |
||
33 | 1 | public function write($asset, $content) |
|
42 | |||
43 | /** |
||
44 | * Create folder. |
||
45 | * |
||
46 | * @param string $path Full path to asset |
||
47 | * |
||
48 | * @throws \Exception |
||
49 | */ |
||
50 | 1 | public function mkdir($path) |
|
61 | |||
62 | /** |
||
63 | * If path(file or folder) exists. |
||
64 | * |
||
65 | * @param string $path Path for validating existence |
||
66 | * |
||
67 | * @return bool True if path exists |
||
68 | */ |
||
69 | 1 | public function exists($path) |
|
73 | |||
74 | /** |
||
75 | * Wrapper for touching file. |
||
76 | * |
||
77 | * @param string $asset Full path to file |
||
78 | * @param int $timestamp Timestamp |
||
79 | */ |
||
80 | public function touch($asset, $timestamp) |
||
85 | |||
86 | /** |
||
87 | * Remove path/file recursively. |
||
88 | * |
||
89 | * @param string $path Path to be removed |
||
90 | */ |
||
91 | public function remove($path) |
||
106 | |||
107 | /** |
||
108 | * Get last file modification timestamp. |
||
109 | * |
||
110 | * @param string $file Path to file |
||
111 | * |
||
112 | * @return int File modification timestamp |
||
113 | */ |
||
114 | public function lastModified($file) |
||
118 | |||
119 | /** |
||
120 | * Recursively scan collection of paths to find files with passed |
||
121 | * extensions. Method is based on linux find command so this method |
||
122 | * can face difficulties on other OS. |
||
123 | * |
||
124 | * |
||
125 | * @param array $paths Paths for files scanning |
||
126 | * @param array $extensions File extension filter |
||
127 | * @param array $excludeFolders Path patterns for excluding |
||
128 | * |
||
129 | * @return array Found files |
||
130 | */ |
||
131 | 1 | public function scan(array $paths, array $extensions, array $excludeFolders = []) |
|
152 | } |
||
153 |