system/classes/Collection.php
public function singleton($name, $value)
    {
        // If value is a closure, store a reference that tells us we need to store the resulting 
        // value as a singleton after it's first executed.
        if ($value instanceOf \Closure) {
            $this->signaturesToSingletons->$name = true;
        }
        // Use the __set magic method to handle setting the resource.
        $this->$name = $value;      
    }
public function singleton($name, $value)
    {
        // If value is a closure, store a reference that tells us we need to store the resulting 
        // value as a singleton after it's first executed.
        if ($value instanceOf \Closure) {
            $this->signaturesToSingletons->$name = true;
        }
        // Use the __set magic method to handle setting the resource.
        $this->$name = $value;      
    }
Stores a single version of a resource created by a closure so that subsequent requests
are given the already created resource instead of invoking the closure again.
This method can be given resources which are not closures, but doesn't do anything useful
unless given a closure.

@param $name A string which starts with a non-numeric character.
@param $value A closure which returns an object, array, or primitive when invoked.
@return void