ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
League\Flysystem\Filesystem Class Reference

@method array getWithMetadata(string $path, array $metadata) @method bool forceCopy(string $path, string $newpath) @method bool forceRename(string $path, string $newpath) @method array listFiles(string $path = '', boolean $recursive = false) @method array listPaths(string $path = '', boolean $recursive = false) @method array listWith(array $keys = [], $directory = '', $recursive = false) More...

+ Inheritance diagram for League\Flysystem\Filesystem:
+ Collaboration diagram for League\Flysystem\Filesystem:

Public Member Functions

 __construct (AdapterInterface $adapter, $config=null)
 Constructor. More...
 
 getAdapter ()
 Get the Adapter. More...
 
 has ($path)
 Check whether a file exists.
Parameters
string$path
Returns
bool
More...
 
 write ($path, $contents, array $config=[])
 Write a new file.
Parameters
string$pathThe path of the new file.
string$contentsThe file contents.
array$configAn optional configuration array.
Exceptions
FileExistsException
Returns
bool True on success, false on failure.
More...
 
 writeStream ($path, $resource, array $config=[])
 Write a new file using a stream.
Parameters
string$pathThe path of the new file.
resource$resourceThe file handle.
array$configAn optional configuration array.
Exceptions

InvalidArgumentException If $resource is not a file handle.

Exceptions
FileExistsException
Returns
bool True on success, false on failure.
More...
 
 put ($path, $contents, array $config=[])
 Create a file or update if exists.
Parameters
string$pathThe path to the file.
string$contentsThe file contents.
array$configAn optional configuration array.
Returns
bool True on success, false on failure.
More...
 
 putStream ($path, $resource, array $config=[])
 Create a file or update if exists.
Parameters
string$pathThe path to the file.
resource$resourceThe file handle.
array$configAn optional configuration array.
Exceptions

InvalidArgumentException Thrown if $resource is not a resource.

Returns
bool True on success, false on failure.
More...
 
 readAndDelete ($path)
 Read and delete a file.
Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The file contents, or false on failure.
More...
 
 update ($path, $contents, array $config=[])
 Update an existing file.
Parameters
string$pathThe path of the existing file.
string$contentsThe file contents.
array$configAn optional configuration array.
Exceptions
FileNotFoundException
Returns
bool True on success, false on failure.
More...
 
 updateStream ($path, $resource, array $config=[])
 Update an existing file using a stream.
Parameters
string$pathThe path of the existing file.
resource$resourceThe file handle.
array$configAn optional configuration array.
Exceptions

InvalidArgumentException If $resource is not a file handle.

Exceptions
FileNotFoundException
Returns
bool True on success, false on failure.
More...
 
 read ($path)
 Read a file.
Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The file contents or false on failure.
More...
 
 readStream ($path)
 Retrieves a read-stream for a path.
Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
resource|false The path resource or false on failure.
More...
 
 rename ($path, $newpath)
 Rename a file.
Parameters
string$pathPath to the existing file.
string$newpathThe new path of the file.
Exceptions
FileExistsExceptionThrown if $newpath exists.
FileNotFoundExceptionThrown if $path does not exist.
Returns
bool True on success, false on failure.
More...
 
 copy ($path, $newpath)
 Copy a file.
Parameters
string$pathPath to the existing file.
string$newpathThe new path of the file.
Exceptions
FileExistsExceptionThrown if $newpath exists.
FileNotFoundExceptionThrown if $path does not exist.
Returns
bool True on success, false on failure.
More...
 
 delete ($path)
 Delete a file.
Parameters
string$path
Exceptions
FileNotFoundException
Returns
bool True on success, false on failure.
More...
 
 deleteDir ($dirname)
 Delete a directory.
Parameters
string$dirname
Exceptions
RootViolationExceptionThrown if $dirname is empty.
Returns
bool True on success, false on failure.
More...
 
 createDir ($dirname, array $config=[])
 Create a directory.
Parameters
string$dirnameThe name of the new directory.
array$configAn optional configuration array.
Returns
bool True on success, false on failure.
More...
 
 listContents ($directory='', $recursive=false)
 List contents of a directory.
