PHP Class LaravelFCM\Message\Topics

Create topic or a topic condition
Afficher le fichier Open project: brozot/laravel-fcm Class Usage Examples

Méthodes publiques

Свойство Type Description
$conditions of element in the condition

Méthodes publiques

Méthode Description
andTopic ( string | Closur\Closure $first ) : Topics Add a and condition to the precedent topic set
build ( ) : array | string Transform to array
hasOnlyOneTopic ( ) : boolean Check if only one topic was set
nest ( Closure $callback, $condition )
orTopic ( string | Closur\Closure $first ) : Topics Add a or condition to the precedent topic set
topic ( string $first ) Add a topic, this method should be called before any conditional topic

Private Methods

Méthode Description
checkIfOneTopicExist ( )
on ( $first, $condition )
topicsForFcm ( $conditions ) : string

Method Details

andTopic() public méthode

Parenthesis is a closure Equivalent of this: **'TopicA' in topic' && 'TopicB' in topics** $topic = new Topics(); $topic->topic('TopicA') ->anTopic('TopicB'); Equivalent of this: **'TopicA' in topics || ('TopicB' in topics && 'TopicC' in topics)** $topic = new Topics(); $topic->topic('TopicA') ->orTopic(function($condition) { $condition->topic('TopicB')->AndTopic('TopicC'); }); > Note: Only two operators per expression are supported by fcm
public andTopic ( string | Closur\Closure $first ) : Topics
$first string | Closur\Closure topicName or closure
Résultat Topics

build() public méthode

Transform to array
public build ( ) : array | string
Résultat array | string

hasOnlyOneTopic() public méthode

Check if only one topic was set
public hasOnlyOneTopic ( ) : boolean
Résultat boolean

nest() public méthode

public nest ( Closure $callback, $condition )
$callback Closure
$condition

orTopic() public méthode

Parenthesis is a closure Equivalent of this: **'TopicA' in topic' || 'TopicB' in topics** $topic = new Topics(); $topic->topic('TopicA') ->orTopic('TopicB'); Equivalent of this: **'TopicA' in topics && ('TopicB' in topics || 'TopicC' in topics)** $topic = new Topics(); $topic->topic('TopicA') ->andTopic(function($condition) { $condition->topic('TopicB')->orTopic('TopicC'); }); > Note: Only two operators per expression are supported by fcm
public orTopic ( string | Closur\Closure $first ) : Topics
$first string | Closur\Closure topicName or closure
Résultat Topics

topic() public méthode

Add a topic, this method should be called before any conditional topic
public topic ( string $first )
$first string topicName

Property Details

$conditions public_oe property

of element in the condition
public $conditions