class AspectCollector

Static registry of aspect class rules and priorities.

Tracks which aspect classes target which classes/methods, and their execution priority. Used by ProxyManager to determine which classes need proxy generation and by ProxyDispatcher at runtime to resolve the aspect pipeline for each method call.

Properties

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

Aspect rules indexed by aspect class name.

Methods

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

Register an aspect with its class targeting 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 31
static void setAround(string $aspect, array $classes, int|null $priority = null)

Register an aspect with its class targeting rules.

Boot-only. 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 51
static bool hasAspects()

Determine if any aspects have been registered.

Return Value

bool

at line 62
static void forgetAspect(string $aspect)

Remove a specific aspect from the registry.

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

Parameters

string $aspect

Return Value

void

at line 72
static array getClassRules()

Get the class-targeting rules for every registered aspect.

Return Value

array

at line 88
static array getRule(string $aspect)

Get the rules for a specific aspect.

Parameters

string $aspect

Return Value

array

at line 96
static int getPriority(string $aspect)

Get the priority for a specific aspect.

Parameters

string $aspect

Return Value

int

at line 106
static array getRules()

Get all aspect rules.

Return Value

array

at line 114
static void flushState()

Flush all static state.

Return Value

void