19 declare(strict_types=1);
71 if ($closure === null) {
102 [self::ACTION_SHOWN, self::ACTION_CLOSED, self::ACTION_VANISHED],
105 throw new \InvalidArgumentException(
106 'You cannot use the reserved identifiers shown, closed or vanished for additional actions' 115 throw new \InvalidArgumentException(
116 'You cannot use the same identifier twice' 120 $clone = clone $this;
121 $clone->additional_actions[] = $action;
132 $actions = array_filter($actions,
function (?
ToastAction $action):
bool {
133 return $action !== null;
146 $clone = clone $this;
147 $clone->icon =
$icon;
163 $clone = clone $this;
180 return $this->handle_shown !== null;
185 $clone = clone $this;
202 return $this->handle_closed !== null;
207 $clone = clone $this;
210 self::ACTION_VANISHED,
211 self::ACTION_VANISHED
224 return $this->handle_vanished !== null;
getClosedAction()
Get the callable to be executed, when this specific item is closed.
withClosedCallable(\Closure $handle_closed)
Set the callable to be executed, when this specific item is closed by clicking the X button or after ...
hasClosedAction()
Get whether there are any callables to be executed the Toast is closed.
withAdditionToastAction(ToastAction $action)
A ToastAction leads into the rendered toast to a link that can be clicked by the user.
IdentificationInterface $provider_identification
Interface IdentificationInterface.
ToastAction $handle_shown
Callable to be executed, if the notification center has been opened.
getProviderIdentification()
getAdditionalToastActions()
ToastAction $handle_vanished
Callable to be executed, if this specific item has vanished.
withShownCallable(\Closure $handle_shown)
Set the callable to be executed, when the toast is shown.
hasVanishedAction()
Get whether there are any callables to be executed the Toast has vanished.
getVanishedAction()
Get the callable to be executed, when this specific item has vanished.
getShownAction()
Get the callable to be executed, when the test is shown in GUI.
ToastAction $handle_closed
Callable to be executed, if this specific item has been closed.
array $additional_actions
withVanishedCallable(\Closure $handle_vanished)
Set the callable to be executed, when this specific item is closed vanishing.
__construct(IdentificationInterface $provider_identification, ToastRenderer $renderer, string $title, ?Icon $icon=null)
withDescription(string $description)
packClosure(?\Closure $closure, string $identifier, string $title)