19declare(strict_types=1);
67 if ($closure ===
null) {
98 [self::ACTION_SHOWN, self::ACTION_CLOSED, self::ACTION_VANISHED],
101 throw new \InvalidArgumentException(
102 'You cannot use the reserved identifiers shown, closed or vanished for additional actions'
109 throw new \InvalidArgumentException(
110 'You cannot use the same identifier twice'
114 $clone = clone $this;
115 $clone->additional_actions[] = $action;
126 $actions = array_filter($actions, fn(?
ToastAction $action):
bool => $action !==
null);
138 $clone = clone $this;
139 $clone->icon = $icon;
150 return $this->provider_identification;
155 $clone = clone $this;
172 return $this->handle_shown !==
null;
177 $clone = clone $this;
194 return $this->handle_closed !==
null;
199 $clone = clone $this;
202 self::ACTION_VANISHED,
203 self::ACTION_VANISHED
216 return $this->handle_vanished !==
null;
ToastAction $handle_shown
Callable to be executed, if the notification center has been opened.
getClosedAction()
Get the callable to be executed, when this specific item is closed.
withVanishedCallable(\Closure $handle_vanished)
Set the callable to be executed, when this specific item is closed vanishing.
getVanishedAction()
Get the callable to be executed, when this specific item has vanished.
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.
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.
getAdditionalToastActions()
withAdditionToastAction(ToastAction $action)
A ToastAction leads into the rendered toast to a link that can be clicked by the user.
withDescription(string $description)
ToastAction $handle_vanished
Callable to be executed, if this specific item has vanished.
hasVanishedAction()
Get whether there are any callables to be executed the Toast has vanished.
array $additional_actions
packClosure(?\Closure $closure, string $identifier, string $title)
withShownCallable(\Closure $handle_shown)
Set the callable to be executed, when the toast is shown.
__construct(protected IdentificationInterface $provider_identification, protected ToastRenderer $renderer, protected string $title, protected ?Icon $icon=null)
getProviderIdentification()
Interface IdentificationInterface.
This describes how an icon could be modified during construction of UI.