PHP Class Elgg\Filesystem\File

Since: 1.10.0
Mostra file Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( Elgg\Filesystem\Directory $directory, string $path ) Constructor
__toString ( )
exists ( ) : boolean
getBasename ( ) : string
getContents ( ) : string Get the text content of this file. Empty string if it doesn't exist.
getExtension ( ) : string
getPath ( ) : string
includeFile ( ) : mixed Do a PHP include of the file and return the result.
putContents ( string $content ) : void Put content into this file.

Method Details

__construct() public method

Constructor
public __construct ( Elgg\Filesystem\Directory $directory, string $path )
$directory Elgg\Filesystem\Directory The directory where this file resides
$path string The path to this file relative to the directory

__toString() public method

public __toString ( )

exists() public method

public exists ( ) : boolean
return boolean Whether this file exists.

getBasename() public method

public getBasename ( ) : string
return string The file's basename.

getContents() public method

Get the text content of this file. Empty string if it doesn't exist.
public getContents ( ) : string
return string

getExtension() public method

public getExtension ( ) : string
return string The file's extension.

getPath() public method

public getPath ( ) : string
return string The full path to this file.

includeFile() public method

TODO(ewinslow): This may only work for local filesystems?
public includeFile ( ) : mixed
return mixed

putContents() public method

Put content into this file.
public putContents ( string $content ) : void
$content string File content
return void