ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
FilesystemFacade.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 
4 namespace ILIAS\Filesystem;
5 
11 
26 final class FilesystemFacade implements Filesystem
27 {
28 
36  private $fileAccess;
41 
42 
53  {
54  $this->fileStreamAccess = $fileStreamAccess;
55  $this->fileAccess = $fileAccess;
56  $this->directoryAccess = $directoryAccess;
57  }
58 
59 
63  public function hasDir(string $path) : bool
64  {
65  return $this->directoryAccess->hasDir($path);
66  }
67 
68 
72  public function listContents(string $path = '', bool $recursive = false) : array
73  {
74  return $this->directoryAccess->listContents($path, $recursive);
75  }
76 
77 
81  public function createDir(string $path, string $visibility = Visibility::PUBLIC_ACCESS)
82  {
83  $this->directoryAccess->createDir($path, $visibility);
84  }
85 
86 
90  public function copyDir(string $source, string $destination)
91  {
92  $this->directoryAccess->copyDir($source, $destination);
93  }
94 
95 
99  public function deleteDir(string $path)
100  {
101  $this->directoryAccess->deleteDir($path);
102  }
103 
104 
108  public function read(string $path) : string
109  {
110  return $this->fileAccess->read($path);
111  }
112 
113 
117  public function has(string $path) : bool
118  {
119  return $this->fileAccess->has($path);
120  }
121 
122 
126  public function getMimeType(string $path) : string
127  {
128  return $this->fileAccess->getMimeType($path);
129  }
130 
131 
135  public function getTimestamp(string $path) : \DateTimeImmutable
136  {
137  return $this->fileAccess->getTimestamp($path);
138  }
139 
140 
144  public function getSize(string $path, int $fileSizeUnit) : DataSize
145  {
146  return $this->fileAccess->getSize($path, $fileSizeUnit);
147  }
148 
149 
153  public function setVisibility(string $path, string $visibility) : bool
154  {
155  return $this->fileAccess->setVisibility($path, $visibility);
156  }
157 
158 
162  public function getVisibility(string $path) : string
163  {
164  return $this->fileAccess->getVisibility($path);
165  }
166 
167 
171  public function readStream(string $path) : FileStream
172  {
173  return $this->fileStreamAccess->readStream($path);
174  }
175 
176 
180  public function writeStream(string $path, FileStream $stream)
181  {
182  $this->fileStreamAccess->writeStream($path, $stream);
183  }
184 
185 
189  public function putStream(string $path, FileStream $stream)
190  {
191  $this->fileStreamAccess->putStream($path, $stream);
192  }
193 
194 
198  public function updateStream(string $path, FileStream $stream)
199  {
200  $this->fileStreamAccess->updateStream($path, $stream);
201  }
202 
203 
207  public function write(string $path, string $content)
208  {
209  $this->fileAccess->write($path, $content);
210  }
211 
212 
216  public function update(string $path, string $newContent)
217  {
218  $this->fileAccess->update($path, $newContent);
219  }
220 
221 
225  public function put(string $path, string $content)
226  {
227  $this->fileAccess->put($path, $content);
228  }
229 
230 
234  public function delete(string $path)
235  {
236  $this->fileAccess->delete($path);
237  }
238 
239 
243  public function readAndDelete(string $path) : string
244  {
245  return $this->fileAccess->readAndDelete($path);
246  }
247 
248 
252  public function rename(string $path, string $newPath)
253  {
254  $this->fileAccess->rename($path, $newPath);
255  }
256 
257 
261  public function copy(string $path, string $copyPath)
262  {
263  $this->fileAccess->copy($path, $copyPath);
264  }
265 }
write(string $path, string $content)
$path
Definition: aliased.php:25
setVisibility(string $path, string $visibility)
Exercise XML Parser which completes/updates a given file by an xml string.
rename(string $path, string $newPath)
Class DataSize.
Definition: DataSize.php:15
$destination
$stream
PHP stream implementation.
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:116
update(string $path, string $newContent)
__construct(FileStreamAccess $fileStreamAccess, FileAccess $fileAccess, DirectoryAccess $directoryAccess)
FilesystemFacade constructor.
$source
Definition: linkback.php:22
const PUBLIC_ACCESS
Public file visibility.
Definition: Visibility.php:25
writeStream(string $path, FileStream $stream)
Interface FileStream.
Definition: FileStream.php:20
putStream(string $path, FileStream $stream)
Class FlySystemFileAccessTest.
updateStream(string $path, FileStream $stream)