class Resolvable

Properties

protected mixed $object Contains the original object.
protected Pouch $pouch Holds the Pouch instance. Default to singleton version (pouch()).
string $name From createClassDependency's inner class

Methods

void
__construct(string $name, mixed $content)

From createClassDependency's inner class

make(mixed $object)

Set the object for the resolvable. Also resolve constructor dependencies if needed.

mixed
getObject()

Return the current object of this instance.

string
getType(mixed $element = null)

Get the type of an anything accurately. If it's an object, the exact class name will be returned.

mixed
__call(string $method, array $args)

Magic __call method to handle the automatic resolution of parameters.

array
resolveDependencies(array $params, array $args = [])

Resolve the dependencies for all parameters.

array
resolveInternalDependencies(string $anonymousClass)

Returns params (dependencies) for internal anonymous classes.

createClassDependency(string $rawClassName, bool $nullable)

Creates missing class if it can be found in the container. Auto-injecting classes from within the container require them to be prefixed with \Pouch\Key.

string|null
getName()

Name getter.

mixed
getContent()

From createClassDependency's inner class

bool
isAnonymous()

Adapter to comply to ReflectionClass.

Details

at line 279
void __construct(string $name, mixed $content)

From createClassDependency's inner class

Parameters

string $name
mixed $content

Return Value

void

at line 59
Resolvable make(mixed $object)

Set the object for the resolvable. Also resolve constructor dependencies if needed.

Parameters

mixed $object Object or class name (which will be created) to be made resolavable.

Return Value

Resolvable

Exceptions

NotFoundException
ResolvableException
ReflectionException
InvalidArgumentException

at line 89
mixed getObject()

Return the current object of this instance.

Return Value

mixed

at line 101
string getType(mixed $element = null)

Get the type of an anything accurately. If it's an object, the exact class name will be returned.

Parameters

mixed $element

Return Value

string

at line 121
mixed __call(string $method, array $args)

Magic __call method to handle the automatic resolution of parameters.

Parameters

string $method
array $args

Return Value

mixed

Exceptions

NotFoundException
ResolvableException
ReflectionException
InvalidArgumentException

at line 152
protected array resolveDependencies(array $params, array $args = [])

Resolve the dependencies for all parameters.

When resolving internal pouch keys, it will register an anonymous class and handle the autowiring for the first occurrence. But, when the same internal key is used twice in different classes, then this method will also take care of properly re-instantiating the anonymous class.

Parameters

array $params
array $args

Return Value

array

Exceptions

NotFoundException
ResolvableException
ReflectionException
InvalidArgumentException

at line 208
array resolveInternalDependencies(string $anonymousClass)

Returns params (dependencies) for internal anonymous classes.

Parameters

string $anonymousClass

Return Value

array

Exceptions

NotFoundException

at line 237
protected ItemInterface createClassDependency(string $rawClassName, bool $nullable)

Creates missing class if it can be found in the container. Auto-injecting classes from within the container require them to be prefixed with \Pouch\Key.

Parameters

string $rawClassName
bool $nullable

Return Value

ItemInterface

Exceptions

ResolvableException
InvalidArgumentException
NotFoundException

at line 290
string|null getName()

Name getter.

Return Value

string|null

at line 300
mixed getContent()

From createClassDependency's inner class

Return Value

mixed

at line 310
bool isAnonymous()

Adapter to comply to ReflectionClass.

Return Value

bool