ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ReadOnlyDecorator.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
5
6use DateTime;
16
29final class ReadOnlyDecorator implements Filesystem
30{
31
35 private $filesystem;
36
37
44 {
45 $this->filesystem = $filesystem;
46 }
47
48
52 public function hasDir(string $path) : bool
53 {
54 return $this->filesystem->hasDir($path);
55 }
56
57
61 public function listContents(string $path = '', bool $recursive = false) : array
62 {
63 return $this->filesystem->listContents($path, $recursive);
64 }
65
66
70 public function createDir(string $path, string $visibility = Visibility::PUBLIC_ACCESS)
71 {
72 throw new IOException("FS has ready access only");
73 }
74
75
79 public function copyDir(string $source, string $destination)
80 {
81 throw new IOException("FS has ready access only");
82 }
83
84
88 public function deleteDir(string $path)
89 {
90 throw new IOException("FS has ready access only");
91 }
92
93
97 public function read(string $path) : string
98 {
99 return $this->filesystem->read($path);
100 }
101
102
106 public function has(string $path) : bool
107 {
108 return $this->filesystem->has($path);
109 }
110
111
115 public function getMimeType(string $path) : string
116 {
117 return $this->filesystem->getMimeType($path);
118 }
119
120
124 public function getTimestamp(string $path) : \DateTimeImmutable
125 {
126 return $this->filesystem->getTimestamp($path);
127 }
128
129
133 public function getSize(string $path, int $fileSizeUnit) : DataSize
134 {
135 return $this->filesystem->getSize(
136 $path,
137 $fileSizeUnit
138 );
139 }
140
141
145 public function setVisibility(string $path, string $visibility) : bool
146 {
147 throw new IOException("FS has ready access only");
148 }
149
150
154 public function getVisibility(string $path) : string
155 {
156 return $this->filesystem->getVisibility($path);
157 }
158
159
163 public function readStream(string $path) : FileStream
164 {
165 return $this->filesystem->readStream($path);
166 }
167
168
172 public function finder() : Finder
173 {
174 return $this->filesystem->finder();
175 }
176
180 public function writeStream(string $path, FileStream $stream)
181 {
182 throw new IOException("FS has ready access only");
183 }
184
185
189 public function putStream(string $path, FileStream $stream)
190 {
191 throw new IOException("FS has ready access only");
192 }
193
194
198 public function updateStream(string $path, FileStream $stream)
199 {
200 throw new IOException("FS has ready access only");
201 }
202
203
207 public function write(string $path, string $content)
208 {
209 throw new IOException("FS has ready access only");
210 }
211
212
216 public function update(string $path, string $newContent)
217 {
218 throw new IOException("FS has ready access only");
219 }
220
221
225 public function put(string $path, string $content)
226 {
227 throw new IOException("FS has ready access only");
228 }
229
230
234 public function delete(string $path)
235 {
236 throw new IOException("FS has ready access only");
237 }
238
239
243 public function readAndDelete(string $path) : string
244 {
245 throw new IOException("FS has ready access only");
246 }
247
248
252 public function rename(string $path, string $newPath)
253 {
254 throw new IOException("FS has ready access only");
255 }
256
257
261 public function copy(string $path, string $copyPath)
262 {
263 throw new IOException("FS has ready access only");
264 }
265}
An exception for terminatinating execution or to throw for unit testing.
Class DataSize.
Definition: DataSize.php:16
getSize()
The calculated data size.
Definition: DataSize.php:143
__construct(Filesystem $filesystem)
ReadOnlyDecorator constructor.
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
copy(string $path, string $copyPath)
@inheritDoc
copyDir(string $source, string $destination)
@inheritDoc
putStream(string $path, FileStream $stream)
@inheritDoc
update(string $path, string $newContent)
@inheritDoc
listContents(string $path='', bool $recursive=false)
@inheritDoc
updateStream(string $path, FileStream $stream)
@inheritDoc
writeStream(string $path, FileStream $stream)
@inheritDoc
rename(string $path, string $newPath)
@inheritDoc
setVisibility(string $path, string $visibility)
@inheritDoc
Class ilFileUtils.
Interface Filesystem.
Definition: Filesystem.php:27
Interface Visibility.
Definition: Visibility.php:19
const PUBLIC_ACCESS
Public file visibility.
Definition: Visibility.php:25
$source
Definition: metadata.php:76
Class FlySystemFileAccessTest.