Parameters
string$directoryThe directory to list.
bool$recursiveWhether to list recursively.
Returns
array A list of file metadata.
More...
 
 getMimetype ($path)
 Get a file's mime-type.
Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The file mime-type or false on failure.
More...
 
 getTimestamp ($path)
 Get a file's timestamp.
Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The timestamp or false on failure.
More...
 
 getVisibility ($path)
 Get a file's visibility.
Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The visibility (public|private) or false on failure.
More...
 
 getSize ($path)
 Get a file's size.
Parameters
string$pathThe path to the file.
Returns
int|false The file size or false on failure.
More...
 
 setVisibility ($path, $visibility)
 Set the visibility for a file.
Parameters
string$pathThe path to the file.
string$visibilityOne of 'public' or 'private'.
Returns
bool True on success, false on failure.
More...
 
 getMetadata ($path)
 Get a file's metadata.
Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
array|false The file metadata or false on failure.
More...
 
 get ($path, Handler $handler=null)
 Get a file/directory handler.
Parameters
string$pathThe path to the file.
Handler$handlerAn optional existing handler to populate.
Returns
Handler Either a file or directory handler.
More...
 
 assertPresent ($path)
 Assert a file is present. More...
 
 assertAbsent ($path)
 Assert a file is absent. More...
 
- Public Member Functions inherited from League\Flysystem\FilesystemInterface
 has ($path)
 Check whether a file exists. More...
 
 read ($path)
 Read a file. More...
 
 readStream ($path)
 Retrieves a read-stream for a path. More...
 
 listContents ($directory='', $recursive=false)
 List contents of a directory. More...
 
 getMetadata ($path)
 Get a file's metadata. More...
 
 getSize ($path)
 Get a file's size. More...
 
 getMimetype ($path)
 Get a file's mime-type. More...
 
 getTimestamp ($path)
 Get a file's timestamp. More...
 
 getVisibility ($path)
 Get a file's visibility. More...
 
 write ($path, $contents, array $config=[])
 Write a new file. More...
 
 writeStream ($path, $resource, array $config=[])
 Write a new file using a stream. More...
 
 update ($path, $contents, array $config=[])
 Update an existing file. More...
 
 updateStream ($path, $resource, array $config=[])
 Update an existing file using a stream. More...
 
 rename ($path, $newpath)
 Rename a file. More...
 
 copy ($path, $newpath)
 Copy a file. More...
 
 delete ($path)
 Delete a file. More...
 
 deleteDir ($dirname)
 Delete a directory. More...
 
 createDir ($dirname, array $config=[])
 Create a directory. More...
 
 setVisibility ($path, $visibility)
 Set the visibility for a file. More...
 
 put ($path, $contents, array $config=[])
 Create a file or update if exists. More...
 
 putStream ($path, $resource, array $config=[])
 Create a file or update if exists. More...
 
 readAndDelete ($path)
 Read and delete a file. More...
 
 get ($path, Handler $handler=null)
 Get a file/directory handler. More...
 
 addPlugin (PluginInterface $plugin)
 Register a plugin. More...
 

Protected Attributes

 $adapter
 

Detailed Description

@method array getWithMetadata(string $path, array $metadata) @method bool forceCopy(string $path, string $newpath) @method bool forceRename(string $path, string $newpath) @method array listFiles(string $path = '', boolean $recursive = false) @method array listPaths(string $path = '', boolean $recursive = false) @method array listWith(array $keys = [], $directory = '', $recursive = false)

Definition at line 18 of file Filesystem.php.

Constructor & Destructor Documentation

◆ __construct()

League\Flysystem\Filesystem::__construct ( AdapterInterface  $adapter,
  $config = null 
)

Constructor.

Parameters
AdapterInterface$adapter
Config | array$config

Definition at line 34 of file Filesystem.php.

35 {
36 $this->adapter = $adapter;
37 $this->setConfig($config);
38 }
setConfig($config)
Set the config.

References League\Flysystem\Filesystem\$adapter, $config, and League\Flysystem\setConfig().

+ Here is the call graph for this function:

Member Function Documentation

◆ assertAbsent()

League\Flysystem\Filesystem::assertAbsent (   $path)

Assert a file is absent.

Parameters
string$pathpath to file
Exceptions
FileExistsException
Returns
void

Definition at line 399 of file Filesystem.php.

400 {
401 if ($this->config->get('disable_asserts', false) === false && $this->has($path)) {
402 throw new FileExistsException($path);
403 }
404 }

