PHP Класс Bolt\Stack

Each user (by design) has their own stack. No sharesies!
Автор: Bob den Otter, [email protected]
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( Matcher $matcher, Users $users, Symfony\Component\HttpFoundation\Session\SessionInterface $session, string[] $acceptedFileTypes ) Constructor.
add ( Bolt\Filesystem\Handler\FileInterface | string $filename, Bolt\Filesystem\Handler\FileInterface &$removed = null ) : Bolt\Filesystem\Handler\FileInterface Add a file to the stack.
contains ( Bolt\Filesystem\Handler\FileInterface | string $filename ) : boolean Check if a given file is present on the stack.
count ( )
delete ( Bolt\Filesystem\Handler\FileInterface | string $filename ) Delete a file from the stack.
getIterator ( )
getList ( array $types = [] ) : Bolt\Filesystem\Handler\FileInterface[] Returns the list of files in the stack, filtered by type (if given).
isStackable ( Bolt\Filesystem\Handler\FileInterface | string $filename ) : boolean Check if a given file can be added to the stack.

Приватные методы

Метод Описание
hydrateList ( string[] $paths ) : Bolt\Filesystem\Handler\FileInterface[] Converts a list of paths to file objects.
initialize ( ) Initialize file list for current user, either from session or database.
persist ( ) Persist the contents of the current stack to the session, as well as the database.
persistableList ( ) : string[] Returns the list of files as full paths.

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

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

Constructor.
public __construct ( Matcher $matcher, Users $users, Symfony\Component\HttpFoundation\Session\SessionInterface $session, string[] $acceptedFileTypes )
$matcher Bolt\Filesystem\Matcher
$users Users
$session Symfony\Component\HttpFoundation\Session\SessionInterface
$acceptedFileTypes string[]

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

Add a file to the stack.
public add ( Bolt\Filesystem\Handler\FileInterface | string $filename, Bolt\Filesystem\Handler\FileInterface &$removed = null ) : Bolt\Filesystem\Handler\FileInterface
$filename Bolt\Filesystem\Handler\FileInterface | string The file to add.
$removed Bolt\Filesystem\Handler\FileInterface Returns the removed file, if one was removed.
Результат Bolt\Filesystem\Handler\FileInterface If filename cannot be matched to filesystem.

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

Check if a given file is present on the stack.
public contains ( Bolt\Filesystem\Handler\FileInterface | string $filename ) : boolean
$filename Bolt\Filesystem\Handler\FileInterface | string
Результат boolean

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

public count ( )

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

Delete a file from the stack.
public delete ( Bolt\Filesystem\Handler\FileInterface | string $filename )
$filename Bolt\Filesystem\Handler\FileInterface | string

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

public getIterator ( )

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

Returns the list of files in the stack, filtered by type (if given).
public getList ( array $types = [] ) : Bolt\Filesystem\Handler\FileInterface[]
$types array Filter files by type. Valid types: "image", "document", "other"
Результат Bolt\Filesystem\Handler\FileInterface[]

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

Requirements: - File's extension is accepted - File can be matched to filesystem - File is not currently on the stack
public isStackable ( Bolt\Filesystem\Handler\FileInterface | string $filename ) : boolean
$filename Bolt\Filesystem\Handler\FileInterface | string
Результат boolean