19 declare(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;
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
This describes how an icon could be modified during construction of UI.
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.
withDelayTime(int $miliseconds)
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)
withVanishTime(int $miliseconds)
packClosure(?\Closure $closure, string $identifier, string $title)