\apex\app\syscontainer

The dependency injection container.

Summary

Methods
Properties
Constants
build_container()
get()
has()
set()
make()
makeset()
call()
check_property_docblock()
check_type()
get_use_declarations()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
get_injection_params()
get_class_name()
$services
$items
$use_declarations
N/A

Properties

$services

$services :

Type

$items

$items :

Type

$use_declarations

$use_declarations :

Type

Methods

build_container()

build_container(string  $reqtype = 'http')

Build container.

Does the initial build of the container, gets the default services based on request type, and loads the necessary PHP classes.

Parameters

string $reqtype

The type of request (http, cli, test, etc.)

get()

get(string  $name)

Get an item from the container.

Parameters

string $name

The name of the item to retrive.

has()

has(string  $name): boolean

Check if container has item available.

Parameters

string $name

The name of the item to check availablility of.

Returns

boolean —

Whether or not name is available.

set()

set(string  $name,mixed  $value)

Set an item into the container

Parameters

string $name

The name of the item.

mixed $value

The value of the item.

make()

make(string  $name,array  $params = array())

Make a new object with dependency injection.

Parameters

string $name

The class name to create.

array $params

Any additional parameters to use within DI.

makeset()

makeset(string  $class_name,array  $params = array()): mixed

Make and set item into container.

Parameters

string $class_name

The class name of the object to make.

array $params

Optional name based params to use during object creation.

Returns

mixed —

The newly created object.

call()

call(array  $callable,array  $params = array()): mixed

Call specific method within a class.

Parameters

array $callable

First element is class name, second element the method name.

array $params

User-defined params to use during injection.

Returns

mixed —

The response from the called method.

check_property_docblock()

check_property_docblock(string  $comment,string  $class_name)

Check doc comment from property.

Checks for the @inject tag, and if found, injects with the value of the @var tag.

Parameters

string $comment

The dov comment of the properlty.

string $class_name

The class name of the property.

check_type()

check_type(mixed  $value,string  $chk_type): boolean

Check variable type.

Parameters

mixed $value

The value to check.

string $chk_type

The type of variabke ti check variable for.

Returns

boolean —

Whether or not the value is of the specified type.

get_use_declarations()

get_use_declarations(string  $filename)

Get use declarations of PHP class.

Parameters

string $filename

The filename of the class.

get_injection_params()

get_injection_params(\ReflectionMethod  $method,array  $params = array()): mixed

Get injection parameters fr a method.

Parameters

\ReflectionMethod $method

The method to obtain injection parameters for.

array $params

The user defined parameters to use for injection.

Returns

mixed —

Array of parameters if successful, false otherwise (ie. unable to find dependency).

get_class_name()

get_class_name(string  $name): mixed

Get class name

Parameters

string $name

The class name to check, and retrive full class name of.

Returns

mixed —

Either the resulting class name, or flase if not found.