Elgg  Version 1.9
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Elgg_Di_DiContainer Class Reference
Inheritance diagram for Elgg_Di_DiContainer:
Elgg_Di_ServiceProvider

Public Member Functions

 __get ($name)
 Fetch a value. More...
 
 setValue ($name, $value)
 Set a value to be returned without modification. More...
 
 setFactory ($name, $callable, $shared=true)
 Set a factory to generate a value when the container is read. More...
 
 setClassName ($name, $class_name, $shared=true)
 Set a factory based on instantiating a class with no arguments. More...
 
 remove ($name)
 Remove a value from the container. More...
 
 has ($name)
 Does the container have this value. More...
 

Public Attributes

const CLASS_NAME_PATTERN_52 = '/^[a-z_\x7f-\xff][a-z0-9_\x7f-\xff]*$/i'
 
const CLASS_NAME_PATTERN_53 = '/^(\\\\?[a-z_\x7f-\xff][a-z0-9_\x7f-\xff]*)+$/i'
 

Protected Member Functions

 build ($factory, $name)
 Build a value. More...
 

Protected Attributes

 $factories = array()
 
 $cache = array()
 

Detailed Description

Definition at line 27 of file DiContainer.php.

Member Function Documentation

Elgg_Di_DiContainer::__get (   $name)

Fetch a value.

Parameters
string$nameThe name of the value to fetch
Returns
mixed
Exceptions
Elgg_Di_MissingValueException

Definition at line 49 of file DiContainer.php.

Elgg_Di_DiContainer::build (   $factory,
  $name 
)
protected

Build a value.

Parameters
mixed$factoryThe factory for the value
string$nameThe name of the value
Returns
mixed
Exceptions
Elgg_Di_FactoryUncallableException

Definition at line 74 of file DiContainer.php.

Elgg_Di_DiContainer::has (   $name)

Does the container have this value.

Parameters
string$nameThe name of the value
Returns
bool

Definition at line 162 of file DiContainer.php.

Elgg_Di_DiContainer::remove (   $name)

Remove a value from the container.

Parameters
string$nameThe name of the value
Returns
Elgg_Di_DiContainer

Definition at line 150 of file DiContainer.php.

Elgg_Di_DiContainer::setClassName (   $name,
  $class_name,
  $shared = true 
)

Set a factory based on instantiating a class with no arguments.

Parameters
string$nameName of the value
string$class_nameClass name to be instantiated
bool$sharedWhether the same value should be returned for every request
Returns
Elgg_Di_DiContainer
Exceptions
InvalidArgumentException

Definition at line 135 of file DiContainer.php.

Elgg_Di_DiContainer::setFactory (   $name,
  $callable,
  $shared = true 
)

Set a factory to generate a value when the container is read.

Parameters
string$nameThe name of the value
callable$callableFactory for the value
bool$sharedWhether the same value should be returned for every request
Returns
Elgg_Di_DiContainer
Exceptions
InvalidArgumentException

Definition at line 114 of file DiContainer.php.

Elgg_Di_DiContainer::setValue (   $name,
  $value 
)

Set a value to be returned without modification.

Parameters
string$nameThe name of the value
mixed$valueThe value
Returns
Elgg_Di_DiContainer
Exceptions
InvalidArgumentException

Definition at line 99 of file DiContainer.php.

Member Data Documentation

Elgg_Di_DiContainer::$cache = array()
protected

Definition at line 37 of file DiContainer.php.

Elgg_Di_DiContainer::$factories = array()
protected

Definition at line 32 of file DiContainer.php.

const Elgg_Di_DiContainer::CLASS_NAME_PATTERN_52 = '/^[a-z_\x7f-\xff][a-z0-9_\x7f-\xff]*$/i'

Definition at line 39 of file DiContainer.php.

const Elgg_Di_DiContainer::CLASS_NAME_PATTERN_53 = '/^(\\\\?[a-z_\x7f-\xff][a-z0-9_\x7f-\xff]*)+$/i'

Definition at line 40 of file DiContainer.php.


The documentation for this class was generated from the following file: