public function addDependency($id, $className, $constructor, Doozr_Di_Dependency $dependency)
    {
        // Prepare indices ...
        $this->initDependenciesById($id);
        $this->initIndexByClassName($className);

        // Build index to speedup lookups
        $this->dependenciesById[$id][]          = $dependency;
        $index                                  = count($this->dependenciesById[$id]) - 1;
        $this->indexedByClassName[$className][] = &$this->dependenciesById[$id][$index];
        $this->classNameById[$id]               = $className;
        $this->constructorById[$id]             = $constructor;

        // update the numerical index for iterator access
        $this->numericalIndex = array_keys($this->dependenciesById);

        return true;
    }
public function addDependency($id, $className, $constructor, Doozr_Di_Dependency $dependency)
    {
        // Prepare indices ...
        $this->initDependenciesById($id);
        $this->initIndexByClassName($className);

        // Build index to speedup lookups
        $this->dependenciesById[$id][]          = $dependency;
        $index                                  = count($this->dependenciesById[$id]) - 1;
        $this->indexedByClassName[$className][] = &$this->dependenciesById[$id][$index];
        $this->classNameById[$id]               = $className;
        $this->constructorById[$id]             = $constructor;

        // update the numerical index for iterator access
        $this->numericalIndex = array_keys($this->dependenciesById);

        return true;
    }
public function addDependency ( $ id , $ className , $ constructor , Doozr_Di_Dependency $ dependency ) { // Prepare indices ... $ this -> initDependenciesById ( $ id ) ; $ this -> initIndexByClassName ( $ className ) ; // Build index to speedup lookups $ this -> dependenciesById [ $ id ] [ ] = $ dependency ; $ index = count ( $ this -> dependenciesById [ $ id ] ) - 1 ; $ this -> indexedByClassName [ $ className ] [ ] = & $ this -> dependenciesById [ $ id ] [ $ index ] ; $ this -> classNameById [ $ id ] = $ className ; $ this -> constructorById [ $ id ] = $ constructor ; // update the numerical index for iterator access $ this -> numericalIndex = array_keys ( $ this -> dependenciesById ) ; return true ; }
Adds a dependency to collection and indexes it by id, className.

@param string              $id          Identifier to file the reference under
@param string              $className   Name of the class having the dependencies
@param string              $constructor Constructor of the class having the dependency
@param Doozr_Di_Dependency $dependency  Dependency recipe

@author Benjamin Carl <opensource@clickalicious.de>

@return bool TRUE on success
Adds a dependency to collection and indexes it by id className .