yii\di\Container::setSingletons PHP Метод

setSingletons() публичный Метод

Registers class definitions as singletons within this container by calling Container::setSingleton
См. также: setDefinitions() for allowed formats of $singletons parameter
См. также: setSingleton() to know more about possible values of definitions
С версии: 2.0.11
public setSingletons ( array $singletons )
$singletons array array of singleton definitions. See [[setDefinitions()]] for allowed formats of array.
    public function setSingletons(array $singletons)
    {
        foreach ($singletons as $class => $definition) {
            if (count($definition) === 2 && array_values($definition) === $definition) {
                $this->setSingleton($class, $definition[0], $definition[1]);
                continue;
            }
            $this->setSingleton($class, $definition);
        }
    }