src/Container.php
public function factory($idOrClosure)
    {
        if (is_object($idOrClosure) && method_exists($idOrClosure, "__invoke")) {
            $this->factories->attach($idOrClosure);

            return $idOrClosure;
        }

        if (!isset($this->definitions[$idOrClosure])) {
            return null;
        }

        if (method_exists($this->definitions[$idOrClosure], '__invoke')) {
            return $this->definitions[$idOrClosure]($this);
        }

        return $this->definitions[$idOrClosure];
    }
public function factory($idOrClosure)
    {
        if (is_object($idOrClosure) && method_exists($idOrClosure, "__invoke")) {
            $this->factories->attach($idOrClosure);

            return $idOrClosure;
        }

        if (!isset($this->definitions[$idOrClosure])) {
            return null;
        }

        if (method_exists($this->definitions[$idOrClosure], '__invoke')) {
            return $this->definitions[$idOrClosure]($this);
        }

        return $this->definitions[$idOrClosure];
    }
Gets or sets callable to return fresh objects.
If a callable is given, then it sets that the get() method always
to return new objects. If an string (key ID's) is given, then it
will return new object.

@param mixed $idOrClosure

@return mixed