/** * @param IAction $action * @return $this * @throws \InvalidArgumentException if the action are invalid * @since 8.2.0 */ public function addAction(IAction $action) { if (!$action->isValid()) { throw new \InvalidArgumentException('The given action is invalid'); } if ($action->isPrimary()) { if ($this->hasPrimaryAction) { throw new \InvalidArgumentException('The notification already has a primary action'); } $this->hasPrimaryAction = true; } $this->actions[] = $action; return $this; }
/** * @param IAction $action * @return $this * @throws \InvalidArgumentException if the action are invalid * @since 8.2.0 */ public function addAction(IAction $action) { if (!$action->isValid()) { throw new \InvalidArgumentException('The given action is invalid'); } $this->actions[] = $action; return $this; }