framework/di/Container.php
public function setSingletons(array $singletons)
    {
        foreach ($singletons as $class => $definition) {
            if (is_array($definition) && count($definition) === 2 && array_values($definition) === $definition) {
                $this->setSingleton($class, $definition[0], $definition[1]);
                continue;
            }

            $this->setSingleton($class, $definition);
        }
    }
public function setSingletons(array $singletons)
    {
        foreach ($singletons as $class => $definition) {
            if (is_array($definition) && count($definition) === 2 && array_values($definition) === $definition) {
                $this->setSingleton($class, $definition[0], $definition[1]);
                continue;
            }

            $this->setSingleton($class, $definition);
        }
    }
Registers class definitions as singletons within this container by calling [[setSingleton()]].

@param array $singletons array of singleton definitions. See [[setDefinitions()]]
for allowed formats of array.

@see setDefinitions() for allowed formats of $singletons parameter
@see setSingleton() to know more about possible values of definitions
@since 2.0.11