public function getAttributes(string
$className = null
): array
{ if (isset($this->attributes
)) { return null ===
$className ?
$this->attributes :
$this->attributes
[$className] ??
[];
} if (\
is_array($this->controller
) &&
method_exists(...
$this->controller
)) { $class =
new \
ReflectionClass($this->controller
[0
]);
} elseif (\
is_string($this->controller
) && false !==
$i =
strpos($this->controller, '::'
)) { $class =
new \
ReflectionClass(substr($this->controller, 0,
$i));
} else { $class =
str_contains($this->controllerReflector->name, '{closure}'
) ? null :
(\PHP_VERSION_ID >= 80111 ?
$this->controllerReflector->
getClosureCalledClass() :
$this->controllerReflector->
getClosureScopeClass());
} $this->attributes =
[];
foreach (array_merge($class?->
getAttributes() ??
[],
$this->controllerReflector->
getAttributes()) as $attribute) { if (class_exists($attribute->
getName())) { $this->attributes
[$attribute->
getName()][] =
$attribute->
newInstance();
} } return null ===
$className ?
$this->attributes :
$this->attributes
[$className] ??
[];
}}