class FacadeHelper

internal  
 

Finds the method a facade's static call runs without running application code: neither the accessor nor the root is executed.

The root's class is read from the booted container only where a registration shows the exact class built. Factories, extenders and self-building classes can return other objects, so beyond a factory that is a single new they leave the root unknown.

Traits

Properties

protected Container|null $container from  HasContainer

Methods

void
setContainer(Container $container)

Set the container used for resolution.

getContainer()

Return the current container.

mixed
resolve(string $abstract)

Resolve the given type from the container.

__construct(ReflectionProvider $reflectionProvider, Parser $parser, RuntimeInputs $runtimeInputs)

Create a new facade helper instance.

string|null
getAccessor(ClassReflection $facade, Scope $scope)

Get the container key the facade resolves, or null when its accessor does not return one constant.

string|null
getRootClass(ClassReflection $facade, Scope $scope)

Get the exact class the facade's root is built as, or null when it is not known.

ExtendedMethodReflection|null
getMethod(ClassReflection $facade, string $name, Scope $scope)

Get the method a static call on the facade runs: the facade's own public method, else its root's, or null when the root or the facade's forwarding is unknown.

static bool
forwardsToRoot(ClassReflection $facade)

Determine whether the facade forwards static calls it doesn't declare to its root. Hash's and Crypt's __callStatic() forward as Facade's does, keeping the arguments out of stack traces; another can forward the call anywhere.

array
getCalledMethods(MethodCall|StaticCall $call, string $name, Scope $scope)

Get the method the call runs on each class it may be made on.

Details

in HasContainer at line 19
void setContainer(Container $container)

Set the container used for resolution.

Parameters

Container $container

Return Value

void

in HasContainer at line 27
Container getContainer()

Return the current container.

Return Value

Container

in HasContainer at line 35
mixed resolve(string $abstract)

Resolve the given type from the container.

Parameters

string $abstract

Return Value

mixed

at line 80
__construct(ReflectionProvider $reflectionProvider, Parser $parser, RuntimeInputs $runtimeInputs)

Create a new facade helper instance.

Parameters

ReflectionProvider $reflectionProvider
Parser $parser
RuntimeInputs $runtimeInputs

at line 93
string|null getAccessor(ClassReflection $facade, Scope $scope)

Get the container key the facade resolves, or null when its accessor does not return one constant.

Parameters

ClassReflection $facade
Scope $scope

Return Value

string|null

at line 109
string|null getRootClass(ClassReflection $facade, Scope $scope)

Get the exact class the facade's root is built as, or null when it is not known.

Parameters

ClassReflection $facade
Scope $scope

Return Value

string|null

at line 130
ExtendedMethodReflection|null getMethod(ClassReflection $facade, string $name, Scope $scope)

Get the method a static call on the facade runs: the facade's own public method, else its root's, or null when the root or the facade's forwarding is unknown.

Parameters

ClassReflection $facade
string $name
Scope $scope

Return Value

ExtendedMethodReflection|null

at line 155
static bool forwardsToRoot(ClassReflection $facade)

Determine whether the facade forwards static calls it doesn't declare to its root. Hash's and Crypt's __callStatic() forward as Facade's does, keeping the arguments out of stack traces; another can forward the call anywhere.

Parameters

ClassReflection $facade

Return Value

bool

at line 169
array getCalledMethods(MethodCall|StaticCall $call, string $name, Scope $scope)

Get the method the call runs on each class it may be made on.

A static call on a facade runs the facade's own method or its root's.

Parameters

MethodCall|StaticCall $call
string $name
Scope $scope

Return Value

array