public function offsetGet($id)
    {
        if ($this->hasAlias($id)) {
            $id = $this->getAlias($id);
        }

        if (!$this->has($id) && class_exists($id)) {
            return $this->build($id);
        }

        if (!isset($this->keys[$id])) {
            throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
        }

        if (
            isset($this->raw[$id])
            || !is_object($this->values[$id])
            || isset($this->protected[$this->values[$id]])
            || !method_exists($this->values[$id], '__invoke')
        ) {
            return $this->values[$id];
        }

        if (isset($this->factories[$this->values[$id]])) {
            return $this->values[$id]($this);
        }

        $raw = $this->values[$id];
        $val = $this->values[$id] = $raw($this);
        $this->raw[$id] = $raw;

        $this->frozen[$id] = true;

        return $val;
    }
public function offsetGet($id)
    {
        if ($this->hasAlias($id)) {
            $id = $this->getAlias($id);
        }

        if (!$this->has($id) && class_exists($id)) {
            return $this->build($id);
        }

        if (!isset($this->keys[$id])) {
            throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
        }

        if (
            isset($this->raw[$id])
            || !is_object($this->values[$id])
            || isset($this->protected[$this->values[$id]])
            || !method_exists($this->values[$id], '__invoke')
        ) {
            return $this->values[$id];
        }

        if (isset($this->factories[$this->values[$id]])) {
            return $this->values[$id]($this);
        }

        $raw = $this->values[$id];
        $val = $this->values[$id] = $raw($this);
        $this->raw[$id] = $raw;

        $this->frozen[$id] = true;

        return $val;
    }
public function offsetGet ( $ id ) { if ( $ this -> hasAlias ( $ id ) ) { $ id = $ this -> getAlias ( $ id ) ; } if ( ! $ this -> has ( $ id ) && class_exists ( $ id ) ) { return $ this -> build ( $ id ) ; } if ( ! isset ( $ this -> keys [ $ id ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Identifier "%s" is not defined.' , $ id ) ) ; } if ( isset ( $ this -> raw [ $ id ] ) || ! is_object ( $ this -> values [ $ id ] ) || isset ( $ this -> protected [ $ this -> values [ $ id ] ] ) || ! method_exists ( $ this -> values [ $ id ] , '__invoke' ) ) { return $ this -> values [ $ id ] ; } if ( isset ( $ this -> factories [ $ this -> values [ $ id ] ] ) ) { return $ this -> values [ $ id ] ( $ this ) ; } $ raw = $ this -> values [ $ id ] ; $ val = $ this -> values [ $ id ] = $ raw ( $ this ) ; $ this -> raw [ $ id ] = $ raw ; $ this -> frozen [ $ id ] = true ; return $ val ; }
Gets a parameter or an object.

@param string $id The unique identifier for the parameter or object

@return mixed The value of the parameter or an object

@throws \InvalidArgumentException if the identifier is not defined
Gets a parameter or an object .