PHP Class Bolt\Stack

Each user (by design) has their own stack. No sharesies!
Author: Bob den Otter, [email protected]
Afficher le fichier Open project: bolt/bolt Class Usage Examples

Méthodes publiques

Méthode Description
__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.

Private Methods

Méthode Description
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.

Method Details

__construct() public méthode

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() public méthode

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.
Résultat Bolt\Filesystem\Handler\FileInterface If filename cannot be matched to filesystem.

contains() public méthode

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
Résultat boolean

count() public méthode

public count ( )

delete() public méthode

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

getIterator() public méthode

public getIterator ( )

getList() public méthode

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"
Résultat Bolt\Filesystem\Handler\FileInterface[]

isStackable() public méthode

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
Résultat boolean