ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\Filesystem\FilesystemFacade Class Reference

Class FilesystemFacade. More...

+ Inheritance diagram for ILIAS\Filesystem\FilesystemFacade:
+ Collaboration diagram for ILIAS\Filesystem\FilesystemFacade:

Public Member Functions

 __construct (FileStreamAccess $fileStreamAccess, FileAccess $fileAccess, DirectoryAccess $directoryAccess)
 FilesystemFacade constructor. More...
 
 hasDir (string $path)
 @inheritDoc More...
 
 listContents (string $path='', bool $recursive=false)
 @inheritDoc More...
 
 createDir (string $path, string $visibility=Visibility::PUBLIC_ACCESS)
 @inheritDoc More...
 
 copyDir (string $source, string $destination)
 @inheritDoc More...
 
 deleteDir (string $path)
 @inheritDoc More...
 
 read (string $path)
 @inheritDoc More...
 
 has (string $path)
 @inheritDoc More...
 
 getMimeType (string $path)
 @inheritDoc More...
 
 getTimestamp (string $path)
 @inheritDoc More...
 
 getSize (string $path, int $fileSizeUnit)
 @inheritDoc More...
 
 setVisibility (string $path, string $visibility)
 @inheritDoc More...
 
 getVisibility (string $path)
 @inheritDoc More...
 
 readStream (string $path)
 @inheritDoc More...
 
 writeStream (string $path, FileStream $stream)
 @inheritDoc More...
 
 putStream (string $path, FileStream $stream)
 @inheritDoc More...
 
 updateStream (string $path, FileStream $stream)
 @inheritDoc More...
 
 write (string $path, string $content)
 @inheritDoc More...
 
 update (string $path, string $newContent)
 @inheritDoc More...
 
 put (string $path, string $content)
 @inheritDoc More...
 
 delete (string $path)
 @inheritDoc More...
 
 readAndDelete (string $path)
 @inheritDoc More...
 
 rename (string $path, string $newPath)
 @inheritDoc More...
 
 copy (string $path, string $copyPath)
 @inheritDoc More...
 
 finder ()
 @inheritDoc More...
 
 finder ()
 
 readStream (string $path)
 Opens a readable stream of the file. More...
 
 writeStream (string $path, FileStream $stream)
 Writes the stream to a new file. More...
 
 putStream (string $path, FileStream $stream)
 Creates a new file or updates an existing one. More...
 
 updateStream (string $path, FileStream $stream)
 Updates an existing file. More...
 
 read (string $path)
 Reads a file content to a string. More...
 
 has (string $path)
 Checks whether a file exists. More...
 
 getMimeType (string $path)
 Get a files mime-type. More...
 
 getTimestamp (string $path)
 Get the timestamp of the file. More...
 
 getSize (string $path, int $fileSizeUnit)
 Get the size of a file. More...
 
 setVisibility (string $path, string $visibility)
 Sets the visibility for a file. More...
 
 getVisibility (string $path)
 Get the file visibility. More...
 
 write (string $path, string $content)
 Writes the content to a new file. More...
 
 update (string $path, string $newContent)
 Updates the content of a file. More...
 
 put (string $path, string $content)
 Creates a file or updates an existing one. More...
 
 delete (string $path)
 Deletes a file. More...
 
 readAndDelete (string $path)
 Reads the entire file content into a string and removes the file afterwards. More...
 
 rename (string $path, string $newPath)
 Moves a file from the source to the destination. More...
 
 copy (string $path, string $copyPath)
 Copy the source file to a destination. More...
 
 hasDir (string $path)
 Checks whether the directory exists or not. More...
 
 listContents (string $path='', bool $recursive=false)
 Lists the content of a directory. More...
 
 createDir (string $path, string $visibility=Visibility::PUBLIC_ACCESS)
 Create a new directory. More...
 
 copyDir (string $source, string $destination)
 Copy all childes of the source recursive to the destination. More...
 
 deleteDir (string $path)
 Deletes a directory recursive. More...
 

Private Attributes

 $fileStreamAccess
 
 $fileAccess
 
 $directoryAccess
 

Detailed Description

Class FilesystemFacade.

