FOF30\Pimple\Container::offsetGet PHP Method

offsetGet() public method

Gets a parameter or an object.
public offsetGet ( string $id ) : mixed
$id string The unique identifier for the parameter or object
return mixed The value of the parameter or an object
    public function offsetGet($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;
    }