1 | <?php |
||
18 | class Flightcontrol |
||
19 | { |
||
20 | /** |
||
21 | * @var \League\Flysystem\Filesystem |
||
22 | */ |
||
23 | protected $filesystem; |
||
24 | |||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | protected $strict_evaluation; |
||
29 | |||
30 | /** |
||
31 | * Initialize the flightcontrol over a flysystem. |
||
32 | */ |
||
33 | 67 | public function __construct( |
|
41 | |||
42 | 52 | public function filesystem() : \League\Flysystem\Filesystem |
|
46 | |||
47 | /** |
||
48 | * Get an object from the filesystem based on its path. |
||
49 | */ |
||
50 | 65 | public function get(string $path) : FSObject |
|
60 | |||
61 | /** |
||
62 | * Get a directory from the filesystem. |
||
63 | * |
||
64 | * Dependening on the adapter in the underlying flysystem, this might treat |
||
65 | * empty directories as if they would not exist (e.g. for ZipArchiveAdapter). |
||
66 | */ |
||
67 | 46 | public function directory(string $path) : ?Directory |
|
71 | |||
72 | /** |
||
73 | * Get a file from the filesystem. |
||
74 | */ |
||
75 | 2 | public function file(string $path) : ?File |
|
79 | |||
80 | /** |
||
81 | * Make a directory when unfolding a directory structure via Directory::unfold. |
||
82 | */ |
||
83 | 5 | public function makeFDirectory(string $name, array $content) : FDirectory |
|
87 | |||
88 | /** |
||
89 | * Make a file when unfolding a directory structure via Directory::unfold. |
||
90 | */ |
||
91 | 5 | public function makeFile(string $name, string $content) : VirtualFile |
|
95 | |||
96 | // Helper |
||
97 | |||
98 | // Get an object from fs that either is as file or a dir. |
||
99 | 48 | private function file_or_dir(string $path, bool $is_file) : ?FSObject |
|
107 | |||
108 | /** |
||
109 | * Create an FDirectory with metadata from some FSObject and some content |
||
110 | * that could be lazily produced by some function. |
||
111 | */ |
||
112 | 44 | public function newFDirectory(FSObject $fs_object, \Closure $contents_lazy) : FDirectory |
|
120 | } |
||
121 |