/** * Adds the given bean to the container. * * @param Customweb_DependencyInjection_IBean $bean * @return Customweb_DependencyInjection_Container_Extendable */ public function addBean(Customweb_DependencyInjection_IBean $bean) { $instance = $bean->getInstance($this); $className = get_class($instance); $classes = $bean->getClasses(); $beanId = strtolower($bean->getBeanId()); $this->beans[$beanId] = $instance; foreach ($classes as $class) { $class = strtolower($class); if (!isset($this->beansByClasses[$class])) { $this->beansByClasses[$class] = array(); } $this->beansByClasses[$class][] = $instance; $this->beans[$class] = $instance; } return $this; }
/** * This method creates an instance of the given bean. Sub classes may override this method. * * @param Customweb_DependencyInjection_IBean $bean * @return object */ protected function createInstance(Customweb_DependencyInjection_IBean $bean) { return $bean->getInstance($this); }