PHP Class Webiny\Component\Storage\Storage

Inheritance: use trait Webiny\Component\StdLib\ComponentTrait
Afficher le fichier Open project: Webiny/Framework Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Webiny\Component\Storage\Driver\DriverInterface $driver )
deleteKey ( string $key ) : boolean Deletes the file
getAbsolutePath ( $key = '' ) : mixed Get absolute file path
Requires '\Webiny\Component\Storage\Driver\AbsolutePathInterface' to be implemented by a Driver class
getContents ( $key ) : string | boolean Reads the contents of the file
getDriver ( ) : Webiny\Component\Storage\Driver\DriverInterface
getKeys ( string $key = '', boolean | integer $recursive = false ) : array Returns an array of all keys (files and directories)
getRecentKey ( )
getSize ( string $key ) : integer | boolean Get file size
Requires '\Webiny\Component\Storage\Driver\SizeAwareInterface' to be implemented by a Driver class
getTimeModified ( string $key, boolean $asDateTimeObject = false ) : UNIX Returns the last modified time
getURL ( $key )
isDirectory ( string $key ) : boolean Check if key is a directory
Requires '\Webiny\Component\Storage\Driver\DirectoryAwareInterface' to be implemented by a Driver class
keyExists ( string $key ) : boolean Indicates whether the key exists
renameKey ( string $sourceKey, string $targetKey ) : boolean Renames a file
setContents ( string $key, string $contents, boolean $append = false ) : boolean | integer Writes the given contents into the file
supportsAbsolutePaths ( ) : mixed Can this storage handle absolute paths?
supportsDirectories ( ) : mixed Can this storage handle directories?
supportsSize ( ) : mixed Can this storage get file size info?
supportsTouching ( ) : mixed Can this storage touch a file?
touchKey ( string $key ) : mixed Touch a file (change time modified)
Requires '\Webiny\Component\Storage\Driver\TouchableInterface' to be implemented by a Driver class

Method Details

__construct() public méthode

public __construct ( Webiny\Component\Storage\Driver\DriverInterface $driver )
$driver Webiny\Component\Storage\Driver\DriverInterface

deleteKey() public méthode

Deletes the file
public deleteKey ( string $key ) : boolean
$key string
Résultat boolean

getAbsolutePath() public méthode

Get absolute file path
Requires '\Webiny\Component\Storage\Driver\AbsolutePathInterface' to be implemented by a Driver class
public getAbsolutePath ( $key = '' ) : mixed
$key
Résultat mixed

getContents() public méthode

Reads the contents of the file
public getContents ( $key ) : string | boolean
Résultat string | boolean if cannot read content

getDriver() public méthode

public getDriver ( ) : Webiny\Component\Storage\Driver\DriverInterface
Résultat Webiny\Component\Storage\Driver\DriverInterface

getKeys() public méthode

Returns an array of all keys (files and directories)
public getKeys ( string $key = '', boolean | integer $recursive = false ) : array
$key string Key of a directory to get keys from. If not set - keys will be read from the storage root.
$recursive boolean | integer false = non-recursive, true = recursive, int = recursion depth
Résultat array

getRecentKey() public méthode

public getRecentKey ( )

getSize() public méthode

Get file size
Requires '\Webiny\Component\Storage\Driver\SizeAwareInterface' to be implemented by a Driver class
public getSize ( string $key ) : integer | boolean
$key string
Résultat integer | boolean The size of the file in bytes or false

getTimeModified() public méthode

Returns the last modified time
public getTimeModified ( string $key, boolean $asDateTimeObject = false ) : UNIX
$key string
$asDateTimeObject boolean (Optional) Return as DateTimeObject if true
Résultat UNIX Timestamp or DateTimeObject

getURL() public méthode

public getURL ( $key )

isDirectory() public méthode

Check if key is a directory
Requires '\Webiny\Component\Storage\Driver\DirectoryAwareInterface' to be implemented by a Driver class
public isDirectory ( string $key ) : boolean
$key string
Résultat boolean

keyExists() public méthode

Indicates whether the key exists
public keyExists ( string $key ) : boolean
$key string
Résultat boolean

renameKey() public méthode

Renames a file
public renameKey ( string $sourceKey, string $targetKey ) : boolean
$sourceKey string Old key
$targetKey string New key
Résultat boolean

setContents() public méthode

Writes the given contents into the file
public setContents ( string $key, string $contents, boolean $append = false ) : boolean | integer
$key string
$contents string
$append boolean
Résultat boolean | integer The number of bytes that were written into the file

supportsAbsolutePaths() public méthode

Can this storage handle absolute paths?
public supportsAbsolutePaths ( ) : mixed
Résultat mixed

supportsDirectories() public méthode

Can this storage handle directories?
public supportsDirectories ( ) : mixed
Résultat mixed

supportsSize() public méthode

Can this storage get file size info?
public supportsSize ( ) : mixed
Résultat mixed

supportsTouching() public méthode

Can this storage touch a file?
public supportsTouching ( ) : mixed
Résultat mixed

touchKey() public méthode

Touch a file (change time modified)
Requires '\Webiny\Component\Storage\Driver\TouchableInterface' to be implemented by a Driver class
public touchKey ( string $key ) : mixed
$key string
Résultat mixed