private function build(string $name)
    {
        $instance = null;
        $map = $this->map[$name];

        if (is_array($map)) {
            $params = $this->getParamsFromMap($map);
            $instance = new $name(...$params);
        } elseif ($map instanceof \Closure) {
            $instance = $map($this);
        } elseif (is_object($map)) {
            $instance = $map;
        } elseif (is_string($map)) {
            $instance = $this->get($map);
        } else {
            throw new \Exception('Invalid map');
        }

        return $instance;
    }
private function build(string $name)
    {
        $instance = null;
        $map = $this->map[$name];

        if (is_array($map)) {
            $params = $this->getParamsFromMap($map);
            $instance = new $name(...$params);
        } elseif ($map instanceof \Closure) {
            $instance = $map($this);
        } elseif (is_object($map)) {
            $instance = $map;
        } elseif (is_string($map)) {
            $instance = $this->get($map);
        } else {
            throw new \Exception('Invalid map');
        }

        return $instance;
    }
private function build ( string $ name ) { $ instance = null ; $ map = $ this -> map [ $ name ] ; if ( is_array ( $ map ) ) { $ params = $ this -> getParamsFromMap ( $ map ) ; $ instance = new $ name ( ... $ params ) ; } elseif ( $ map instanceof \ Closure ) { $ instance = $ map ( $ this ) ; } elseif ( is_object ( $ map ) ) { $ instance = $ map ; } elseif ( is_string ( $ map ) ) { $ instance = $ this -> get ( $ map ) ; } else { throw new \ Exception ( 'Invalid map' ) ; } return $ instance ; }
Build an object according to the map information.

@param string $name

@throws \Exception

@return object
Build an object according to the map information .