system/classes/Collection.php
public function checkIfSingleton($name, $item) 
    {
        // If the closure is marked as needing to be saved as a singleton, store result. 
        if (isset($this->signaturesToSingletons->$name) and $this->signaturesToSingletons->$name) {
            $this->$name = $item;
            $this->signaturesToSingletons = false;
        }
    }
public function checkIfSingleton($name, $item) 
    {
        // If the closure is marked as needing to be saved as a singleton, store result. 
        if (isset($this->signaturesToSingletons->$name) and $this->signaturesToSingletons->$name) {
            $this->$name = $item;
            $this->signaturesToSingletons = false;
        }
    }
Checks if a resource should be saved as a singleton. Save item if yes.

@param string $name The name of the resource.
@param mixed $item An instance of the resource.
@return void