Class Xyster_Container

Description

Implements interfaces:

The standard container implementation.

  • copyright: Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net)
  • license: New BSD License

Located in /Container.php (line 48)


	
			
Variable Summary
Xyster_Collection_Map_Interface $_with
Method Summary
Xyster_Container __construct ([Xyster_Container_Adapter_Factory $factory = null], [Xyster_Container_Monitor $monitor = null])
void accept (Xyster_Container_Visitor $visitor)
void addAdapter (Xyster_Container_Adapter $adapter, [ $properties = null])
Xyster_Container addComponent (mixed $implementation, [mixed $key = null], [ $parameters = null])
Xyster_Container addComponentInstance (mixed $instance, [mixed $key = null])
Xyster_Container addConfig (string $name, mixed $value)
Xyster_Container change ( $properties)
object an getComponent (mixed $componentKeyOrType)
Xyster_Container_Adapter getComponentAdapterByType (mixed $componentType, [Xyster_Container_NameBinding $nameBinding = null])
Xyster_Collection_List getComponentAdapters ([ $componentType = null])
Xyster_Collection_List getComponents ([ $componentType = null])
Xyster_Container_Adapter removeComponent (mixed $componentKey)
Xyster_Container_Mutable with ( $properties)
Xyster_Collection_Map _getComponentKeyToAdapterCache ()
Xyster_Collection_List _getModifiableComponentAdapterList ()
Variables
Xyster_Collection_Map_Interface $_with (line 78)
  • access: protected
Methods
Constructor __construct (line 91)

Creates a new container

Important note about caching: If you intend the components to be cached, you should pass in a factory that creates Xyster_Container_Behavior_Cached instances, such as for example Xyster_Container_Behavior_Factory_Cached which can delegate to other Adapter Factories.

  • access: public
Xyster_Container __construct ([Xyster_Container_Adapter_Factory $factory = null], [Xyster_Container_Monitor $monitor = null])
accept (line 115)

Accepts a visitor that should visit the child containers, component adapters and component instances.

  • access: public
void accept (Xyster_Container_Visitor $visitor)
  • visitor $visitor: the visitor

Implementation of:
Xyster_Container_Interface::accept()
Accepts a visitor that should visit the child containers, component adapters and component instances.
addAdapter (line 131)

Register a component via an Adapter

  • access: public
void addAdapter (Xyster_Container_Adapter $adapter, [ $properties = null])

Implementation of:
Xyster_Container_Mutable::addAdapter()
Register a component via an Adapter
addComponent (line 168)

Register a component

{@inherit}

  • return: provides a fluent interface
  • throws: Xyster_Container_Exception if registration of the component fails
  • access: public
Xyster_Container addComponent (mixed $implementation, [mixed $key = null], [ $parameters = null])
  • mixed $implementation: the component's implementation class
  • mixed $key: a key unique within the container that identifies the component
  • mixed $parameters: the parameters that gives hints about what arguments to pass

Implementation of:
Xyster_Container_Mutable::addComponent()
Register a component
addComponentInstance (line 206)

Register a component

{@inherit}

  • return: provides a fluent interface
  • throws: Xyster_Container_Exception if registration of the component fails
  • access: public
Xyster_Container addComponentInstance (mixed $instance, [mixed $key = null])
  • mixed $instance: an instance of the compoent
  • mixed $key: a key unique within the container that identifies the component

Implementation of:
Xyster_Container_Mutable::addComponentInstance()
Register a component instance
addConfig (line 227)

Register a config item

  • return: provides a fluent interface
  • access: public
Xyster_Container addConfig (string $name, mixed $value)
  • string $name
  • mixed $value

Implementation of:
Xyster_Container_Mutable::addConfig()
Register a config item
change (line 240)

You can change the characteristic of registration of all subsequent components in this container

  • return: provides a fluent interface
  • access: public
Xyster_Container change ( $properties)
  • Xyster_Collection_Map_Interface $properties

Implementation of:
Xyster_Container_Mutable::change()
You can change the characteristic of registration of all subsequent components in this container
changeMonitor (line 251)

Changes the component monitor used

  • access: public
void changeMonitor (Xyster_Container_Monitor $monitor)

Implementation of:
Xyster_Container_Monitor_Strategy::changeMonitor()
Changes the component monitor used
currentMonitor (line 269)

Returns the first current monitor found in the Component Factory {@inheritDoc}

  • access: public
Xyster_Container_Monitor currentMonitor ()

Implementation of:
Xyster_Container_Monitor_Strategy::currentMonitor()
Gets the monitor currently used
getComponent (line 280)

Retrieve a component instance registered with a specific key or type

  • return: instantiated component, or null if no component has been registered for the specified key
  • access: public
object an getComponent (mixed $componentKeyOrType)
  • mixed $componentKeyOrType: the key or Type that the component was registered with

Implementation of:
Xyster_Container_Interface::getComponent()
Retrieve a component instance registered with a specific key or type
getComponentAdapter (line 330)

Find a component adapter associated with the specified key

  • return: the component adapter associated with this key, or null
  • access: public
Xyster_Container_Adapter getComponentAdapter (mixed $componentKey)
  • mixed $componentKey: the key that the component was registered with

Implementation of:
Xyster_Container_Interface::getComponentAdapter()
Find a component adapter associated with the specified key
getComponentAdapterByType (line 344)

Find a component adapter associated with the specified key

  • return: the component adapter associated with this key, or null
  • access: public
Xyster_Container_Adapter getComponentAdapterByType (mixed $componentType, [Xyster_Container_NameBinding $nameBinding = null])
  • mixed $componentType: the key that the component was registered with
  • Xyster_Container_NameBinding $nameBinding: the name binding of the parameter

Implementation of:
Xyster_Container_Interface::getComponentAdapterByType()
Find a component adapter by type (and optionally by parameter name)
getComponentAdapters (line 391)

Retrieve all the component adapters inside this container.

If the type is supplied, this method returns the adapters associated with the specified type.

  • return: a fixed collection containing all the adapters inside this container
  • access: public
Xyster_Collection_List getComponentAdapters ([ $componentType = null])
  • Xyster_Type $componentType

Implementation of:
Xyster_Container_Interface::getComponentAdapters()
Retrieve all the component adapters inside this container.
getComponents (line 309)

Retrieve all the registered component instances in the container

If the type parameter is supplied, this method returns the components of the specified type.

  • return: all the components.
  • throws: Exception if the instantiation of the component fails
  • access: public
Xyster_Collection_List getComponents ([ $componentType = null])
  • Xyster_Type $componentType: the type to search

Implementation of:
Xyster_Container_Interface::getComponents()
Retrieve all the registered component instances in the container
removeComponent (line 415)

Unregister a component by key

  • return: the adapter that was associated with this component
  • access: public
Xyster_Container_Adapter removeComponent (mixed $componentKey)
  • mixed $componentKey: key of the component to unregister.

Implementation of:
Xyster_Container_Mutable::removeComponent()
Unregister a component by key
removeComponentByInstance (line 435)

Unregister a component by instance

  • return: the adapter removed
  • access: public
Xyster_Container_Adapter removeComponentByInstance (mixed $componentInstance)
  • mixed $componentInstance: the component instance to unregister.

Implementation of:
Xyster_Container_Mutable::removeComponentByInstance()
Unregister a component by instance
with (line 451)

You can set for the following operation only the characteristic of registration of a component on the fly

  • return: the same instance with temporary properties
  • access: public
Xyster_Container_Mutable with ( $properties)
  • Xyster_Collection_Map_Interface $properties

Implementation of:
Xyster_Container_Mutable::with()
You can set for the following operation only the characteristic of registration of a component on the fly
_addAdapterInternal (line 463)

Adds the adapter

  • access: protected
Xyster_Container _addAdapterInternal (Xyster_Container_Adapter $adapter)
_getComponentKeyToAdapterCache (line 481)

Gets the component key to adapter map

  • access: protected
Xyster_Collection_Map _getComponentKeyToAdapterCache ()
_getInstance (line 492)

Gets an instance of the component

  • access: protected
object _getInstance (Xyster_Container_Adapter $adapter)
_getLocalInstance (line 511)

Gets the local instance of an adapter

  • access: protected
mixed _getLocalInstance (Xyster_Container_Adapter $adapter)
_getModifiableComponentAdapterList (line 522)

Gets the adapters

  • access: protected
Xyster_Collection_List _getModifiableComponentAdapterList ()

Documentation generated on Mon, 19 May 2008 17:08:18 -0400 by phpDocumentor 1.4.2