src/Container.php
public function get($id)
    {
        if (!$this->has($id)) {
            throw new NotFoundException("No entry was found for the identifier '$id'");
        }

        if (method_exists($this->definitions[$id], "__invoke")) {
            if (isset($this->raws[$this->definitions[$id]])) {
                return $this->definitions[$id];
            }

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

            if ($this->calcs[$id]) {
                return $this->objects[$id];
            }
            $obj = $this->definitions[$id]();
            $this->objects[$id] = $obj;
            $this->calcs[$id] = true;

            return $obj;
        }

        return $this->definitions[$id];
    }
public function get($id)
    {
        if (!$this->has($id)) {
            throw new NotFoundException("No entry was found for the identifier '$id'");
        }

        if (method_exists($this->definitions[$id], "__invoke")) {
            if (isset($this->raws[$this->definitions[$id]])) {
                return $this->definitions[$id];
            }

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

            if ($this->calcs[$id]) {
                return $this->objects[$id];
            }
            $obj = $this->definitions[$id]();
            $this->objects[$id] = $obj;
            $this->calcs[$id] = true;

            return $obj;
        }

        return $this->definitions[$id];
    }
Finds an entry of the container by its identifier and returns it.

@param string $id Identifier of the entry to look for.

@throws NotFoundException  No entry was found for this identifier.
@throws ContainerException Error while retrieving the entry.

@return mixed Entry.