NotificationsBag
in package
implements
NotificationsBagInterface
Interfaces, Classes, Traits and Enums
Table of Contents
- $flashes : array<string|int, mixed>
- $name : string
- $storageKey : mixed
- __construct() : mixed
- add() : mixed
- Adds a notification for the given type.
- all() : array<string|int, mixed>
- Gets and clears from the stack.
- clear() : mixed
- {@inheritdoc}
- get() : array<string|int, mixed>
- Gets and clears from the stack.
- getName() : string
- {@inheritdoc}
- getStorageKey() : mixed
- {@inheritdoc}
- has() : bool
- Has notifications for a given type?
- initialize() : mixed
- {@inheritdoc}
- keys() : array<string|int, mixed>
- Returns a list of all defined types.
- peek() : array<string|int, mixed>
- Gets notifications for a given type.
- peekAll() : array<string|int, mixed>
- Gets all notifications.
- set() : mixed
- Registers one or more notifications for a given type.
- setAll() : mixed
- Sets all notifications.
- setName() : mixed
Properties
$flashes
private
array<string|int, mixed>
$flashes
= []
$name
private
string
$name
= 'notifications'
$storageKey
private
mixed
$storageKey
Methods
__construct()
public
__construct([string $storageKey = '_lotgd_notifications' ]) : mixed
Parameters
- $storageKey : string = '_lotgd_notifications'
-
The key used to store notifications in the session
Return values
mixed —add()
Adds a notification for the given type.
public
add(mixed $type, mixed $message) : mixed
Parameters
- $type : mixed
- $message : mixed
Return values
mixed —all()
Gets and clears from the stack.
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed> —clear()
{@inheritdoc}
public
clear() : mixed
Return values
mixed —get()
Gets and clears from the stack.
public
get(mixed $type[, array<string|int, mixed> $default = [] ]) : array<string|int, mixed>
Parameters
- $type : mixed
- $default : array<string|int, mixed> = []
-
Default value if $type does not exist
Return values
array<string|int, mixed> —getName()
{@inheritdoc}
public
getName() : string
Return values
string —getStorageKey()
{@inheritdoc}
public
getStorageKey() : mixed
Return values
mixed —has()
Has notifications for a given type?
public
has(mixed $type) : bool
Parameters
- $type : mixed
Return values
bool —initialize()
{@inheritdoc}
public
initialize(array<string|int, mixed> &$flashes) : mixed
Parameters
- $flashes : array<string|int, mixed>
Return values
mixed —keys()
Returns a list of all defined types.
public
keys() : array<string|int, mixed>
Return values
array<string|int, mixed> —peek()
Gets notifications for a given type.
public
peek(mixed $type[, array<string|int, mixed> $default = [] ]) : array<string|int, mixed>
Parameters
- $type : mixed
-
Notification category type
- $default : array<string|int, mixed> = []
-
Default value if $type does not exist
Return values
array<string|int, mixed> —peekAll()
Gets all notifications.
public
peekAll() : array<string|int, mixed>
Return values
array<string|int, mixed> —set()
Registers one or more notifications for a given type.
public
set(mixed $type, mixed $messages) : mixed
Parameters
- $type : mixed
- $messages : mixed
Return values
mixed —setAll()
Sets all notifications.
public
setAll(array<string|int, mixed> $messages) : mixed
Parameters
- $messages : array<string|int, mixed>
Return values
mixed —setName()
public
setName(string $name) : mixed
Parameters
- $name : string