19declare(strict_types=1);
74 if ($closure ===
null) {
105 [self::ACTION_SHOWN, self::ACTION_CLOSED, self::ACTION_VANISHED],
108 throw new \InvalidArgumentException(
109 'You cannot use the reserved identifiers shown, closed or vanished for additional actions'
113 $existing = array_map(
function (
ToastAction $action):
string {
118 throw new \InvalidArgumentException(
119 'You cannot use the same identifier twice'
123 $clone = clone $this;
124 $clone->additional_actions[] = $action;
135 $actions = array_filter($actions,
function (?
ToastAction $action):
bool {
136 return $action !==
null;
149 $clone = clone $this;
150 $clone->icon =
$icon;
166 $clone = clone $this;
183 return $this->handle_shown !==
null;
188 $clone = clone $this;
205 return $this->handle_closed !==
null;
210 $clone = clone $this;
213 self::ACTION_VANISHED,
214 self::ACTION_VANISHED
227 return $this->handle_vanished !==
null;
232 $clone = clone $this;
233 $clone->vanish_time = $miliseconds;
244 $clone = clone $this;
245 $clone->delay_time = $miliseconds;
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.
withDelayTime(int $miliseconds)
withVanishedCallable(\Closure $handle_vanished)
Set the callable to be executed, when this specific item is closed vanishing.
withVanishTime(int $miliseconds)
getVanishedAction()
Get the callable to be executed, when this specific item has vanished.
__construct(IdentificationInterface $provider_identification, ToastRenderer $renderer, string $title, ?Icon $icon=null)
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.
IdentificationInterface $provider_identification
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.
getProviderIdentification()
Interface IdentificationInterface.
This describes how an icon could be modified during construction of UI.