private function buildObjects(): void
    {
        //deep dependency level, start to array end for not use array_reverse
        for ($i = \count($this->tree) - 1; $i >= 0; $i--) {

            //class
            foreach ($this->tree[$i] as $class => $arguments) {

                //try to find object in class
                $object = $this->cache[$class] ?? null;

                //if object is not in cache and need arguments try to build
                if ($object === null && \count($arguments)) {

                    //build arguments
                    $args = $this->buildArguments($class, $arguments);

                    //store object with dependencies in cache
                    $this->cache[$class] = (new ReflectionClass($class))->newInstanceArgs($args);

                    continue;
                }

                if ($object === null) {

                    //store object in cache
                    $this->cache[$class] = (new ReflectionClass($class))->newInstance();
                }
            }
        }
    }
private function buildObjects(): void
    {
        //deep dependency level, start to array end for not use array_reverse
        for ($i = \count($this->tree) - 1; $i >= 0; $i--) {

            //class
            foreach ($this->tree[$i] as $class => $arguments) {

                //try to find object in class
                $object = $this->cache[$class] ?? null;

                //if object is not in cache and need arguments try to build
                if ($object === null && \count($arguments)) {

                    //build arguments
                    $args = $this->buildArguments($class, $arguments);

                    //store object with dependencies in cache
                    $this->cache[$class] = (new ReflectionClass($class))->newInstanceArgs($args);

                    continue;
                }

                if ($object === null) {

                    //store object in cache
                    $this->cache[$class] = (new ReflectionClass($class))->newInstance();
                }
            }
        }
    }
private function buildObjects ( ) : void { //deep dependency level, start to array end for not use array_reverse for ( $ i = \ count ( $ this -> tree ) - 1 ; $ i >= 0 ; $ i -- ) { //class foreach ( $ this -> tree [ $ i ] as $ class => $ arguments ) { //try to find object in class $ object = $ this -> cache [ $ class ] ?? null ; //if object is not in cache and need arguments try to build if ( $ object === null && \ count ( $ arguments ) ) { //build arguments $ args = $ this -> buildArguments ( $ class , $ arguments ) ; //store object with dependencies in cache $ this -> cache [ $ class ] = ( new ReflectionClass ( $ class ) ) -> newInstanceArgs ( $ args ) ; continue ; } if ( $ object === null ) { //store object in cache $ this -> cache [ $ class ] = ( new ReflectionClass ( $ class ) ) -> newInstance ( ) ; } } } }
Build objects from dependencyTree.

@return void
Build objects from dependencyTree .