call when method multiple times

This commit is contained in:
KHOUBZA Younes
2022-06-06 03:29:41 +01:00
parent 9ee6729749
commit 3a84cdbcd1
@@ -270,6 +270,11 @@ class NotificationBuilder implements NotificationBuilderInterface
*/
public function when($condition)
{
$stamp = $this->envelope->get('Flasher\Prime\Stamp\WhenStamp');
if ($stamp instanceof WhenStamp) {
$condition = $stamp->getCondition() && $condition;
}
$this->envelope->withStamp(new WhenStamp($condition));
return $this;