ILIAS  release_7 Revision v7.30-3-g800a261c036
ReadOnlyDecorator.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
5
12
22final class ReadOnlyDecorator implements Filesystem
23{
24
28 private $filesystem;
29
35 {
36 $this->filesystem = $filesystem;
37 }
38
42 public function hasDir(string $path) : bool
43 {
44 return $this->filesystem->hasDir($path);
45 }
46
50 public function listContents(string $path = '', bool $recursive = false) : array
51 {
52 return $this->filesystem->listContents($path, $recursive);
53 }
54
58 public function createDir(string $path, string $visibility = Visibility::PUBLIC_ACCESS)
59 {
60 throw new IOException("FS has ready access only");
61 }
62
66 public function copyDir(string $source, string $destination)
67 {
68 throw new IOException("FS has ready access only");
69 }
70
74 public function deleteDir(string $path)
75 {
76 throw new IOException("FS has ready access only");
77 }
78
82 public function read(string $path) : string
83 {
84 return $this->filesystem->read($path);
85 }
86
90 public function has(string $path) : bool
91 {
92 return $this->filesystem->has($path);
93 }
94
98 public function getMimeType(string $path) : string
99 {
100 return $this->filesystem->getMimeType($path);
101 }
102
106 public function getTimestamp(string $path) : \DateTimeImmutable
107 {
108 return $this->filesystem->getTimestamp($path);
109 }
110
114 public function getSize(string $path, int $fileSizeUnit) : DataSize
115 {
116 return $this->filesystem->getSize(
117 $path,
118 $fileSizeUnit
119 );
120 }
121
125 public function setVisibility(string $path, string $visibility) : bool
126 {
127 throw new IOException("FS has ready access only");
128 }
129
133 public function getVisibility(string $path) : string
134 {
135 return $this->filesystem->getVisibility($path);
136 }
137
141 public function readStream(string $path) : FileStream
142 {
143 return $this->filesystem->readStream($path);
144 }
145
149 public function finder() : Finder
150 {
151 return $this->filesystem->finder();
152 }
153
157 public function writeStream(string $path, FileStream $stream)
158 {
159 throw new IOException("FS has ready access only");
160 }
161
165 public function putStream(string $path, FileStream $stream)
166 {
167 throw new IOException("FS has ready access only");
168 }
169
173 public function updateStream(string $path, FileStream $stream)
174 {
175 throw new IOException("FS has ready access only");
176 }
177
181 public function write(string $path, string $content)
182 {
183 throw new IOException("FS has ready access only");
184 }
185
189 public function update(string $path, string $newContent)
190 {
191 throw new IOException("FS has ready access only");
192 }
193
197 public function put(string $path, string $content)
198 {
199 throw new IOException("FS has ready access only");
200 }
201
205 public function delete(string $path)
206 {
207 throw new IOException("FS has ready access only");
208 }
209
213 public function readAndDelete(string $path) : string
214 {
215 throw new IOException("FS has ready access only");
216 }
217
221 public function rename(string $path, string $newPath)
222 {
223 throw new IOException("FS has ready access only");
224 }
225
229 public function copy(string $path, string $copyPath)
230 {
231 throw new IOException("FS has ready access only");
232 }
233}
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 IOException Indicates general problems with the input or output operations.
Definition: IOException.php:13
Interface Filesystem The filesystem interface provides the public interface for the Filesystem servic...
Definition: Filesystem.php:22
Interface FileStream The base interface for all filesystem streams.
Definition: FileStream.php:18
Interface Visibility This interface provides the available options for the filesystem right managemen...
Definition: Visibility.php:16
const PUBLIC_ACCESS
Public file visibility.
Definition: Visibility.php:22
$source
Definition: metadata.php:76
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...