References $path.

Referenced by League\Flysystem\Filesystem\copy(), League\Flysystem\Filesystem\rename(), League\Flysystem\Filesystem\write(), and League\Flysystem\Filesystem\writeStream().

+ Here is the caller graph for this function:

◆ assertPresent()

League\Flysystem\Filesystem::assertPresent (   $path)

Assert a file is present.

Parameters
string$pathpath to file
Exceptions
FileNotFoundException
Returns
void

Definition at line 383 of file Filesystem.php.

384 {
385 if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) {
386 throw new FileNotFoundException($path);
387 }
388 }

References $path.

Referenced by League\Flysystem\Filesystem\copy(), League\Flysystem\Filesystem\delete(), League\Flysystem\Filesystem\getMetadata(), League\Flysystem\Filesystem\getMimetype(), League\Flysystem\Filesystem\getTimestamp(), League\Flysystem\Filesystem\getVisibility(), League\Flysystem\Filesystem\read(), League\Flysystem\Filesystem\readAndDelete(), League\Flysystem\Filesystem\readStream(), League\Flysystem\Filesystem\rename(), League\Flysystem\Filesystem\update(), and League\Flysystem\Filesystem\updateStream().

+ Here is the caller graph for this function:

◆ copy()

League\Flysystem\Filesystem::copy (   $path,
  $newpath 
)

Copy a file.

Parameters
string$pathPath to the existing file.
string$newpathThe new path of the file.
Exceptions
FileExistsExceptionThrown if $newpath exists.
FileNotFoundExceptionThrown if $path does not exist.
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 219 of file Filesystem.php.

220 {
222 $newpath = Util::normalizePath($newpath);
223 $this->assertPresent($path);
224 $this->assertAbsent($newpath);
225
226 return $this->getAdapter()->copy($path, $newpath);
227 }
assertPresent($path)
Assert a file is present.
Definition: Filesystem.php:383
getAdapter()
Get the Adapter.
Definition: Filesystem.php:45
assertAbsent($path)
Assert a file is absent.
Definition: Filesystem.php:399
static normalizePath($path)
Normalize path.
Definition: Util.php:82

References $path, League\Flysystem\Filesystem\assertAbsent(), League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

+ Here is the call graph for this function:

◆ createDir()

League\Flysystem\Filesystem::createDir (   $dirname,
array  $config = [] 
)

Create a directory.

Parameters
string$dirnameThe name of the new directory.
array$configAn optional configuration array.
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 257 of file Filesystem.php.

258 {
259 $dirname = Util::normalizePath($dirname);
260 $config = $this->prepareConfig($config);
261
262 return (bool) $this->getAdapter()->createDir($dirname, $config);
263 }
prepareConfig(array $config)
Convert a config array to a Config object with the correct fallback.

References $config, League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Util\normalizePath(), and League\Flysystem\prepareConfig().

+ Here is the call graph for this function:

◆ delete()

League\Flysystem\Filesystem::delete (   $path)

Delete a file.

Parameters
string$path
Exceptions
FileNotFoundException
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 232 of file Filesystem.php.

233 {
235 $this->assertPresent($path);
236
237 return $this->getAdapter()->delete($path);
238 }

References $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

+ Here is the call graph for this function:

◆ deleteDir()

League\Flysystem\Filesystem::deleteDir (   $dirname)

Delete a directory.

Parameters
string$dirname
Exceptions
RootViolationExceptionThrown if $dirname is empty.
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 243 of file Filesystem.php.

244 {
245 $dirname = Util::normalizePath($dirname);
246
247 if ($dirname === '') {
248 throw new RootViolationException('Root directories can not be deleted.');
249 }
250
251 return (bool) $this->getAdapter()->deleteDir($dirname);
252 }

References League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

+ Here is the call graph for this function:

◆ get()

League\Flysystem\Filesystem::get (   $path,
Handler  $handler = null 
)

Get a file/directory handler.

Parameters
string$pathThe path to the file.
Handler$handlerAn optional existing handler to populate.
Returns
Handler Either a file or directory handler.

Implements League\Flysystem\FilesystemInterface.

Definition at line 359 of file Filesystem.php.

