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

Наследование: implements Webiny\Component\Storage\Directory\DirectoryInterface, implements IteratorAggregate, use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\EventManager\EventManagerTrait
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$items
$key
$recursive
$regex
$storage

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

Метод Описание
__construct ( string $key, Storage $storage, boolean $recursive = false, null | string $filter = null ) Constructor
count ( ) : integer Count number of items in a directory
delete ( $fireStorageEvents = true )
filter ( string $condition ) : Directory Filter items in a directory using given regex or extension.
getAbsolutePath ( ) : string Get absolute folder path
getIterator ( ) : Traversable (PHP 5 >= 5.0.0)
Retrieve an external iterator
getKey ( ) : string Get directory key
getSize ( ) Get directory size
getStorage ( ) : Storage Get Storage used by the DirectoryInterface instance
isDirectory ( ) : boolean Checks if file is a directory.

Защищенные методы

Метод Описание
loadItems ( )
parseFilter ( $filter )

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

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

Constructor
public __construct ( string $key, Storage $storage, boolean $recursive = false, null | string $filter = null )
$key string File key
$storage Webiny\Component\Storage\Storage Storage to use
$recursive boolean (Optional) By default, Directory will only read the first level if items. If set to true, Directory will read all children items and list them as one-dimensional array.
$filter null | string (Optional) Filter to use when reading directory items

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

Count number of items in a directory
public count ( ) : integer
Результат integer

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

public delete ( $fireStorageEvents = true )

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

Example 1: '*.pdf' ($condition starting with * means: anything that ends with) Example 2: 'file*' ($condition ending with * means: anything that starts with) Example 3: Any file that ends with file.zip: '/(\S+)?file.zip/'
public filter ( string $condition ) : Directory
$condition string
Результат Directory

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

Get absolute folder path
public getAbsolutePath ( ) : string
Результат string

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

(PHP 5 >= 5.0.0)
Retrieve an external iterator
public getIterator ( ) : Traversable
Результат Traversable An instance of an object implementing Iterator or Traversable

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

Get directory key
public getKey ( ) : string
Результат string Directory key

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

WARNING! This is a very intensive operation especially on deep directory structures! It is performed by recursively walking through directory structure and getting each file's size.
public getSize ( )

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

Get Storage used by the DirectoryInterface instance
public getStorage ( ) : Storage
Результат Webiny\Component\Storage\Storage

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

Checks if file is a directory.
public static isDirectory ( ) : boolean
Результат boolean

loadItems() защищенный Метод

protected loadItems ( )

parseFilter() защищенный Метод

protected parseFilter ( $filter )

Описание свойств

$items защищенное свойство

protected $items

$key защищенное свойство

protected $key

$recursive защищенное свойство

protected $recursive

$regex защищенное свойство

protected $regex

$storage защищенное свойство

protected $storage