src/ContainerAbstract.php
protected function resolve($name, bool $new = false)
    {
        // resolve alias
        $name = $this->getAlias($name);

        // TODO : il faudrait aussi vérifier si $new est à false avant de rentrer dans ce test. non ????
        if (array_key_exists($name, $this->services)) {
            return $this->services[$name];
        }
        if (! array_key_exists($name, $this->definitions)) {
            if (! class_exists($name)) {
                throw new EntityNotFoundException("Service '$name' wasn't found in the dependency injection container");
            }
            $this->add($name);
        }

        $definition = $this->definitions[$name];
        //$definition = $this->getDefinition($name);

        $instance = $this->resolver->resolve($definition->getConcrete(), $definition->getAssigns());
        //$instance = $this->resolver->resolve($definition->getConcrete(), $this->convertAssign($definition->assigns));

        /*
        if (array_key_exists($name, $this->classes)) {
            //$instance = $this->resolver->build($this->classes[$name], $this->resolveArguments($definition->assigns));
            $instance = $this->resolver->resolve($this->classes[$name], $definition->assigns);
        } elseif (array_key_exists($name, $this->closures)) {
            //$instance = $this->resolver->call($this->closures[$name], $this->resolveArguments($definition->assigns));
            $instance = $this->resolver->resolve($this->closures[$name], $definition->assigns);
        }*/

        if ($definition->isShared() && $new === false) {
            $this->services[$name] = $instance;
        }

        return $instance;
    }
protected function resolve($name, bool $new = false)
    {
        // resolve alias
        $name = $this->getAlias($name);

        // TODO : il faudrait aussi vérifier si $new est à false avant de rentrer dans ce test. non ????
        if (array_key_exists($name, $this->services)) {
            return $this->services[$name];
        }
        if (! array_key_exists($name, $this->definitions)) {
            if (! class_exists($name)) {
                throw new EntityNotFoundException("Service '$name' wasn't found in the dependency injection container");
            }
            $this->add($name);
        }

        $definition = $this->definitions[$name];
        //$definition = $this->getDefinition($name);

        $instance = $this->resolver->resolve($definition->getConcrete(), $definition->getAssigns());
        //$instance = $this->resolver->resolve($definition->getConcrete(), $this->convertAssign($definition->assigns));

        /*
        if (array_key_exists($name, $this->classes)) {
            //$instance = $this->resolver->build($this->classes[$name], $this->resolveArguments($definition->assigns));
            $instance = $this->resolver->resolve($this->classes[$name], $definition->assigns);
        } elseif (array_key_exists($name, $this->closures)) {
            //$instance = $this->resolver->call($this->closures[$name], $this->resolveArguments($definition->assigns));
            $instance = $this->resolver->resolve($this->closures[$name], $definition->assigns);
        }*/

        if ($definition->isShared() && $new === false) {
            $this->services[$name] = $instance;
        }

        return $instance;
    }
protected function resolve ( $ name , bool $ new = false ) { // resolve alias $ name = $ this -> getAlias ( $ name ) ; // TODO : il faudrait aussi vérifier si $new est à false avant de rentrer dans ce test. non ???? if ( array_key_exists ( $ name , $ this -> services ) ) { return $ this -> services [ $ name ] ; } if ( ! array_key_exists ( $ name , $ this -> definitions ) ) { if ( ! class_exists ( $ name ) ) { throw new EntityNotFoundException ( "Service '$name' wasn't found in the dependency injection container" ) ; } $ this -> add ( $ name ) ; } $ definition = $ this -> definitions [ $ name ] ; //$definition = $this->getDefinition($name); $ instance = $ this -> resolver -> resolve ( $ definition -> getConcrete ( ) , $ definition -> getAssigns ( ) ) ; //$instance = $this->resolver->resolve($definition->getConcrete(), $this->convertAssign($definition->assigns)); /*
        if (array_key_exists($name, $this->classes)) {
            //$instance = $this->resolver->build($this->classes[$name], $this->resolveArguments($definition->assigns));
            $instance = $this->resolver->resolve($this->classes[$name], $definition->assigns);
        } elseif (array_key_exists($name, $this->closures)) {
            //$instance = $this->resolver->call($this->closures[$name], $this->resolveArguments($definition->assigns));
            $instance = $this->resolver->resolve($this->closures[$name], $definition->assigns);
        }*/ if ( $ definition -> isShared ( ) && $ new === false ) { $ this -> services [ $ name ] = $ instance ; } return $ instance ; }
@param string $name

@return mixed|object
@param string $name