PHP 클래스 Krucas\Notification\NotificationsBag

상속: implements Illuminate\Support\Contracts\ArrayableInterface, implements Illuminate\Support\Contracts\JsonableInterface, implements Countabl\Countable
파일 보기 프로젝트 열기: edvinaskrucas/notification 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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.

공개 메소드들

메소드 설명
__call ( $name, $arguments ) : NotificationsBag | string 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 ) : NotificationsBag Adds new notification message to one of collections.
addToGrouping ( $type ) : NotificationsBag Adds type for rendering.
addType ( $type ) : NotificationsBag Add new available type of message to bag.
all ( ) : Krucas\Notification\Collection Returns all messages in bag.
clear ( null $type = null ) : NotificationsBag Clears message for a given type.
clearAll ( ) : NotificationsBag Clears all messages.
clearFormat ( $type ) : NotificationsBag Clear format for a given type.
clearFormats ( ) : NotificationsBag Clear all formats.
clearTypes ( ) : NotificationsBag 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 ( ) : NotificationsBag Set order to render types.
has ( $type = null ) : boolean Check if a message is set for given type.
removeFromGrouping ( $type ) : NotificationsBag Removes type from rendering.
setDefaultFormat ( $format ) : NotificationsBag Set default format for all message types.
setFormat ( $type, $format ) : NotificationsBag Set format for a given type.
setFormats ( $formats ) : NotificationsBag 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.

보호된 메소드들

메소드 설명
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.

메소드 상세

__call() 공개 메소드

Execute short version of function calls.
public __call ( $name, $arguments ) : NotificationsBag | string
$name
$arguments
리턴 NotificationsBag | string

__construct() 공개 메소드

Creates new NotificationBag object.
public __construct ( $container, array $types = [], null $defaultFormat = null, array $formats = [] )
$container
$types array
$defaultFormat null
$formats array

__toString() 공개 메소드

Convert the Bag to its string representation.
public __toString ( ) : string
리턴 string

add() 공개 메소드

If message is array, adds multiple messages. Message can be string, array (array can contain string for message, or array of message and format). Flashes flashable messages.
public add ( $type, string | Krucas\Notification\Message | Closure $message, boolean $flash = true, null $format = null ) : NotificationsBag
$type
$message string | Krucas\Notification\Message | Closure
$flash boolean
$format null
리턴 NotificationsBag

addInstance() 보호된 메소드

Add message by instance.
protected addInstance ( Krucas\Notification\Message $message, string $type, boolean $flash = true, null $format = null )
$message Krucas\Notification\Message
$type string
$flash boolean
$format null

addToGrouping() 공개 메소드

Adds type for rendering.
public addToGrouping ( $type ) : NotificationsBag
$type
리턴 NotificationsBag

addType() 공개 메소드

Add new available type of message to bag.
public addType ( $type ) : NotificationsBag
$type
리턴 NotificationsBag

all() 공개 메소드

Returns all messages in bag.
public all ( ) : Krucas\Notification\Collection
리턴 Krucas\Notification\Collection

checkFormat() 보호된 메소드

Returns valid format.
protected checkFormat ( $format, null $type = null ) : null
$format
$type null
리턴 null

clear() 공개 메소드

Clears message for a given type.
public clear ( null $type = null ) : NotificationsBag
$type null
리턴 NotificationsBag

clearAll() 공개 메소드

Alias for clear(null).
public clearAll ( ) : NotificationsBag
리턴 NotificationsBag

clearFormat() 공개 메소드

Clear format for a given type.
public clearFormat ( $type ) : NotificationsBag
$type
리턴 NotificationsBag

clearFormats() 공개 메소드

Clear all formats.
public clearFormats ( ) : NotificationsBag
리턴 NotificationsBag

clearTypes() 공개 메소드

Resets types values.
public clearTypes ( ) : NotificationsBag
리턴 NotificationsBag

count() 공개 메소드

Count the number of colections.
public count ( ) : integer
리턴 integer

extractType() 보호된 메소드

Extract type from a given string.
protected extractType ( $name ) : boolean | array
$name
리턴 boolean | array

fireEvent() 보호된 메소드