360 {
362
363 if ( ! $handler) {
364 $metadata = $this->getMetadata($path);
365 $handler = $metadata['type'] === 'file' ? new File($this, $path) : new Directory($this, $path);
366 }
367
368 $handler->setPath($path);
369 $handler->setFilesystem($this);
370
371 return $handler;
372 }
$metadata['__DYNAMIC:1__']
getMetadata($path)
Get a file's metadata.array|false The file metadata or false on failure.
Definition: Filesystem.php:348
$handler

References $handler, $metadata, $path, League\Flysystem\Filesystem\getMetadata(), and League\Flysystem\Util\normalizePath().

+ Here is the call graph for this function:

◆ getAdapter()

◆ getMetadata()

League\Flysystem\Filesystem::getMetadata (   $path)

Get a file's metadata.

Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
array|false The file metadata or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 348 of file Filesystem.php.

349 {
351 $this->assertPresent($path);
352
353 return $this->getAdapter()->getMetadata($path);
354 }

References $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

Referenced by League\Flysystem\Filesystem\get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMimetype()

League\Flysystem\Filesystem::getMimetype (   $path)

Get a file's mime-type.

Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The file mime-type or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 279 of file Filesystem.php.

280 {
282 $this->assertPresent($path);
283
284 if ( ! $object = $this->getAdapter()->getMimetype($path)) {
285 return false;
286 }
287
288 return $object['mimetype'];
289 }
getMimetype($path)
Get a file's mime-type.string|false The file mime-type or false on failure.
Definition: Filesystem.php:279

References $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Filesystem\getMimetype(), and League\Flysystem\Util\normalizePath().

Referenced by League\Flysystem\Filesystem\getMimetype().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSize()

League\Flysystem\Filesystem::getSize (   $path)

Get a file's size.

Parameters
string$pathThe path to the file.
Returns
int|false The file size or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 324 of file Filesystem.php.

325 {
327
328 if (($object = $this->getAdapter()->getSize($path)) === false || ! isset($object['size'])) {
329 return false;
330 }
331
332 return (int) $object['size'];
333 }
getSize($path)
Get a file's size.int|false The file size or false on failure.
Definition: Filesystem.php:324

References $path, League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Filesystem\getSize(), and League\Flysystem\Util\normalizePath().

Referenced by League\Flysystem\Filesystem\getSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimestamp()

League\Flysystem\Filesystem::getTimestamp (   $path)

Get a file's timestamp.

Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The timestamp or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 294 of file Filesystem.php.

295 {
297 $this->assertPresent($path);
298
299 if ( ! $object = $this->getAdapter()->getTimestamp($path)) {
300 return false;
301 }
302
303 return $object['timestamp'];
304 }
getTimestamp($path)
Get a file's timestamp.string|false The timestamp or false on failure.
Definition: Filesystem.php:294

References $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Filesystem\getTimestamp(), and League\Flysystem\Util\normalizePath().

Referenced by League\Flysystem\Filesystem\getTimestamp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVisibility()

League\Flysystem\Filesystem::getVisibility (   $path)

Get a file's visibility.

Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The visibility (public|private) or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 309 of file Filesystem.php.

310 {
312 $this->assertPresent($path);
313
314 if (($object = $this->getAdapter()->getVisibility($path)) === false) {
315 return false;
316 }
317
318 return $object['visibility'];
319 }
getVisibility($path)
Get a file's visibility.string|false The visibility (public|private) or false on failure.
Definition: Filesystem.php:309

References $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Filesystem\getVisibility(), and League\Flysystem\Util\normalizePath().

Referenced by League\Flysystem\Filesystem\getVisibility().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has()

League\Flysystem\Filesystem::has (   $path)

Check whether a file exists.

Parameters
string$path
Returns
bool

Implements League\Flysystem\FilesystemInterface.

Definition at line 53 of file Filesystem.php.

54 {
56
57 return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path);
58 }

References $path, League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

Referenced by League\Flysystem\Filesystem\put(), and League\Flysystem\Filesystem\putStream().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listContents()

League\Flysystem\Filesystem::listContents (   $directory = '',
  $recursive = false 
)

List contents of a directory.

Parameters
string$directoryThe directory to list.
bool$recursiveWhether to list recursively.
Returns
array A list of file metadata.

Implements League\Flysystem\FilesystemInterface.

Definition at line 268 of file Filesystem.php.

