class AspectCollector

Worker-wide aspect rules used to generate proxies and compile dispatch chains.

Properties

static protected array<string, array{priority: int, classes: array<int, string>}> $aspectRules

Aspect rules indexed by aspect class name.

static protected bool $sealed

Methods

static void
register(string $aspect)

Register an aspect using its public default targeting rules and priority.

static void
setAround(string $aspect, array $classes, int|null $priority = null)

Register an aspect with its class targeting rules.

static void
seal()

Close aspect registration after application proxy generation.

static void
unseal()

Reopen aspect registration while retaining the registered rules.

static bool
hasAspects()

Determine if any aspects have been registered.

static void
forgetAspect(string $aspect)

Remove a specific aspect from the registry.

static array
getClassRules()

Get the class-targeting rules for every registered aspect.

static array
getRule(string $aspect)

Get the rules for a specific aspect.

static int
getPriority(string $aspect)

Get the priority for a specific aspect.

static array
getRules()

Get all aspect rules.

static void
flushState()

Flush all static state.

Details

at line 36
static void register(string $aspect)

Register an aspect using its public default targeting rules and priority.

Register before application proxy generation, or explicitly reopen registration for focused tests. Loaded classes cannot be rewritten.

Parameters

string $aspect

Return Value

void

at line 63
static void setAround(string $aspect, array $classes, int|null $priority = null)

Register an aspect with its class targeting rules.

Aspect rules persist in a static property used by the compile-time proxy generator; runtime use cannot retroactively apply aspects to already-loaded classes.

Parameters

string $aspect
array $classes
int|null $priority

Return Value

void

at line 93
static void seal()

Close aspect registration after application proxy generation.

Later registrations in this worker are rejected.

Return Value

void

at line 105
static void unseal()

Reopen aspect registration while retaining the registered rules.

This permits changes to worker-wide rules for a new application bootstrap or focused tests; it does not rewrite loaded classes.

Return Value

void

at line 114
static bool hasAspects()

Determine if any aspects have been registered.

Return Value

bool

at line 125
static void forgetAspect(string $aspect)

Remove a specific aspect from the registry.

Mutates the worker-wide aspect registry; runtime use cannot retroactively update already-generated proxies.

Parameters

string $aspect

Return Value

void

at line 138
static array getClassRules()

Get the class-targeting rules for every registered aspect.

Return Value

array

at line 154
static array getRule(string $aspect)

Get the rules for a specific aspect.

Parameters

string $aspect

Return Value

array

at line 162
static int getPriority(string $aspect)

Get the priority for a specific aspect.

Parameters

string $aspect

Return Value

int

at line 172
static array getRules()

Get all aspect rules.

Return Value

array

at line 180
static void flushState()

Flush all static state.

Return Value

void