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

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

            $this->set($class, $definition);
        }
    }
Registers class definitions within this container.

@param array $definitions array of definitions. There are two allowed formats of array.
The first format:
- key: class name, interface name or alias name. The key will be passed to the [[set()]] method
as a first argument `$class`.
- value: the definition associated with `$class`. Possible values are described in
[[set()]] documentation for the `$definition` parameter. Will be passed to the [[set()]] method
as the second argument `$definition`.

Example:
```php
$container->setDefinitions([
'yii\web\Request' => 'app\components\Request',
'yii\web\Response' => [
'class' => 'app\components\Response',
'format' => 'json'
],
'foo\Bar' => function () {
$qux = new Qux;
$foo = new Foo($qux);
return new Bar($foo);
}
]);
```

The second format:
- key: class name, interface name or alias name. The key will be passed to the [[set()]] method
as a first argument `$class`.
- value: array of two elements. The first element will be passed the [[set()]] method as the
second argument `$definition`, the second one — as `$params`.

Example:
```php
$container->setDefinitions([
'foo\Bar' => [
['class' => 'app\Bar'],
[Instance::of('baz')]
]
]);
```

@see set() to know more about possible values of definitions
@since 2.0.11