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
显示文件 Open project: Webiny/Framework Class Usage Examples

Protected Properties

Property Type Description
$contents
$isDirectory
$key
$size
$storage Webiny\Component\Storage\Storage
$timeModified
$url

Public Methods

Method 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 method

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

delete() public method

public delete ( )

exists() public method

Check if file exists
public exists ( ) : boolean
return boolean

getAbsolutePath() public method

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

getContents() public method

public getContents ( )

getKey() public method

public getKey ( )

getSize() public method

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

getStorage() public method

public getStorage ( )

getTimeModified() public method

public getTimeModified ( $asDateTimeObject = false )

getUrl() public method

public getUrl ( )

isDirectory() public method

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

rename() public method

public rename ( $newKey )

setContents() public method

public setContents ( $contents, $append = false )

touch() public method

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
return Webiny\Component\Storage\Storage

$timeModified protected_oe property

protected $timeModified

$url protected_oe property

protected $url