framework/di/Container.php
public function setSingleton($class, $definition = [], array $params = [])
    {
        $this->_definitions[$class] = $this->normalizeDefinition($class, $definition);
        $this->_params[$class] = $params;
        $this->_singletons[$class] = null;
        return $this;
    }
public function setSingleton($class, $definition = [], array $params = [])
    {
        $this->_definitions[$class] = $this->normalizeDefinition($class, $definition);
        $this->_params[$class] = $params;
        $this->_singletons[$class] = null;
        return $this;
    }
public function setSingleton ( $ class , $ definition = [ ] , array $ params = [ ] ) { $ this -> _definitions [ $ class ] = $ this -> normalizeDefinition ( $ class , $ definition ) ; $ this -> _params [ $ class ] = $ params ; $ this -> _singletons [ $ class ] = null ; return $ this ; }
Registers a class definition with this container and marks the class as a singleton class.

This method is similar to [[set()]] except that classes registered via this method will only have one
instance. Each time [[get()]] is called, the same instance of the specified class will be returned.

@param string $class class name, interface name or alias name
@param mixed $definition the definition associated with `$class`. See [[set()]] for more details.
@param array $params the list of constructor parameters. The parameters will be passed to the class
constructor when [[get()]] is called.
@return $this the container itself
@see set()
Registers a class definition with this container and marks the class as a singleton class .