PHP Class Webiny\Component\Storage\File\File

Inheritance: implements Webiny\Component\Storage\File\FileInterface, use trait Webiny\Component\StdLib\StdObjectTrait, use trait Webiny\Component\EventManager\EventManagerTrait
Afficher le fichier Open project: Webiny/Framework Class Usage Examples

Protected Properties

Свойство Type Description
$contents
$isDirectory
$key
$size
$storage Webiny\Component\Storage\Storage
$timeModified
$url

Méthodes publiques

Méthode Description
__construct ( string $key, Storage $storage ) : File Construct a File instance
delete ( )
exists ( ) : boolean Check if file exists
getAbsolutePath ( ) : string Get absolute file path.
getContents ( )
getKey ( )
getSize ( ) : integer | null Get file size in bytes
getStorage ( )
getTimeModified ( $asDateTimeObject = false )
getUrl ( )
isDirectory ( ) : boolean Checks if file is a directory.
rename ( $newKey )
setContents ( $contents, $append = false )
touch ( ) Touch a file (change time modified)

Method Details

__construct() public méthode

Construct a File instance
public __construct ( string $key, Storage $storage ) : File
$key string File key
$storage Webiny\Component\Storage\Storage Storage to use
Résultat File

delete() public méthode

public delete ( )

exists() public méthode

Check if file exists
public exists ( ) : boolean
Résultat boolean

getAbsolutePath() public méthode

If storage driver does not support absolute paths (cloud storage) returns file key
public getAbsolutePath ( ) : string
Résultat string

getContents() public méthode

public getContents ( )

getKey() public méthode

public getKey ( )

getSize() public méthode

Get file size in bytes
public getSize ( ) : integer | null
Résultat integer | null Number of bytes or null

getStorage() public méthode

public getStorage ( )

getTimeModified() public méthode

public getTimeModified ( $asDateTimeObject = false )

getUrl() public méthode

public getUrl ( )

isDirectory() public méthode

Need this method for easier checks when looping through directories.
public isDirectory ( ) : boolean
Résultat boolean

rename() public méthode

public rename ( $newKey )

setContents() public méthode

public setContents ( $contents, $append = false )

touch() public méthode

Touch a file (change time modified)
public touch ( )

Property Details

$contents protected_oe property

protected $contents

$isDirectory protected_oe property

protected $isDirectory

$key protected_oe property

protected $key

$size protected_oe property

protected $size

$storage protected_oe property

protected Storage,Webiny\Component\Storage $storage
Résultat Webiny\Component\Storage\Storage

$timeModified protected_oe property

protected $timeModified

$url protected_oe property

protected $url