ILIAS  release_8 Revision v8.24
ReadOnlyDecorator.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
7use DateTime;
17
18/******************************************************************************
19 *
20 * This file is part of ILIAS, a powerful learning management system.
21 *
22 * ILIAS is licensed with the GPL-3.0, you should have received a copy
23 * of said license along with the source code.
24 *
25 * If this is not the case or you just want to try ILIAS, you'll find
26 * us at:
27 * https://www.ilias.de
28 * https://github.com/ILIAS-eLearning
29 *
30 *****************************************************************************/
43final class ReadOnlyDecorator implements Filesystem
44{
45 private \ILIAS\Filesystem\Filesystem $filesystem;
46
47
54 {
55 $this->filesystem = $filesystem;
56 }
57
58
62 public function hasDir(string $path): bool
63 {
64 return $this->filesystem->hasDir($path);
65 }
66
67
71 public function listContents(string $path = '', bool $recursive = false): array
72 {
73 return $this->filesystem->listContents($path, $recursive);
74 }
75
76
80 public function createDir(string $path, string $visibility = Visibility::PUBLIC_ACCESS): void
81 {
82 throw new IOException("FS has ready access only");
83 }
84
85
89 public function copyDir(string $source, string $destination): void
90 {
91 throw new IOException("FS has ready access only");
92 }
93
94
98 public function deleteDir(string $path): void
99 {
100 throw new IOException("FS has ready access only");
101 }
102
103
107 public function read(string $path): string
108 {
109 return $this->filesystem->read($path);
110 }
111
112
116 public function has(string $path): bool
117 {
118 return $this->filesystem->has($path);
119 }
120
121
125 public function getMimeType(string $path): string
126 {
127 return $this->filesystem->getMimeType($path);
128 }
129
130
134 public function getTimestamp(string $path): \DateTimeImmutable
135 {
136 return $this->filesystem->getTimestamp($path);
137 }
138
139
143 public function getSize(string $path, int $fileSizeUnit): DataSize
144 {
145 return $this->filesystem->getSize(
146 $path,
147 $fileSizeUnit
148 );
149 }
150
151
155 public function setVisibility(string $path, string $visibility): bool
156 {
157 throw new IOException("FS has ready access only");
158 }
159
160
164 public function getVisibility(string $path): string
165 {
166 return $this->filesystem->getVisibility($path);
167 }
168
169
173 public function readStream(string $path): FileStream
174 {
175 return $this->filesystem->readStream($path);
176 }
177
178
182 public function finder(): Finder
183 {
184 return $this->filesystem->finder();
185 }
186
190 public function writeStream(string $path, FileStream $stream): void
191 {
192 throw new IOException("FS has ready access only");
193 }
194
195
199 public function putStream(string $path, FileStream $stream): void
200 {
201 throw new IOException("FS has ready access only");
202 }
203
204
208 public function updateStream(string $path, FileStream $stream): void
209 {
210 throw new IOException("FS has ready access only");
211 }
212
213
217 public function write(string $path, string $content): void
218 {
219 throw new IOException("FS has ready access only");
220 }
221
222
226 public function update(string $path, string $new_content): void
227 {
228 throw new IOException("FS has ready access only");
229 }
230
231
235 public function put(string $path, string $content): void
236 {
237 throw new IOException("FS has ready access only");
238 }
239
240
244 public function delete(string $path): void
245 {
246 throw new IOException("FS has ready access only");
247 }
248
249
253 public function readAndDelete(string $path): string
254 {
255 throw new IOException("FS has ready access only");
256 }
257
258
262 public function rename(string $path, string $new_path): void
263 {
264 throw new IOException("FS has ready access only");
265 }
266
267
271 public function copy(string $path, string $copy_path): void
272 {
273 throw new IOException("FS has ready access only");
274 }
275}
This class provides the data size with additional information to remove the work to calculate the siz...
Definition: DataSize.php:31
__construct(Filesystem $filesystem)
ReadOnlyDecorator constructor.
rename(string $path, string $new_path)
@inheritDoc
getSize(string $path, int $fileSizeUnit)
@inheritDoc
write(string $path, string $content)
@inheritDoc
createDir(string $path, string $visibility=Visibility::PUBLIC_ACCESS)
@inheritDoc
put(string $path, string $content)
@inheritDoc
copyDir(string $source, string $destination)
@inheritDoc
putStream(string $path, FileStream $stream)
@inheritDoc
copy(string $path, string $copy_path)
@inheritDoc
listContents(string $path='', bool $recursive=false)
@inheritDoc
updateStream(string $path, FileStream $stream)
@inheritDoc
writeStream(string $path, FileStream $stream)
@inheritDoc
update(string $path, string $new_content)
@inheritDoc
setVisibility(string $path, string $visibility)
@inheritDoc
Class ilFileUtils.
Interface Filesystem.
Definition: Filesystem.php:40
Interface Visibility.
Definition: Visibility.php:32
const PUBLIC_ACCESS
Public file visibility.
Definition: Visibility.php:37
$path
Definition: ltiservices.php:32
$source
Definition: metadata.php:93
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...