final class SessionFlashBag implements FlashBagInterface (View source)

Stores flash values in one normalized namespace of the current session

Constants

private NAMESPACE_NAME

Methods

Connects the bag to the session that persists its transient values

void
set(string $key, mixed $value)

Stores or replaces a flash value in the dedicated session namespace

void
mixed
get(string $key, mixed $default = null)

Returns a flash value while leaving it available for later reads

mixed
bool
has(string $key)

Checks the normalized flash namespace for the key

bool
void
remove(string $key)

Removes a flash value without returning it

void
mixed
pull(string $key, mixed $default = null)

Returns a flash value and removes it during the current request.

mixed
array
all()

Returns all normalized flash values without mutating the bag

array
void
clear()

Removes the complete flash namespace from the session

void

Details

__construct

__construct(SessionInterface $session)

Connects the bag to the session that persists its transient values

Parameters

SessionInterface $session

set

void set(string $key, mixed $value)

Stores or replaces a flash value in the dedicated session namespace

Parameters

string $key
mixed $value

Return Value

void

get

mixed get(string $key, mixed $default = null)

Returns a flash value while leaving it available for later reads

Parameters

string $key
mixed $default

Return Value

mixed

has

bool has(string $key)

Checks the normalized flash namespace for the key

Parameters

string $key

Return Value

bool

remove

void remove(string $key)

Removes a flash value without returning it

Parameters

string $key

Return Value

void

pull

mixed pull(string $key, mixed $default = null)

Returns a flash value and removes it during the current request.

Parameters

string $key
mixed $default

Return Value

mixed

all

array all()

Returns all normalized flash values without mutating the bag

Return Value

array

clear

void clear()

Removes the complete flash namespace from the session

Return Value

void