Fire event for a given message.
protected fireEvent ( $event, $message ) : boolean
$event
$message
리턴 boolean

first() 공개 메소드

Returns first message object for given type.
public first ( ) : Krucas\Notification\Message
리턴 Krucas\Notification\Message

get() 공개 메소드

Returns all messages for given type.
public get ( $type ) : Krucas\Notification\Collection
$type
리턴 Krucas\Notification\Collection

getDefaultFormat() 공개 메소드

Return default format.
public getDefaultFormat ( ) : string
리턴 string

getFormat() 공개 메소드

Return format for a given type.
public getFormat ( $type ) : boolean | string
$type
리턴 boolean | string

getGroupingForRender() 공개 메소드

Return array with groups list for rendering.
public getGroupingForRender ( ) : array
리턴 array

getMessagesForRender() 보호된 메소드

Resolves which messages should be returned for rendering.
protected getMessagesForRender ( null $type = null ) : Krucas\Notification\Collection
$type null
리턴 Krucas\Notification\Collection

getName() 공개 메소드

Returns assigned container name.
public getName ( ) : string
리턴 string

getNotification() 공개 메소드

Get notification instance.
public getNotification ( ) : Krucas\Notification\Notification
리턴 Krucas\Notification\Notification

getTypes() 공개 메소드

Return available types of messages in container.
public getTypes ( ) : array
리턴 array

group() 공개 메소드

Call this method: group('success', 'info', ...)
public group ( ) : NotificationsBag
리턴 NotificationsBag

has() 공개 메소드

Check if a message is set for given type.
public has ( $type = null ) : boolean
$type
리턴 boolean

removeFromGrouping() 공개 메소드

Removes type from rendering.
public removeFromGrouping ( $type ) : NotificationsBag
$type
리턴 NotificationsBag

setDefaultFormat() 공개 메소드

Set default format for all message types.
public setDefaultFormat ( $format ) : NotificationsBag
$format
리턴 NotificationsBag

setFormat() 공개 메소드

Set format for a given type.
public setFormat ( $type, $format ) : NotificationsBag
$type
$format
리턴 NotificationsBag

setFormats() 공개 메소드

Set formats for a given types.
public setFormats ( $formats ) : NotificationsBag
$formats
리턴 NotificationsBag

setNotification() 공개 메소드

Set notification instance.
public setNotification ( Krucas\Notification\Notification $notification ) : void
$notification Krucas\Notification\Notification
리턴 void

show() 공개 메소드

Returns generated output of non flash messages.
public show ( null $type = null, null $format = null ) : string
$type null
$format null
리턴 string

showAll() 공개 메소드

Renders all messages.
public showAll ( null $format = null ) : string
$format null
리턴 string

toArray() 공개 메소드

Get the instance as an array.
public toArray ( ) : array
리턴 array

toJson() 공개 메소드

Convert the object to its JSON representation.
public toJson ( integer $options ) : string
$options integer
리턴 string

typeIsAvailable() 공개 메소드

Determines if type is available in container.
public typeIsAvailable ( $type ) : boolean
$type
리턴 boolean

unsetNotification() 공개 메소드

Unset notification instance.
public unsetNotification ( ) : void
리턴 void

프로퍼티 상세

$container 보호되어 있는 프로퍼티

NotificationBag container name.
protected string $container
리턴 string

$defaultFormat 보호되어 있는 프로퍼티

Default format for all message types.
protected string $defaultFormat
리턴 string

$formats 보호되어 있는 프로퍼티

Default formats for types.
protected array $formats
리턴 array

$groupForRender 보호되어 있는 프로퍼티

Sequence of how messages should be rendered by its type.
protected array $groupForRender
리턴 array

$matcher 보호되어 있는 프로퍼티

Array of matcher for extracting types.
protected array $matcher
리턴 array

$notification 보호되어 있는 프로퍼티

Notification library instance.
protected Notification,Krucas\Notification $notification
리턴 Krucas\Notification\Notification

$notifications 보호되어 있는 프로퍼티

Collection to store all instant notification messages.
protected Collection,Krucas\Notification|null $notifications
리턴 Krucas\Notification\Collection | null

$types 보호되어 있는 프로퍼티

Available message types in container.
protected array $types
리턴 array