ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ReadOnlyDecorator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29
37final class ReadOnlyDecorator implements Filesystem
38{
42 public function __construct(private Filesystem $filesystem)
43 {
44 }
45
49 public function hasDir(string $path): bool
50 {
51 return $this->filesystem->hasDir($path);
52 }
53
57 public function listContents(string $path = '', bool $recursive = false): array
58 {
59 return $this->filesystem->listContents($path, $recursive);
60 }
61
65 public function createDir(string $path, string $visibility = Visibility::PUBLIC_ACCESS): void
66 {
67 throw new IOException("FS has ready access only");
68 }
69
73 public function copyDir(string $source, string $destination): void
74 {
75 throw new IOException("FS has ready access only");
76 }
77
81 public function deleteDir(string $path): void
82 {
83 throw new IOException("FS has ready access only");
84 }
85
89 public function read(string $path): string
90 {
91 return $this->filesystem->read($path);
92 }
93
97 public function has(string $path): bool
98 {
99 return $this->filesystem->has($path);
100 }
101
105 public function getMimeType(string $path): string
106 {
107 return $this->filesystem->getMimeType($path);
108 }
109
113 public function getTimestamp(string $path): \DateTimeImmutable
114 {
115 return $this->filesystem->getTimestamp($path);
116 }
117
121 public function getSize(string $path, int $unit): DataSize
122 {
123 return $this->filesystem->getSize(
124 $path,
125 $unit
126 );
127 }
128
132 public function setVisibility(string $path, string $visibility): bool
133 {
134 throw new IOException("FS has ready access only");
135 }
136
140 public function getVisibility(string $path): string
141 {
142 return $this->filesystem->getVisibility($path);
143 }
144
148 public function readStream(string $path): FileStream
149 {
150 return $this->filesystem->readStream($path);
151 }
152
156 public function finder(): Finder
157 {
158 return $this->filesystem->finder();
159 }
160
164 public function writeStream(string $path, FileStream $stream): void
165 {
166 throw new IOException("FS has ready access only");
167 }
168
172 public function putStream(string $path, FileStream $stream): void
173 {
174 throw new IOException("FS has ready access only");
175 }
176
180 public function updateStream(string $path, FileStream $stream): void
181 {
182 throw new IOException("FS has ready access only");
183 }
184
188 public function write(string $path, string $content): void
189 {
190 throw new IOException("FS has ready access only");
191 }
192
196 public function update(string $path, string $new_content): void
197 {
198 throw new IOException("FS has ready access only");
199 }
200
204 public function put(string $path, string $content): void
205 {
206 throw new IOException("FS has ready access only");
207 }
208
212 public function delete(string $path): void
213 {
214 throw new IOException("FS has ready access only");
215 }
216
220 public function readAndDelete(string $path): string
221 {
222 throw new IOException("FS has ready access only");
223 }
224
228 public function rename(string $path, string $new_path): void
229 {
230 throw new IOException("FS has ready access only");
231 }
232
236 public function copy(string $path, string $copy_path): void
237 {
238 throw new IOException("FS has ready access only");
239 }
240}
This class provides the data size with additional information to remove the work to calculate the siz...
Definition: DataSize.php:31
The filesystem ready only decorator provides read only access and will throw an Exception whenever co...
__construct(private Filesystem $filesystem)
ReadOnlyDecorator constructor.
rename(string $path, string $new_path)
@inheritDoc
write(string $path, string $content)
@inheritDoc
getSize(string $path, int $unit)
@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
Indicates general problems with the input or output operations.
Definition: IOException.php:28
The filesystem interface provides the public interface for the Filesystem service API consumer.
Definition: Filesystem.php:37
The base interface for all filesystem streams.
Definition: FileStream.php:32
This interface provides the available options for the filesystem right management of the filesystem s...
Definition: Visibility.php:30
const PUBLIC_ACCESS
Public file visibility.
Definition: Visibility.php:34
$path
Definition: ltiservices.php:30