PHP Class Gaufrette\File

Author: Antoine Hérault ([email protected])
Datei anzeigen Open project: knplabs/gaufrette Class Usage Examples

Protected Properties

Property Type Description
$content Content variable is lazy. It will not be read from filesystem until it's requested first time.
$filesystem
$key
$metadata metadata in associative array. Only for adapters that support metadata
$mtime File date modified.
$name Human readable filename (usually the end of the key).
$size File size in bytes.

Public Methods

Method Description
__construct ( string $key, gaufrette\Filesystem $filesystem )
createStream ( ) : gaufrette\Stream Creates a new file stream instance of the file.
delete ( array $metadata = [] ) : boolean Deletes the file from the filesystem.
exists ( ) : boolean Indicates whether the file exists in the filesystem.
getContent ( array $metadata = [] ) : string Returns the content.
getKey ( ) : string Returns the key.
getMtime ( ) : integer Returns the file modified time.
getName ( ) : string
getSize ( ) : integer
setContent ( string $content, array $metadata = [] ) : integer Sets the content.
setName ( string $name )
setSize ( integer $size )

Protected Methods

Method Description
setMetadata ( array $metadata ) : boolean Sets the metadata array to be stored in adapters that can support it.

Private Methods

Method Description
supportsMetadata ( ) : boolean

Method Details

__construct() public method

public __construct ( string $key, gaufrette\Filesystem $filesystem )
$key string
$filesystem gaufrette\Filesystem

createStream() public method

Creates a new file stream instance of the file.
public createStream ( ) : gaufrette\Stream
return gaufrette\Stream

delete() public method

Deletes the file from the filesystem.
public delete ( array $metadata = [] ) : boolean
$metadata array optional metadata which should be send when write
return boolean TRUE on success

exists() public method

Indicates whether the file exists in the filesystem.
public exists ( ) : boolean
return boolean

getContent() public method

Returns the content.
public getContent ( array $metadata = [] ) : string
$metadata array optional metadata which should be set when read
return string

getKey() public method

Returns the key.
public getKey ( ) : string
return string

getMtime() public method

Returns the file modified time.
public getMtime ( ) : integer
return integer

getName() public method

public getName ( ) : string
return string name of the file

getSize() public method

public getSize ( ) : integer
return integer size of the file

setContent() public method

Sets the content.
public setContent ( string $content, array $metadata = [] ) : integer
$content string
$metadata array optional metadata which should be send when write
return integer The number of bytes that were written into the file, or FALSE on failure

setMetadata() protected method

Sets the metadata array to be stored in adapters that can support it.
protected setMetadata ( array $metadata ) : boolean
$metadata array
return boolean

setName() public method

public setName ( string $name )
$name string name of the file

setSize() public method

public setSize ( integer $size )
$size integer size of the file

Property Details

$content protected_oe property

Content variable is lazy. It will not be read from filesystem until it's requested first time.
protected $content

$filesystem protected_oe property

protected $filesystem

$key protected_oe property

protected $key

$metadata protected_oe property

metadata in associative array. Only for adapters that support metadata
protected $metadata

$mtime protected_oe property

File date modified.
protected $mtime

$name protected_oe property

Human readable filename (usually the end of the key).
protected $name

$size protected_oe property

File size in bytes.
protected $size