ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ($path)
 @inheritDoc More...
 
 listContents ($path='', $recursive=false)
 @inheritDoc More...
 
 createDir ($path, $visibility=Visibility::PUBLIC_ACCESS)
 @inheritDoc More...
 
 copyDir ($source, $destination)
 @inheritDoc More...
 
 deleteDir ($path)
 @inheritDoc More...
 
 read ($path)
 @inheritDoc More...
 
 has ($path)
 @inheritDoc More...
 
 getMimeType ($path)
 @inheritDoc More...
 
 getTimestamp ($path)
 @inheritDoc More...
 
 getSize ($path, $fileSizeUnit)
 @inheritDoc More...
 
 setVisibility ($path, $visibility)
 @inheritDoc More...
 
 getVisibility ($path)
 @inheritDoc More...
 
 readStream ($path)
 @inheritDoc More...
 
 writeStream ($path, FileStream $stream)
 @inheritDoc More...
 
 putStream ($path, FileStream $stream)
 @inheritDoc More...
 
 updateStream ($path, FileStream $stream)
 @inheritDoc More...
 
 write ($path, $content)
 @inheritDoc More...
 
 update ($path, $newContent)
 @inheritDoc More...
 
 put ($path, $content)
 @inheritDoc More...
 
 delete ($path)
 @inheritDoc More...
 
 readAndDelete ($path)
 @inheritDoc More...
 
 rename ($path, $newPath)
 @inheritDoc More...
 
 copy ($path, $copyPath)
 @inheritDoc More...
 
 readStream ($path)
 Opens a readable stream of the file. More...
 
 writeStream ($path, FileStream $stream)
 Writes the stream to a new file. More...
 
 putStream ($path, FileStream $stream)
 Creates a new file or updates an existing one. More...
 
 updateStream ($path, FileStream $stream)
 Updates an existing file. More...
 
 read ($path)
 Reads a file content to a string. More...
 
 has ($path)
 Checks whether a file exists. More...
 
 getMimeType ($path)
 Get a files mime-type. More...
 
 getTimestamp ($path)
 Get the timestamp of the file. More...
 
 getSize ($path, $fileSizeUnit)
 Get the size of a file. More...
 
 setVisibility ($path, $visibility)
 Sets the visibility for a file. More...
 
 getVisibility ($path)
 Get the file visibility. More...
 
 write ($path, $content)
 Writes the content to a new file. More...
 
 update ($path, $newContent)
 Updates the content of a file. More...
 
 put ($path, $content)
 Creates a file or updates an existing one. More...
 
 delete ($path)
 Deletes a file. More...
 
 readAndDelete ($path)
 Reads the entire file content into a string and removes the file afterwards. More...
 
 rename ($path, $newPath)
 Moves a file from the source to the destination. More...
 
 copy ($path, $copyPath)
 Copy the source file to a destination. More...
 
 hasDir ($path)
 Checks whether the directory exists or not. More...
 
 listContents ($path='', $recursive=false)
 Lists the content of a directory. More...
 
 createDir ($path, $visibility=Visibility::PUBLIC_ACCESS)
 Create a new directory. More...
 
 copyDir ($source, $destination)
 Copy all childes of the source recursive to the destination. More...
 
 deleteDir ($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 24 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 50 of file FilesystemFacade.php.

51 {
52 $this->fileStreamAccess = $fileStreamAccess;
53 $this->fileAccess = $fileAccess;
54 $this->directoryAccess = $directoryAccess;
55 }

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

Member Function Documentation

◆ copy()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 259 of file FilesystemFacade.php.

260 {
261 $this->fileAccess->copy($path, $copyPath);
262 }

References $path.

◆ copyDir()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryWriteAccess.

Definition at line 88 of file FilesystemFacade.php.

89 {
90 $this->directoryAccess->copyDir($source, $destination);
91 }
$source
Definition: linkback.php:22
$destination

References $destination, and $source.

◆ createDir()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryWriteAccess.

Definition at line 79 of file FilesystemFacade.php.

80 {
81 $this->directoryAccess->createDir($path, $visibility);
82 }

References $path.

◆ delete()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 232 of file FilesystemFacade.php.

233 {
234 $this->fileAccess->delete($path);
235 }

References $path.

◆ deleteDir()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryWriteAccess.

Definition at line 97 of file FilesystemFacade.php.

98 {
99 $this->directoryAccess->deleteDir($path);
100 }

References $path.

◆ getMimeType()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 124 of file FilesystemFacade.php.

125 {
126 return $this->fileAccess->getMimeType($path);
127 }

References $path.

◆ getSize()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 142 of file FilesystemFacade.php.

143 {
144 return $this->fileAccess->getSize($path, $fileSizeUnit);
145 }

References $path.

◆ getTimestamp()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 133 of file FilesystemFacade.php.

134 {
135 return $this->fileAccess->getTimestamp($path);
136 }

References $path.

◆ getVisibility()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 160 of file FilesystemFacade.php.

161 {
162 return $this->fileAccess->getVisibility($path);
163 }

References $path.

◆ has()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 115 of file FilesystemFacade.php.

116 {
117 return $this->fileAccess->has($path);
118 }

References $path.

◆ hasDir()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryReadAccess.

Definition at line 61 of file FilesystemFacade.php.

62 {
63 return $this->directoryAccess->hasDir($path);
64 }

References $path.

◆ listContents()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\DirectoryReadAccess.

Definition at line 70 of file FilesystemFacade.php.

71 {
72 return $this->directoryAccess->listContents($path, $recursive);
73 }

References $path.

◆ put()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 223 of file FilesystemFacade.php.

224 {
225 $this->fileAccess->put($path, $content);
226 }

References $path.

◆ putStream()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamWriteAccess.

Definition at line 187 of file FilesystemFacade.php.

188 {
189 $this->fileStreamAccess->putStream($path, $stream);
190 }
$stream
PHP stream implementation.

References $path, and GuzzleHttp\Psr7\$stream.

◆ read()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 106 of file FilesystemFacade.php.

107 {
108 return $this->fileAccess->read($path);
109 }

References $path.

◆ readAndDelete()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 241 of file FilesystemFacade.php.

242 {
243 return $this->fileAccess->readAndDelete($path);
244 }

References $path.

◆ readStream()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamReadAccess.

Definition at line 169 of file FilesystemFacade.php.

170 {
171 return $this->fileStreamAccess->readStream($path);
172 }

References $path.

◆ rename()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 250 of file FilesystemFacade.php.

251 {
252 $this->fileAccess->rename($path, $newPath);
253 }

References $path.

◆ setVisibility()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileReadAccess.

Definition at line 151 of file FilesystemFacade.php.

152 {
153 return $this->fileAccess->setVisibility($path, $visibility);
154 }

References $path.

◆ update()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 214 of file FilesystemFacade.php.

215 {
216 $this->fileAccess->update($path, $newContent);
217 }

References $path.

◆ updateStream()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamWriteAccess.

Definition at line 196 of file FilesystemFacade.php.

197 {
198 $this->fileStreamAccess->updateStream($path, $stream);
199 }

References $path, and GuzzleHttp\Psr7\$stream.

◆ write()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileWriteAccess.

Definition at line 205 of file FilesystemFacade.php.

206 {
207 $this->fileAccess->write($path, $content);
208 }

References $path.

◆ writeStream()

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

@inheritDoc

Implements ILIAS\Filesystem\Provider\FileStreamWriteAccess.

Definition at line 178 of file FilesystemFacade.php.

179 {
180 $this->fileStreamAccess->writeStream($path, $stream);
181 }

References $path, and GuzzleHttp\Psr7\$stream.

Field Documentation

◆ $directoryAccess

DirectoryAccess ILIAS\Filesystem\FilesystemFacade::$directoryAccess
private

Definition at line 38 of file FilesystemFacade.php.

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

◆ $fileAccess

FileAccess ILIAS\Filesystem\FilesystemFacade::$fileAccess
private

Definition at line 34 of file FilesystemFacade.php.

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

◆ $fileStreamAccess

FileStreamAccess ILIAS\Filesystem\FilesystemFacade::$fileStreamAccess
private

Definition at line 30 of file FilesystemFacade.php.

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


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