-
Notifications
You must be signed in to change notification settings - Fork 6
Conditions
Romain Monteil edited this page Sep 23, 2018
·
6 revisions
You can build condition by using the \Kerox\Fcm\Model\Message\Condition class.
use Kerox\Fcm\Model\Message\Condition;
$condition = new Condition();$condition->and('TopicA', 'TopicB');Result: 'TopicA' in topics && 'TopicB' in topics
$condition->and('TopicA', 'TopicB');Result: 'TopicA' in topics || 'TopicB' in topics
$condition->not('TopicA');Result: !('TopicA' in topics)
$condition->and('TopicA', function () {
return (new Condition)->or('TopicB', 'TopicC');
});Result: 'TopicA' in topics && ('TopicB' in topics || 'TopicC' in topics)
$condition = (new Condition)->and('TopicA', function () {
return (new Condition)->or('TopicB', function () {
return (new Condition())->and('TopicC', 'TopicD', function () {
return (new Condition())->not('TopicE');
});
});
});Result: 'TopicA' in topics && ('TopicB' in topics || ('TopicC' in topics && 'TopicD' in topics && (!('TopicE' in topics))))