Skip to content

CachingReflector

Constants

Constant Visibility Type Value
CACHE_KEY_CLASSES public 'injector.refls.classes.'
CACHE_KEY_CTORS public 'injector.refls.ctors.'
CACHE_KEY_CTOR_PARAMS public 'injector.refls.ctor-params.'
CACHE_KEY_FUNCS public 'injector.refls.funcs.'
CACHE_KEY_METHODS public 'injector.refls.methods.'

Properties

reflector

private ?\Qubus\Injector\Reflector $reflector

cache

private ?\Qubus\Injector\Cache\ReflectionCache $cache

Methods

__construct

public __construct(?\Qubus\Injector\Reflector $reflector = null, ?\Qubus\Injector\Cache\ReflectionCache $cache = null): mixed

Parameters:

Parameter Type Description
$reflector ?\Qubus\Injector\Reflector
$cache ?\Qubus\Injector\Cache\ReflectionCache

getClass

Retrieves ReflectionClass instances, caching them for future retrieval.

public getClass(string|object $class): \ReflectionClass

Parameters:

Parameter Type Description
$class string|object Class name to retrieve the ReflectionClass from.

Return Value:

ReflectionClass object for the specified class.


getConstructor

Retrieves and caches the constructor (ReflectionMethod) for the specified class.

public getConstructor(string|object $class): \ReflectionMethod|null

Parameters:

Parameter Type Description
$class string|object Class name to retrieve the constructor from.

Return Value:

ReflectionMethod for the constructor of the specified class.


getConstructorParams

Retrieves and caches an array of constructor parameters for the given class

public getConstructorParams(string|object $class): \ReflectionParameter[]|null

Parameters:

Parameter Type Description
$class string|object Class name to retrieve the constructor arguments from.

Return Value:

Array of ReflectionParameter objects for the given class' constructor.


getParamTypeHint

Retrieves the class type-hint from a given ReflectionParameter.

public getParamTypeHint(\ReflectionFunctionAbstract $function, \ReflectionParameter $param): string|null

Parameters:

Parameter Type Description
$function \ReflectionFunctionAbstract Reflection object for the function.
$param \ReflectionParameter Reflection object for the parameter.

Return Value:

Type-hint of the class. Null if none available.


getFunction

Retrieves and caches a reflection for the specified function

public getFunction(string|\Closure $functionName): \ReflectionFunction

Parameters:

Parameter Type Description
$functionName string|\Closure Name of the function to get a reflection for.

Return Value:

ReflectionFunction object for the specified function.


getMethod

Retrieves and caches a reflection for the specified class method

public getMethod(string|object $classNameOrInstance, string $methodName): \ReflectionMethod

Parameters:

Parameter Type Description
$classNameOrInstance string|object Class name or instance the method is referring to.
$methodName string Name of the method to get the reflection for.

Return Value:

ReflectionMethod object for the specified method.



Automatically generated on 2025-10-13