269 {
270 $directory = Util::normalizePath($directory);
271 $contents = $this->getAdapter()->listContents($directory, $recursive);
272
273 return (new ContentListingFormatter($directory, $recursive))->formatListing($contents);
274 }

References $contents, League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

+ Here is the call graph for this function:

◆ put()

League\Flysystem\Filesystem::put (   $path,
  $contents,
array  $config = [] 
)

Create a file or update if exists.

Parameters
string$pathThe path to the file.
string$contentsThe file contents.
array$configAn optional configuration array.
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 93 of file Filesystem.php.

94 {
97
98 if ( ! $this->adapter instanceof CanOverwriteFiles && $this->has($path)) {
99 return (bool) $this->getAdapter()->update($path, $contents, $config);
100 }
101
102 return (bool) $this->getAdapter()->write($path, $contents, $config);
103 }
has($path)
Check whether a file exists.bool
Definition: Filesystem.php:53

References $config, $contents, $path, League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Filesystem\has(), League\Flysystem\Util\normalizePath(), and League\Flysystem\prepareConfig().

+ Here is the call graph for this function:

◆ putStream()

League\Flysystem\Filesystem::putStream (   $path,
  $resource,
array  $config = [] 
)

Create a file or update if exists.

Parameters
string$pathThe path to the file.
resource$resourceThe file handle.
array$configAn optional configuration array.
Exceptions

InvalidArgumentException Thrown if $resource is not a resource.

Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 108 of file Filesystem.php.

109 {
110 if ( ! is_resource($resource)) {
111 throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.');
112 }
113
115 $config = $this->prepareConfig($config);
116 Util::rewindStream($resource);
117
118 if ( ! $this->adapter instanceof CanOverwriteFiles &&$this->has($path)) {
119 return (bool) $this->getAdapter()->updateStream($path, $resource, $config);
120 }
121
122 return (bool) $this->getAdapter()->writeStream($path, $resource, $config);
123 }
static rewindStream($resource)
Rewind a stream.
Definition: Util.php:248

References $config, $path, League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Filesystem\has(), League\Flysystem\Util\normalizePath(), League\Flysystem\prepareConfig(), and League\Flysystem\Util\rewindStream().

+ Here is the call graph for this function:

◆ read()

League\Flysystem\Filesystem::read (   $path)

Read a file.

Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The file contents or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 176 of file Filesystem.php.

177 {
179 $this->assertPresent($path);
180
181 if ( ! ($object = $this->getAdapter()->read($path))) {
182 return false;
183 }
184
185 return $object['contents'];
186 }
read($path)
Read a file.string|false The file contents or false on failure.
Definition: Filesystem.php:176

References $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Util\normalizePath(), and League\Flysystem\Filesystem\read().

Referenced by League\Flysystem\Filesystem\read(), and League\Flysystem\Filesystem\readAndDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAndDelete()

League\Flysystem\Filesystem::readAndDelete (   $path)

Read and delete a file.

Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
string|false The file contents, or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 128 of file Filesystem.php.

129 {
131 $this->assertPresent($path);
132 $contents = $this->read($path);
133
134 if ($contents === false) {
135 return false;
136 }
137
138 $this->delete($path);
139
140 return $contents;
141 }

References $contents, $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Util\normalizePath(), and League\Flysystem\Filesystem\read().

+ Here is the call graph for this function:

◆ readStream()

League\Flysystem\Filesystem::readStream (   $path)

Retrieves a read-stream for a path.

Parameters
string$pathThe path to the file.
Exceptions
FileNotFoundException
Returns
resource|false The path resource or false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 191 of file Filesystem.php.

192 {
194 $this->assertPresent($path);
195
196 if ( ! $object = $this->getAdapter()->readStream($path)) {
197 return false;
198 }
199
200 return $object['stream'];
201 }
readStream($path)
Retrieves a read-stream for a path.resource|false The path resource or false on failure.
Definition: Filesystem.php:191

References $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Util\normalizePath(), and League\Flysystem\Filesystem\readStream().

Referenced by League\Flysystem\Filesystem\readStream().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rename()

League\Flysystem\Filesystem::rename (   $path,
  $newpath 
)

Rename a file.

Parameters
string$pathPath to the existing file.
string$newpathThe new path of the file.
Exceptions
FileExistsExceptionThrown if $newpath exists.
FileNotFoundExceptionThrown if $path does not exist.
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 206 of file Filesystem.php.

