PHP Класс Webiny\Component\Storage\Storage

Наследование: use trait Webiny\Component\StdLib\ComponentTrait
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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

deleteKey() публичный Метод

Deletes the file
public deleteKey ( string $key ) : boolean
$key string
Результат boolean

getAbsolutePath() публичный Метод

Get absolute file path
Requires '\Webiny\Component\Storage\Driver\AbsolutePathInterface' to be implemented by a Driver class
public getAbsolutePath ( $key = '' ) : mixed
$key
Результат mixed

getContents() публичный Метод

Reads the contents of the file
public getContents ( $key ) : string | boolean
Результат string | boolean if cannot read content

getDriver() публичный Метод

public getDriver ( ) : Webiny\Component\Storage\Driver\DriverInterface
Результат Webiny\Component\Storage\Driver\DriverInterface

getKeys() публичный Метод

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
Результат array

getRecentKey() публичный Метод

public getRecentKey ( )

getSize() публичный Метод

Get file size
Requires '\Webiny\Component\Storage\Driver\SizeAwareInterface' to be implemented by a Driver class
public getSize ( string $key ) : integer | boolean
$key string
Результат integer | boolean The size of the file in bytes or false

getTimeModified() публичный Метод

Returns the last modified time
public getTimeModified ( string $key, boolean $asDateTimeObject = false ) : UNIX
$key string
$asDateTimeObject boolean (Optional) Return as DateTimeObject if true
Результат UNIX Timestamp or DateTimeObject

getURL() публичный Метод

public getURL ( $key )

isDirectory() публичный Метод

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
Результат boolean

keyExists() публичный Метод

Indicates whether the key exists
public keyExists ( string $key ) : boolean
$key string
Результат boolean

renameKey() публичный Метод

Renames a file
public renameKey ( string $sourceKey, string $targetKey ) : boolean
$sourceKey string Old key
$targetKey string New key
Результат boolean

setContents() публичный Метод

Writes the given contents into the file
public setContents ( string $key, string $contents, boolean $append = false ) : boolean | integer
$key string
$contents string
$append boolean
Результат boolean | integer The number of bytes that were written into the file

supportsAbsolutePaths() публичный Метод

Can this storage handle absolute paths?
public supportsAbsolutePaths ( ) : mixed
Результат mixed

supportsDirectories() публичный Метод

Can this storage handle directories?
public supportsDirectories ( ) : mixed
Результат mixed

supportsSize() публичный Метод

Can this storage get file size info?
public supportsSize ( ) : mixed
Результат mixed

supportsTouching() публичный Метод

Can this storage touch a file?
public supportsTouching ( ) : mixed
Результат mixed

touchKey() публичный Метод

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
Результат mixed