Notifier
in package
implements
Iterator
A class for user notifications.
It contains a stack of notifications that can be rendered at once. Alternatively a Notification is rendered and returned as soon as added.
We have four levels of severity: info, notice, warning, error
Interfaces, Classes and Traits
- Iterator
Table of Contents
- $notifications : array<string|int, mixed>
- $renderer : The
- __construct() : mixed
- Constructs a Notifier Object
- __destruct() : mixed
- add() : mixed
- adds a notification to the stack and returns it rendered
- current() : mixed
- error() : mixed
- adds a notification of type error to the stack and returns it rendered
- info() : mixed
- adds a notification of type info to the stack and returns it rendered
- key() : mixed
- next() : mixed
- notice() : mixed
- adds a notification of type notice to the stack and returns it rendered
- render() : mixed
- Returns the rendered Notifications
- rewind() : mixed
- valid() : mixed
- warning() : mixed
- adds a notification of type warning to the stack and returns it rendered
Properties
$notifications
private
array<string|int, mixed>
$notifications
= array()
the notifications of the form
[ type => '', msg => '' ]
$renderer
private
The
$renderer
configured renderer for presentation
Methods
__construct()
Constructs a Notifier Object
public
__construct(mixed $renderer) : mixed
Parameters
- $renderer : mixed
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —add()
adds a notification to the stack and returns it rendered
public
add(string $msg[, string $type = 'info' ]) : mixed
Parameters
- $msg : string
-
The Notification message to be shown to the User
- $type : string = 'info'
-
The Notification Level. One of: info, notice, warning or error
Return values
mixed —current()
public
current() : mixed
Return values
mixed —error()
adds a notification of type error to the stack and returns it rendered
public
error(string $msg) : mixed
Parameters
- $msg : string
-
The Notification message to be shown to the User
Return values
mixed —info()
adds a notification of type info to the stack and returns it rendered
public
info(string $msg) : mixed
Parameters
- $msg : string
-
The Notification message to be shown to the User
Return values
mixed —key()
public
key() : mixed
Return values
mixed —next()
public
next() : mixed
Return values
mixed —notice()
adds a notification of type notice to the stack and returns it rendered
public
notice(string $msg) : mixed
Parameters
- $msg : string
-
The Notification message to be shown to the User
Return values
mixed —render()
Returns the rendered Notifications
public
render([mixed $type = null ][, mixed $renderer = null ]) : mixed
Parameters
- $type : mixed = null
- $renderer : mixed = null
Return values
mixed —rewind()
public
rewind() : mixed
Return values
mixed —valid()
public
valid() : mixed
Return values
mixed —warning()
adds a notification of type warning to the stack and returns it rendered
public
warning(string $msg) : mixed
Parameters
- $msg : string
-
The Notification message to be shown to the User