class Signals (View source)

internal  
 

Properties

protected SignalRegistry $registry

The signal registry instance.

protected array<int, array<int, callable(int): void>>|null $previousHandlers

The signal registry's previous list of handlers.

static protected callable(): bool|null $availabilityResolver

The current availability resolver, if any.

Methods

__construct(SignalRegistry $registry)

Create a new signal registrar instance.

void
register(int $signal, callable(int $signal): void $callback)

Register a new signal handler.

array<int, callable(int $signal): void>|null
initializeSignal($signal)

Gets the signal's existing handler in array format.

void
unregister()

Unregister the current signal handlers.

static void
whenAvailable(callable $callback)

Execute the given callback if "signals" should be used and are available.

array<int, array<int, callable>>
getHandlers()

Get the registry's handlers.

void
setHandlers(array<int, array<int, callable(int $signal): void>> $handlers)

Set the registry's handlers.

static void
resolveAvailabilityUsing(callable(): bool $resolver)

Set the availability resolver.

Details

__construct(SignalRegistry $registry)

Create a new signal registrar instance.

Parameters

SignalRegistry $registry

void register(int $signal, callable(int $signal): void $callback)

Register a new signal handler.

Parameters

int $signal
callable(int $signal): void $callback

Return Value

void

protected array<int, callable(int $signal): void>|null initializeSignal($signal)

Gets the signal's existing handler in array format.

Parameters

$signal

Return Value

array<int, callable(int $signal): void>|null

void unregister()

Unregister the current signal handlers.

Return Value

void

static void whenAvailable(callable $callback)

Execute the given callback if "signals" should be used and are available.

Parameters

callable $callback

Return Value

void

protected array<int, array<int, callable>> getHandlers()

Get the registry's handlers.

Return Value

array<int, array<int, callable>>

protected void setHandlers(array<int, array<int, callable(int $signal): void>> $handlers)

Set the registry's handlers.

Parameters

array<int, array<int, callable(int $signal): void>> $handlers

Return Value

void

static void resolveAvailabilityUsing(callable(): bool $resolver)

Set the availability resolver.

Parameters

callable(): bool $resolver

Return Value

void