| Methods |
private
|
_rebindHookFxToFakeInstance(Closure $fx): Closure
Optimize GC. When a Closure is guaranteed to be rebound before invoke, it can be rebound
to (deduplicated) fake…
Optimize GC. When a Closure is guaranteed to be rebound before invoke, it can be rebound
to (deduplicated) fake instance before safely.
|
#
|
private
|
_unbindHookFxIfBoundToThis(Closure $fx, bool $isShort): Closure
When hook Closure is bound to $this, rebinding all hooks after clone can be slow, optimize clone
by unbinding $this in…
When hook Closure is bound to $this, rebinding all hooks after clone can be slow, optimize clone
by unbinding $this in favor of rebinding $this when hook is invoked.
|
#
|
private
|
_rebindHooksIfCloned(): void
|
#
|
public
|
onHook(string $spot, Closure $fx, array<int, mixed> $args = [], int $priority = 5): int
Add another callback to be executed during hook($spot);.
Add another callback to be executed during hook($spot);.
Lower priority is called sooner.
If priority is negative, then hook is prepended (executed first for the same priority).
Returns
index under which the hook was added
|
#
|
public
|
onHookShort(string $spot, Closure $fx, array<int, mixed> $args = [], int $priority = 5): int
Same as onHook() except no $this is passed to the callback as the 1st argument.
Same as onHook() except no $this is passed to the callback as the 1st argument.
Returns
index under which the hook was added
|
#
|
private
|
_makeHookDynamicFx(Closure($this): object $getFxThisFx, Closure $fx, bool $isShort): Closure
|
#
|
public
|
onHookDynamic(
string $spot,
Closure($this): object $getFxThisFx,
Closure $fx,
array<int, mixed> $args = [],
int $priority = 5,
): int
Same as onHook() except $this of the callback is dynamically rebound before invoke.
Same as onHook() except $this of the callback is dynamically rebound before invoke.
Returns
index under which the hook was added
|
#
|
public
|
onHookDynamicShort(
string $spot,
Closure($this): object $getFxThisFx,
Closure $fx,
array<int, mixed> $args = [],
int $priority = 5,
): int
Same as onHookDynamic() except no $this is passed to the callback as the 1st argument.
Same as onHookDynamic() except no $this is passed to the callback as the 1st argument.
Returns
index under which the hook was added
|
#
|
public
|
hookHasCallbacks(
string $spot,
($priorityIsIndex is true ? int : int|null) $priority = null,
bool $priorityIsIndex = false,
): bool
Returns true if at least one callback is defined for this hook.
Returns true if at least one callback is defined for this hook.
Parameters
| $priority |
filter specific priority, null for all
|
| $priorityIsIndex |
filter by index instead of priority
|
|
#
|
public
|
removeHook(
string $spot,
($priorityIsIndex is true ? int : int|null) $priority = null,
bool $priorityIsIndex = false,
): static
Delete all hooks for specified spot, priority and index.
Delete all hooks for specified spot, priority and index.
Parameters
| $priority |
filter specific priority, null for all
|
| $priorityIsIndex |
filter by index instead of priority
|
|
#
|
public
|
hook(string $spot, array<int, mixed> $args = [], HookBreaker &$brokenBy = null): array<int, mixed>|mixed
Execute all closures assigned to $spot.
Execute all closures assigned to $spot.
Returns
Array of responses indexed by hook indexes or value specified to breakHook
|
#
|
public
|
breakHook(mixed $return): void
When called from inside a hook closure, it will stop execution of other
closures on the same hook. The passed argument…
When called from inside a hook closure, it will stop execution of other
closures on the same hook. The passed argument will be returned by the
hook method.
Parameters
| $return |
What would hook() return?
|
|
#
|