Property | Type | Description | |
---|---|---|---|
$container | string | NotificationBag container name. | |
$defaultFormat | string | Default format for all message types. | |
$formats | array | Default formats for types. | |
$groupForRender | array | Sequence of how messages should be rendered by its type. | |
$matcher | array | Array of matcher for extracting types. | |
$notification | Krucas\Notification\Notification | Notification library instance. | |
$notifications | Krucas\Notification\Collection | null | Collection to store all instant notification messages. | |
$types | array | Available message types in container. |
Method | Description | |
---|---|---|
__call ( $name, $arguments ) : |
Execute short version of function calls. | |
__construct ( $container, array $types = [], null $defaultFormat = null, array $formats = [] ) | Creates new NotificationBag object. | |
__toString ( ) : string | Convert the Bag to its string representation. | |
add ( $type, string | Krucas\Notification\Message | Closure $message, boolean $flash = true, null $format = null ) : |
Adds new notification message to one of collections. | |
addToGrouping ( $type ) : |
Adds type for rendering. | |
addType ( $type ) : |
Add new available type of message to bag. | |
all ( ) : Krucas\Notification\Collection | Returns all messages in bag. | |
clear ( null $type = null ) : |
Clears message for a given type. | |
clearAll ( ) : |
Clears all messages. | |
clearFormat ( $type ) : |
Clear format for a given type. | |
clearFormats ( ) : |
Clear all formats. | |
clearTypes ( ) : |
Resets types values. | |
count ( ) : integer | Count the number of colections. | |
first ( ) : Krucas\Notification\Message | Returns first message object for given type. | |
get ( $type ) : Krucas\Notification\Collection | Returns all messages for given type. | |
getDefaultFormat ( ) : string | Return default format. | |
getFormat ( $type ) : boolean | string | Return format for a given type. | |
getGroupingForRender ( ) : array | Return array with groups list for rendering. | |
getName ( ) : string | Returns assigned container name. | |
getNotification ( ) : Krucas\Notification\Notification | Get notification instance. | |
getTypes ( ) : array | Return available types of messages in container. | |
group ( ) : |
Set order to render types. | |
has ( $type = null ) : boolean | Check if a message is set for given type. | |
removeFromGrouping ( $type ) : |
Removes type from rendering. | |
setDefaultFormat ( $format ) : |
Set default format for all message types. | |
setFormat ( $type, $format ) : |
Set format for a given type. | |
setFormats ( $formats ) : |
Set formats for a given types. | |
setNotification ( Krucas\Notification\Notification $notification ) : void | Set notification instance. | |
show ( null $type = null, null $format = null ) : string | Returns generated output of non flash messages. | |
showAll ( null $format = null ) : string | Renders all messages. | |
toArray ( ) : array | Get the instance as an array. | |
toJson ( integer $options ) : string | Convert the object to its JSON representation. | |
typeIsAvailable ( $type ) : boolean | Determines if type is available in container. | |
unsetNotification ( ) : void | Unset notification instance. |
Method | Description | |
---|---|---|
addInstance ( Krucas\Notification\Message $message, string $type, boolean $flash = true, null $format = null ) | Add message by instance. | |
checkFormat ( $format, null $type = null ) : null | Returns valid format. | |
extractType ( $name ) : boolean | array | Extract type from a given string. | |
fireEvent ( $event, $message ) : boolean | Fire event for a given message. | |
getMessagesForRender ( null $type = null ) : Krucas\Notification\Collection | Resolves which messages should be returned for rendering. |
public __toString ( ) : string | ||
return | string |
public addToGrouping ( $type ) : |
||
$type | ||
return |
public addType ( $type ) : |
||
$type | ||
return |
public all ( ) : Krucas\Notification\Collection | ||
return | Krucas\Notification\Collection |
protected checkFormat ( $format, null $type = null ) : null | ||
$format | ||
$type | null | |
return | null |
public clearAll ( ) : |
||
return |
public clearFormat ( $type ) : |
||
$type | ||
return |
public clearFormats ( ) : |
||
return |
public clearTypes ( ) : |
||
return |
protected extractType ( $name ) : boolean | array | ||
$name | ||
return | boolean | array |
public first ( ) : Krucas\Notification\Message | ||
return | Krucas\Notification\Message |
public get ( $type ) : Krucas\Notification\Collection | ||
$type | ||
return | Krucas\Notification\Collection |
public getDefaultFormat ( ) : string | ||
return | string |
public getGroupingForRender ( ) : array | ||
return | array |
protected getMessagesForRender ( null $type = null ) : Krucas\Notification\Collection | ||
$type | null | |
return | Krucas\Notification\Collection |
public getNotification ( ) : Krucas\Notification\Notification | ||
return | Krucas\Notification\Notification |
public group ( ) : |
||
return |
public removeFromGrouping ( $type ) : |
||
$type | ||
return |
public setDefaultFormat ( $format ) : |
||
$format | ||
return |
public setFormat ( $type, $format ) : |
||
$type | ||
$format | ||
return |
public setFormats ( $formats ) : |
||
$formats | ||
return |
public setNotification ( Krucas\Notification\Notification $notification ) : void | ||
$notification | Krucas\Notification\Notification | |
return | void |
public typeIsAvailable ( $type ) : boolean | ||
$type | ||
return | boolean |
public unsetNotification ( ) : void | ||
return | void |
protected string $container | ||
return | string |
protected string $defaultFormat | ||
return | string |
protected array $groupForRender | ||
return | array |
protected array $matcher | ||
return | array |
protected Notification,Krucas\Notification $notification | ||
return | Krucas\Notification\Notification |
protected Collection,Krucas\Notification|null $notifications | ||
return | Krucas\Notification\Collection | null |