1 | <?php |
||
31 | class Container |
||
32 | { |
||
33 | /** |
||
34 | * @var Root |
||
35 | */ |
||
36 | protected $root; |
||
37 | |||
38 | /** |
||
39 | * @var Factory |
||
40 | */ |
||
41 | protected $factory; |
||
42 | |||
43 | /** |
||
44 | * @var Wrapper\PermissionHelper |
||
45 | */ |
||
46 | protected $permissionHelper; |
||
47 | |||
48 | /** |
||
49 | * Class constructor. Sets factory and root object on init. |
||
50 | * |
||
51 | * @param Factory $factory |
||
52 | */ |
||
53 | public function __construct(Factory $factory) |
||
59 | |||
60 | /** |
||
61 | * Sets Factory instance |
||
62 | * |
||
63 | * @param \VirtualFileSystem\Factory $factory |
||
64 | */ |
||
65 | public function setFactory($factory) |
||
69 | |||
70 | /** |
||
71 | * Returns Factory instance |
||
72 | * |
||
73 | * @return \VirtualFileSystem\Factory |
||
74 | */ |
||
75 | public function factory() |
||
79 | |||
80 | /** |
||
81 | * Returns Root instance |
||
82 | * |
||
83 | * @return Root |
||
84 | */ |
||
85 | public function root() |
||
89 | |||
90 | /** |
||
91 | * Returns filesystem Node|Directory|File|Root at given path. |
||
92 | * |
||
93 | * @param string $path |
||
94 | * |
||
95 | * @return Structure\Node |
||
96 | * |
||
97 | * @throws NotFoundException |
||
98 | */ |
||
99 | public function nodeAt($path) |
||
114 | |||
115 | /** |
||
116 | * Checks whether filesystem has Node at given path |
||
117 | * |
||
118 | * @param string $path |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function hasNodeAt($path) |
||
132 | |||
133 | /** |
||
134 | * Returns directory at given path |
||
135 | * |
||
136 | * @param string $path |
||
137 | * |
||
138 | * @return Structure\Directory |
||
139 | * |
||
140 | * @throws NotDirectoryException |
||
141 | * @throws NotFoundException |
||
142 | */ |
||
143 | public function directoryAt($path) |
||
153 | |||
154 | /** |
||
155 | * Returns file at given path |
||
156 | * |
||
157 | * @param string $path |
||
158 | * |
||
159 | * @return Structure\File |
||
160 | * |
||
161 | * @throws NotFileException |
||
162 | * @throws NotFoundException |
||
163 | */ |
||
164 | public function fileAt($path) |
||
174 | |||
175 | /** |
||
176 | * Creates Directory at given path. |
||
177 | * |
||
178 | * @param string $path |
||
179 | * @param bool $recursive |
||
180 | * @param null|integer $mode |
||
181 | * |
||
182 | * @return Structure\Directory |
||
183 | * |
||
184 | * @throws NotFoundException |
||
185 | */ |
||
186 | public function createDir($path, $recursive = false, $mode = null) |
||
208 | |||
209 | /** |
||
210 | * Creates link at given path |
||
211 | * |
||
212 | * @param string $path |
||
213 | * @param string $destination |
||
214 | * |
||
215 | * @return Structure\Link |
||
216 | * |
||
217 | */ |
||
218 | public function createLink($path, $destination) |
||
233 | |||
234 | /** |
||
235 | * Creates file at given path |
||
236 | * |
||
237 | * @param string $path |
||
238 | * @param string|null $data |
||
239 | * |
||
240 | * @return Structure\File |
||
241 | * |
||
242 | * @throws \RuntimeException |
||
243 | */ |
||
244 | public function createFile($path, $data = null) |
||
259 | |||
260 | /** |
||
261 | * Creates struture |
||
262 | * |
||
263 | * @param array $structure |
||
264 | * @param string $parent |
||
265 | * @throws NotFoundException |
||
266 | */ |
||
267 | public function createStructure(array $structure, $parent = '/') |
||
278 | |||
279 | /** |
||
280 | * Moves Node from source to destination |
||
281 | * |
||
282 | * @param string $fromPath |
||
283 | * @param string $toPath |
||
284 | * |
||
285 | * @throws \RuntimeException |
||
286 | */ |
||
287 | public function move($fromPath, $toPath) |
||
321 | |||
322 | /** |
||
323 | * Removes node at $path |
||
324 | * |
||
325 | * @param string $path |
||
326 | * @param bool $recursive |
||
327 | * |
||
328 | * @throws \RuntimeException |
||
329 | */ |
||
330 | public function remove($path, $recursive = false) |
||
342 | |||
343 | /** |
||
344 | * Returns PermissionHelper with given node in context |
||
345 | * |
||
346 | * @param Structure\Node $node |
||
347 | * |
||
348 | * @return \VirtualFileSystem\Wrapper\PermissionHelper |
||
349 | */ |
||
350 | public function getPermissionHelper(Structure\Node $node) |
||
354 | |||
355 | /** |
||
356 | * Sets permission helper instance |
||
357 | * |
||
358 | * @param \VirtualFileSystem\Wrapper\PermissionHelper $permissionHelper |
||
359 | */ |
||
360 | public function setPermissionHelper($permissionHelper) |
||
364 | } |
||
365 |