PHP Class Kahlan\Box\Box

Datei anzeigen Open project: crysalead/kahlan

Protected Properties

Property Type Description
$_classes array Class dependencies.
$_definitions array The defined dependency definitions

Public Methods

Method Description
__construct ( array $config = [] ) The Constructor.
clear ( ) Clears all dependency definitions.
factory ( $name, string | Closur\Closure $definition ) Defining a factory.
get ( string $name ) : mixed Gets a shared variable or an new instance.
has ( $name ) : boolean Checks if a dependency definition exists.
remove ( string $name ) Removes a dependency definition.
service ( $name, mixed $definition ) Defining a service (i.e. singleton).
wrap ( string $name ) : mixed Returns a dependency container.

Protected Methods

Method Description
_factory ( mixed $definition, array $params ) : mixed Process a setted definition.
_service ( string $name, mixed $definition, array $params ) : mixed Process a shared definition.
_set ( $name, mixed $definition, mixed $type ) Stores a dependency definition.

Method Details

__construct() public method

The Constructor.
public __construct ( array $config = [] )
$config array The instance configuration. Possible values: - `'wrapper'` _string_: the the wrapper class name to use.

_factory() protected method

Process a setted definition.
protected _factory ( mixed $definition, array $params ) : mixed
$definition mixed A definition.
$params array Parameters to pass to the definition.
return mixed

_service() protected method

Process a shared definition.
protected _service ( string $name, mixed $definition, array $params ) : mixed
$name string The name of the definition.
$definition mixed A definition.
$params array Parameters to pass to the definition.
return mixed

_set() protected method

Stores a dependency definition.
protected _set ( $name, mixed $definition, mixed $type )
$definition mixed The definition.
$type mixed The type of the definition.

clear() public method

Clears all dependency definitions.
public clear ( )

factory() public method

Defining a factory.
public factory ( $name, string | Closur\Closure $definition )
$definition string | Closur\Closure A fully namespaced classname or a closure.

get() public method

Gets a shared variable or an new instance.
public get ( string $name ) : mixed
$name string The name of the definition.
return mixed The shared variable or an new instance.

has() public method

Checks if a dependency definition exists.
public has ( $name ) : boolean
return boolean

remove() public method

Removes a dependency definition.
public remove ( string $name )
$name string The name of the definition to remove.

service() public method

Defining a service (i.e. singleton).
public service ( $name, mixed $definition )
$definition mixed The variable to share.

wrap() public method

Returns a dependency container.
public wrap ( string $name ) : mixed
$name string The name of the definition.
return mixed The shared variable or an new instance.

Property Details

$_classes protected_oe property

Class dependencies.
protected array $_classes
return array

$_definitions protected_oe property

The defined dependency definitions
protected array $_definitions
return array