207 {
209 $newpath = Util::normalizePath($newpath);
210 $this->assertPresent($path);
211 $this->assertAbsent($newpath);
212
213 return (bool) $this->getAdapter()->rename($path, $newpath);
214 }

References $path, League\Flysystem\Filesystem\assertAbsent(), League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

+ Here is the call graph for this function:

◆ setVisibility()

League\Flysystem\Filesystem::setVisibility (   $path,
  $visibility 
)

Set the visibility for a file.

Parameters
string$pathThe path to the file.
string$visibilityOne of 'public' or 'private'.
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 338 of file Filesystem.php.

339 {
341
342 return (bool) $this->getAdapter()->setVisibility($path, $visibility);
343 }

References $path, League\Flysystem\Filesystem\getAdapter(), and League\Flysystem\Util\normalizePath().

+ Here is the call graph for this function:

◆ update()

League\Flysystem\Filesystem::update (   $path,
  $contents,
array  $config = [] 
)

Update an existing file.

Parameters
string$pathThe path of the existing file.
string$contentsThe file contents.
array$configAn optional configuration array.
Exceptions
FileNotFoundException
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 146 of file Filesystem.php.

147 {
149 $config = $this->prepareConfig($config);
150
151 $this->assertPresent($path);
152
153 return (bool) $this->getAdapter()->update($path, $contents, $config);
154 }

References $config, $contents, $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Util\normalizePath(), and League\Flysystem\prepareConfig().

+ Here is the call graph for this function:

◆ updateStream()

League\Flysystem\Filesystem::updateStream (   $path,
  $resource,
array  $config = [] 
)

Update an existing file using a stream.

Parameters
string$pathThe path of the existing file.
resource$resourceThe file handle.
array$configAn optional configuration array.
Exceptions

InvalidArgumentException If $resource is not a file handle.

Exceptions
FileNotFoundException
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 159 of file Filesystem.php.

160 {
161 if ( ! is_resource($resource)) {
162 throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.');
163 }
164
166 $config = $this->prepareConfig($config);
167 $this->assertPresent($path);
168 Util::rewindStream($resource);
169
170 return (bool) $this->getAdapter()->updateStream($path, $resource, $config);
171 }

References $config, $path, League\Flysystem\Filesystem\assertPresent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Util\normalizePath(), League\Flysystem\prepareConfig(), and League\Flysystem\Util\rewindStream().

+ Here is the call graph for this function:

◆ write()

League\Flysystem\Filesystem::write (   $path,
  $contents,
array  $config = [] 
)

Write a new file.

Parameters
string$pathThe path of the new file.
string$contentsThe file contents.
array$configAn optional configuration array.
Exceptions
FileExistsException
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 63 of file Filesystem.php.

64 {
66 $this->assertAbsent($path);
68
69 return (bool) $this->getAdapter()->write($path, $contents, $config);
70 }

References $config, $contents, $path, League\Flysystem\Filesystem\assertAbsent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Util\normalizePath(), and League\Flysystem\prepareConfig().

+ Here is the call graph for this function:

◆ writeStream()

League\Flysystem\Filesystem::writeStream (   $path,
  $resource,
array  $config = [] 
)

Write a new file using a stream.

Parameters
string$pathThe path of the new file.
resource$resourceThe file handle.
array$configAn optional configuration array.
Exceptions

InvalidArgumentException If $resource is not a file handle.

Exceptions
FileExistsException
Returns
bool True on success, false on failure.

Implements League\Flysystem\FilesystemInterface.

Definition at line 75 of file Filesystem.php.

76 {
77 if ( ! is_resource($resource)) {
78 throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.');
79 }
80
82 $this->assertAbsent($path);
84
85 Util::rewindStream($resource);
86
87 return (bool) $this->getAdapter()->writeStream($path, $resource, $config);
88 }

References $config, $path, League\Flysystem\Filesystem\assertAbsent(), League\Flysystem\Filesystem\getAdapter(), League\Flysystem\Util\normalizePath(), League\Flysystem\prepareConfig(), and League\Flysystem\Util\rewindStream().

+ Here is the call graph for this function:

Field Documentation

◆ $adapter

League\Flysystem\Filesystem::$adapter
protected

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