The filesystem facade is used internally to satisfy the Filesystem interface because the implementations are split into different classes to reduce the size and responsibility of each class.

This class simply delegates the work to the classes which are responsible for the task.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Since
5.3
Version
1.0.0

Definition at line 27 of file FilesystemFacade.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Filesystem\FilesystemFacade::__construct ( FileStreamAccess  $fileStreamAccess,
FileAccess  $fileAccess,
DirectoryAccess  $directoryAccess 
)

FilesystemFacade constructor.

Creates a new instance of the facade with the provided access classes.

Parameters
FileStreamAccess$fileStreamAccess
FileAccess$fileAccess
DirectoryAccess$directoryAccess

Definition at line 53 of file FilesystemFacade.php.

54 {
55 $this->fileStreamAccess = $fileStreamAccess;
56 $this->fileAccess = $fileAccess;
57 $this->directoryAccess = $directoryAccess;
58 }

References ILIAS\Filesystem\FilesystemFacade\$directoryAccess, ILIAS\Filesystem\FilesystemFacade\$fileAccess, and ILIAS\Filesystem\FilesystemFacade\$fileStreamAccess.

Member Function Documentation

◆ copy()

ILIAS\Filesystem\FilesystemFacade::copy ( string  $path,
string  $copyPath 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 262 of file FilesystemFacade.php.

263 {
264 $this->fileAccess->copy($path, $copyPath);
265 }

◆ copyDir()

ILIAS\Filesystem\FilesystemFacade::copyDir ( string  $source,
string  $destination 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryWriteAccess.

Definition at line 91 of file FilesystemFacade.php.

92 {
93 $this->directoryAccess->copyDir($source, $destination);
94 }
$source
Definition: metadata.php:76

References $source.

◆ createDir()

ILIAS\Filesystem\FilesystemFacade::createDir ( string  $path,
string  $visibility = Visibility::PUBLIC_ACCESS 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryWriteAccess.

Definition at line 82 of file FilesystemFacade.php.

83 {
84 $this->directoryAccess->createDir($path, $visibility);
85 }

◆ delete()

ILIAS\Filesystem\FilesystemFacade::delete ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 235 of file FilesystemFacade.php.

236 {
237 $this->fileAccess->delete($path);
238 }

◆ deleteDir()

ILIAS\Filesystem\FilesystemFacade::deleteDir ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryWriteAccess.

Definition at line 100 of file FilesystemFacade.php.

101 {
102 $this->directoryAccess->deleteDir($path);
103 }

◆ finder()

ILIAS\Filesystem\FilesystemFacade::finder ( )

@inheritDoc

Implements ILIAS\Filesystem\Filesystem.

Definition at line 270 of file FilesystemFacade.php.

270 : Finder
271 {
272 return new Finder($this);
273 }

◆ getMimeType()

ILIAS\Filesystem\FilesystemFacade::getMimeType ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 127 of file FilesystemFacade.php.

127 : string
128 {
129 return $this->fileAccess->getMimeType($path);
130 }

◆ getSize()

ILIAS\Filesystem\FilesystemFacade::getSize ( string  $path,
int  $fileSizeUnit 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 145 of file FilesystemFacade.php.

145 : DataSize
146 {
147 return $this->fileAccess->getSize($path, $fileSizeUnit);
148 }

References ILIAS\Data\DataSize\getSize().

+ Here is the call graph for this function:

◆ getTimestamp()

ILIAS\Filesystem\FilesystemFacade::getTimestamp ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 136 of file FilesystemFacade.php.

136 : \DateTimeImmutable
137 {
138 return $this->fileAccess->getTimestamp($path);
139 }

◆ getVisibility()

ILIAS\Filesystem\FilesystemFacade::getVisibility ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 163 of file FilesystemFacade.php.

163 : string
164 {
165 return $this->fileAccess->getVisibility($path);
166 }

◆ has()

ILIAS\Filesystem\FilesystemFacade::has ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 118 of file FilesystemFacade.php.

118 : bool
119 {
120 return $this->fileAccess->has($path);
121 }

◆ hasDir()

ILIAS\Filesystem\FilesystemFacade::hasDir ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryReadAccess.

Definition at line 64 of file FilesystemFacade.php.

64 : bool
65 {
66 return $this->directoryAccess->hasDir($path);
67 }

◆ listContents()

ILIAS\Filesystem\FilesystemFacade::listContents ( string  $path = '',
bool  $recursive = false 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryReadAccess.

Definition at line 73 of file FilesystemFacade.php.

73 : array
74 {
75 return $this->directoryAccess->listContents($path, $recursive);
76 }

◆ put()

ILIAS\Filesystem\FilesystemFacade::put ( string  $path,
string  $content 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 226 of file FilesystemFacade.php.

227 {
228 $this->fileAccess->put($path, $content);
229 }

◆ putStream()

ILIAS\Filesystem\FilesystemFacade::putStream ( string  $path,
FileStream  $stream 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamWriteAccess.

Definition at line 190 of file FilesystemFacade.php.

191 {
192 $this->fileStreamAccess->putStream($path, $stream);
193 }

◆ read()

ILIAS\Filesystem\FilesystemFacade::read ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 109 of file FilesystemFacade.php.

109 : string
110 {
111 return $this->fileAccess->read($path);
112 }

◆ readAndDelete()

ILIAS\Filesystem\FilesystemFacade::readAndDelete ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 244 of file FilesystemFacade.php.

244 : string
245 {
246 return $this->fileAccess->readAndDelete($path);
247 }

◆ readStream()

ILIAS\Filesystem\FilesystemFacade::readStream ( string  $path)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamReadAccess.

Definition at line 172 of file FilesystemFacade.php.

172 : FileStream
173 {
174 return $this->fileStreamAccess->readStream($path);
175 }
Interface FileStream The base interface for all filesystem streams.
Definition: FileStream.php:18

◆ rename()

ILIAS\Filesystem\FilesystemFacade::rename ( string  $path,
string  $newPath 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 253 of file FilesystemFacade.php.

254 {
255 $this->fileAccess->rename($path, $newPath);
256 }

◆ setVisibility()

ILIAS\Filesystem\FilesystemFacade::setVisibility ( string  $path,
string  $visibility 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 154 of file FilesystemFacade.php.

154 : bool
155 {
156 return $this->fileAccess->setVisibility($path, $visibility);
157 }

◆ update()

ILIAS\Filesystem\FilesystemFacade::update ( string  $path,
string  $newContent 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 217 of file FilesystemFacade.php.

218 {
219 $this->fileAccess->update($path, $newContent);
220 }

◆ updateStream()

ILIAS\Filesystem\FilesystemFacade::updateStream ( string  $path,
FileStream  $stream 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamWriteAccess.

Definition at line 199 of file FilesystemFacade.php.

200 {
201 $this->fileStreamAccess->updateStream($path, $stream);
202 }

◆ write()

ILIAS\Filesystem\FilesystemFacade::write ( string  $path,
string  $content 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 208 of file FilesystemFacade.php.

209 {
210 $this->fileAccess->write($path, $content);
211 }

◆ writeStream()

ILIAS\Filesystem\FilesystemFacade::writeStream ( string  $path,
FileStream  $stream 
)

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamWriteAccess.

Definition at line 181 of file FilesystemFacade.php.

182 {
183 $this->fileStreamAccess->writeStream($path, $stream);
184 }

Field Documentation

◆ $directoryAccess

DirectoryAccess ILIAS\Filesystem\FilesystemFacade::$directoryAccess
private

Definition at line 41 of file FilesystemFacade.php.

Referenced by ILIAS\Filesystem\FilesystemFacade\__construct().

◆ $fileAccess

FileAccess ILIAS\Filesystem\FilesystemFacade::$fileAccess
private

Definition at line 37 of file FilesystemFacade.php.

Referenced by ILIAS\Filesystem\FilesystemFacade\__construct().

◆ $fileStreamAccess

FileStreamAccess ILIAS\Filesystem\FilesystemFacade::$fileStreamAccess
private

Definition at line 33 of file FilesystemFacade.php.

Referenced by ILIAS\Filesystem\FilesystemFacade\__construct().


The documentation for this class was generated from the following file: