C_Component_Factory

A factory for hatching (instantiating) components.

Defined (1)

The class is defined in the following location(s).

/pope/lib/class.component_factory.php  
  1. class C_Component_Factory extends C_Component 
  2. static $_instances = array(); 
  3.  
  4. function define($context=FALSE) 
  5. parent::define($context); 
  6. $this->implement('I_Component_Factory'); 
  7.  
  8. function create($method, $args=array()) 
  9. // Format the arguments for the method call 
  10. $args = func_get_args(); 
  11. array_shift($args); 
  12.  
  13. // Create the component and apply the adapters 
  14. $component = $this->call_method($method, $args); 
  15.  
  16. return $component; 
  17.  
  18. static function &get_instance($context = False) 
  19. if (!isset(self::$_instances[$context])) { 
  20. self::$_instances[$context] = new C_Component_Factory($context); 
  21. return self::$_instances[$context];