Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | List of all members
Elgg\Filesystem\Directory Interface Reference

A simple directory abstraction. More...

Inheritance diagram for Elgg\Filesystem\Directory:
Elgg\Filesystem\Directory\Fly

Public Member Functions

 chroot ($path)
 Returns a subdirectory with access limited to the given directory. More...
 
 getContents ($path)
 Read the file off the filesystem. More...
 
 getFile ($path)
 A reference to the file at the given path, even if it doesn't exist yet. More...
 
 getFiles ($path= '', $recursive=true)
 List the files in the given directory path. More...
 
 getDirectories ($path= '', $recursive=true)
 List the directories in the given directory path. More...
 
 getPath ($path= '')
 Get the absolute path to the given directory-relative path. More...
 
 includeFile ($path)
 Do a PHP include of the file and return the result. More...
 
 isFile ($path)
 Whether this directory has an existing file at the given location. More...
 
 putContents ($path, $content)
 Write a file, overwriting the contents if necessary. More...
 

Detailed Description

A simple directory abstraction.

Since
1.10.2

private

Definition at line 13 of file Directory.php.

Member Function Documentation

Elgg\Filesystem\Directory::chroot (   $path)

Returns a subdirectory with access limited to the given directory.

Parameters
string$pathThe path relative to this directory to chroot to.
Returns
Directory A new directory instance.
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::getContents (   $path)

Read the file off the filesystem.

Parameters
string$pathThe directory-relative path to the target file.
Returns
string Empty string if the file doesn't exist.
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::getDirectories (   $path = '',
  $recursive = true 
)

List the directories in the given directory path.

Parameters
string$pathThe subdirectory path within this directory
bool$recursiveFind directories recursively
Returns
Collection<Directory>
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::getFile (   $path)

A reference to the file at the given path, even if it doesn't exist yet.

However, will throw an exception if the file is already a directory.

Parameters
string$pathThe path to the file, relative to this directory.
Returns
File
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::getFiles (   $path = '',
  $recursive = true 
)

List the files in the given directory path.

Parameters
string$pathThe subdirectory path within this directory
bool$recursiveFind files recursively
Returns
Collection<File>
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::getPath (   $path = '')

Get the absolute path to the given directory-relative path.

Parameters
string$pathA file/directory path within this directory.
Returns
string
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::includeFile (   $path)

Do a PHP include of the file and return the result.

NB: This only really works with local filesystems amirite?

Parameters
string$pathFilesystem-relative path for the file to include.
Returns
mixed
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::isFile (   $path)

Whether this directory has an existing file at the given location.

Parameters
string$pathThe relative path within this directory
Returns
boolean
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.

Elgg\Filesystem\Directory::putContents (   $path,
  $content 
)

Write a file, overwriting the contents if necessary.

Parameters
string$pathThe path to the file.
string$contentThe literal text content of the file.
Returns
void
Exceptions
\InvalidArgumentException

Implemented in Elgg\Filesystem\Directory\Fly.


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