1 | <?php |
||
26 | class FileSystem |
||
27 | { |
||
28 | protected $scheme; |
||
29 | |||
30 | /** |
||
31 | * @var Container |
||
32 | */ |
||
33 | protected $container; |
||
34 | |||
35 | /** |
||
36 | * Class constructor. Will register both, the stream default options and wrapper handler. |
||
37 | * |
||
38 | * Note: Each FileSystem instance will create NEW stream wrapper/scheme. |
||
39 | */ |
||
40 | public function __construct() |
||
52 | |||
53 | /** |
||
54 | * Returns wrapper scheme. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function scheme() |
||
62 | |||
63 | /** |
||
64 | * Registers Container object as default context option for scheme associated with FileSystem instance. |
||
65 | * |
||
66 | * @param Container $container |
||
67 | */ |
||
68 | protected function registerContextOptions(Container $container) |
||
76 | |||
77 | /** |
||
78 | * Remoces wrapper registered for scheme associated with FileSystem instance. |
||
79 | */ |
||
80 | public function __destruct() |
||
84 | |||
85 | /** |
||
86 | * Returns Container instance. |
||
87 | * |
||
88 | * @return Container |
||
89 | */ |
||
90 | public function container() |
||
94 | |||
95 | /** |
||
96 | * Returns Root instance. |
||
97 | * |
||
98 | * @return Root |
||
99 | */ |
||
100 | public function root() |
||
104 | |||
105 | /** |
||
106 | * Returns absolute path to full URI path (with scheme) |
||
107 | * |
||
108 | * @param string $path - path without scheme |
||
109 | * |
||
110 | * @return string - path with scheme |
||
111 | */ |
||
112 | public function path($path) |
||
118 | |||
119 | /** |
||
120 | * Creates and returns a directory |
||
121 | * |
||
122 | * @param string $path |
||
123 | * @param bool $recursive |
||
124 | * @param integer|null $mode |
||
125 | * |
||
126 | * @return Directory |
||
127 | */ |
||
128 | public function createDirectory($path, $recursive = false, $mode = null) |
||
132 | |||
133 | /** |
||
134 | * Creates and returns a file |
||
135 | * |
||
136 | * @param string $path |
||
137 | * @param string|null $data |
||
138 | * |
||
139 | * @return File |
||
140 | */ |
||
141 | public function createFile($path, $data = null) |
||
145 | |||
146 | /** |
||
147 | * Creates fs structure |
||
148 | * |
||
149 | * @param array $structure |
||
150 | */ |
||
151 | public function createStructure(array $structure) |
||
155 | |||
156 | /** |
||
157 | * Creates and returns a link |
||
158 | * |
||
159 | * @param string $path |
||
160 | * @param string $destinationPath |
||
161 | * |
||
162 | * @return Link |
||
163 | */ |
||
164 | public function createLink($path, $destinationPath) |
||
168 | } |
||
169 |