ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
FilesystemFacade.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 
4 namespace ILIAS\Filesystem;
5 
12 
27 final class FilesystemFacade implements Filesystem
28 {
29 
37  private $fileAccess;
42 
43 
54  {
55  $this->fileStreamAccess = $fileStreamAccess;
56  $this->fileAccess = $fileAccess;
57  $this->directoryAccess = $directoryAccess;
58  }
59 
60 
64  public function hasDir(string $path) : bool
65  {
66  return $this->directoryAccess->hasDir($path);
67  }
68 
69 
73  public function listContents(string $path = '', bool $recursive = false) : array
74  {
75  return $this->directoryAccess->listContents($path, $recursive);
76  }
77 
78 
82  public function createDir(string $path, string $visibility = Visibility::PUBLIC_ACCESS)
83  {
84  $this->directoryAccess->createDir($path, $visibility);
85  }
86 
87 
91  public function copyDir(string $source, string $destination)
92  {
93  $this->directoryAccess->copyDir($source, $destination);
94  }
95 
96 
100  public function deleteDir(string $path)
101  {
102  $this->directoryAccess->deleteDir($path);
103  }
104 
105 
109  public function read(string $path) : string
110  {
111  return $this->fileAccess->read($path);
112  }
113 
114 
118  public function has(string $path) : bool
119  {
120  return $this->fileAccess->has($path);
121  }
122 
123 
127  public function getMimeType(string $path) : string
128  {
129  return $this->fileAccess->getMimeType($path);
130  }
131 
132 
136  public function getTimestamp(string $path) : \DateTimeImmutable
137  {
138  return $this->fileAccess->getTimestamp($path);
139  }
140 
141 
145  public function getSize(string $path, int $fileSizeUnit) : DataSize
146  {
147  return $this->fileAccess->getSize($path, $fileSizeUnit);
148  }
149 
150 
154  public function setVisibility(string $path, string $visibility) : bool
155  {
156  return $this->fileAccess->setVisibility($path, $visibility);
157  }
158 
159 
163  public function getVisibility(string $path) : string
164  {
165  return $this->fileAccess->getVisibility($path);
166  }
167 
168 
172  public function readStream(string $path) : FileStream
173  {
174  return $this->fileStreamAccess->readStream($path);
175  }
176 
177 
181  public function writeStream(string $path, FileStream $stream)
182  {
183  $this->fileStreamAccess->writeStream($path, $stream);
184  }
185 
186 
190  public function putStream(string $path, FileStream $stream)
191  {
192  $this->fileStreamAccess->putStream($path, $stream);
193  }
194 
195 
199  public function updateStream(string $path, FileStream $stream)
200  {
201  $this->fileStreamAccess->updateStream($path, $stream);
202  }
203 
204 
208  public function write(string $path, string $content)
209  {
210  $this->fileAccess->write($path, $content);
211  }
212 
213 
217  public function update(string $path, string $newContent)
218  {
219  $this->fileAccess->update($path, $newContent);
220  }
221 
222 
226  public function put(string $path, string $content)
227  {
228  $this->fileAccess->put($path, $content);
229  }
230 
231 
235  public function delete(string $path)
236  {
237  $this->fileAccess->delete($path);
238  }
239 
240 
244  public function readAndDelete(string $path) : string
245  {
246  return $this->fileAccess->readAndDelete($path);
247  }
248 
249 
253  public function rename(string $path, string $newPath)
254  {
255  $this->fileAccess->rename($path, $newPath);
256  }
257 
258 
262  public function copy(string $path, string $copyPath)
263  {
264  $this->fileAccess->copy($path, $copyPath);
265  }
266 
270  public function finder() : Finder
271  {
272  return new Finder($this);
273  }
274 }
write(string $path, string $content)
setVisibility(string $path, string $visibility)
rename(string $path, string $newPath)
Class DataSize.
Definition: DataSize.php:15
copy(string $path, string $copyPath)
copyDir(string $source, string $destination)
createDir(string $path, string $visibility=Visibility::PUBLIC_ACCESS)
getSize(string $path, int $fileSizeUnit)
listContents(string $path='', bool $recursive=false)
put(string $path, string $content)
getSize()
The calculated data size.
Definition: DataSize.php:143
update(string $path, string $newContent)
__construct(FileStreamAccess $fileStreamAccess, FileAccess $fileAccess, DirectoryAccess $directoryAccess)
FilesystemFacade constructor.
const PUBLIC_ACCESS
Public file visibility.
Definition: Visibility.php:25
writeStream(string $path, FileStream $stream)
$source
Definition: metadata.php:76
Interface FileStream.
Definition: FileStream.php:20
putStream(string $path, FileStream $stream)
Class FlySystemFileAccessTest.
updateStream(string $path, FileStream $stream)