ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ReadOnlyDecorator.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 
5 
6 use DateTime;
7 use ilFileUtils;
15 
28 final class ReadOnlyDecorator implements Filesystem
29 {
30 
34  private $filesystem;
35 
36 
43  {
44  $this->filesystem = $filesystem;
45  }
46 
47 
51  public function hasDir(string $path) : bool
52  {
53  return $this->filesystem->hasDir($path);
54  }
55 
56 
60  public function listContents(string $path = '', bool $recursive = false) : array
61  {
62  return $this->filesystem->listContents($path, $recursive);
63  }
64 
65 
69  public function createDir(string $path, string $visibility = Visibility::PUBLIC_ACCESS)
70  {
71  throw new IOException("FS has ready access only");
72  }
73 
74 
78  public function copyDir(string $source, string $destination)
79  {
80  throw new IOException("FS has ready access only");
81  }
82 
83 
87  public function deleteDir(string $path)
88  {
89  throw new IOException("FS has ready access only");
90  }
91 
92 
96  public function read(string $path) : string
97  {
98  return $this->filesystem->read($path);
99  }
100 
101 
105  public function has(string $path) : bool
106  {
107  return $this->filesystem->has($path);
108  }
109 
110 
114  public function getMimeType(string $path) : string
115  {
116  return $this->filesystem->getMimeType($path);
117  }
118 
119 
123  public function getTimestamp(string $path) : \DateTimeImmutable
124  {
125  return $this->filesystem->getTimestamp($path);
126  }
127 
128 
132  public function getSize(string $path, int $fileSizeUnit) : DataSize
133  {
134  return $this->filesystem->getSize(
135  $path,
136  $fileSizeUnit
137  );
138  }
139 
140 
144  public function setVisibility(string $path, string $visibility) : bool
145  {
146  throw new IOException("FS has ready access only");
147  }
148 
149 
153  public function getVisibility(string $path) : string
154  {
155  return $this->filesystem->getVisibility($path);
156  }
157 
158 
162  public function readStream(string $path) : FileStream
163  {
164  return $this->filesystem->readStream($path);
165  }
166 
167 
171  public function writeStream(string $path, FileStream $stream)
172  {
173  throw new IOException("FS has ready access only");
174  }
175 
176 
180  public function putStream(string $path, FileStream $stream)
181  {
182  throw new IOException("FS has ready access only");
183  }
184 
185 
189  public function updateStream(string $path, FileStream $stream)
190  {
191  throw new IOException("FS has ready access only");
192  }
193 
194 
198  public function write(string $path, string $content)
199  {
200  throw new IOException("FS has ready access only");
201  }
202 
203 
207  public function update(string $path, string $newContent)
208  {
209  throw new IOException("FS has ready access only");
210  }
211 
212 
216  public function put(string $path, string $content)
217  {
218  throw new IOException("FS has ready access only");
219  }
220 
221 
225  public function delete(string $path)
226  {
227  throw new IOException("FS has ready access only");
228  }
229 
230 
234  public function readAndDelete(string $path) : string
235  {
236  throw new IOException("FS has ready access only");
237  }
238 
239 
243  public function rename(string $path, string $newPath)
244  {
245  throw new IOException("FS has ready access only");
246  }
247 
248 
252  public function copy(string $path, string $copyPath)
253  {
254  throw new IOException("FS has ready access only");
255  }
256 }
$path
Definition: aliased.php:25
Exercise XML Parser which completes/updates a given file by an xml string.
Class DataSize.
Definition: DataSize.php:15
$destination
createDir(string $path, string $visibility=Visibility::PUBLIC_ACCESS)
getSize(string $path, int $fileSizeUnit)
putStream(string $path, FileStream $stream)
$stream
PHP stream implementation.
writeStream(string $path, FileStream $stream)
copyDir(string $source, string $destination)
listContents(string $path='', bool $recursive=false)
getSize()
The calculated data size.
Definition: DataSize.php:116
__construct(Filesystem $filesystem)
ReadOnlyDecorator constructor.
setVisibility(string $path, string $visibility)
$source
Definition: linkback.php:22
const PUBLIC_ACCESS
Public file visibility.
Definition: Visibility.php:25
update(string $path, string $newContent)
Interface FileStream.
Definition: FileStream.php:20
Class FlySystemFileAccessTest.
updateStream(string $path, FileStream $stream)