src/helpers/BaseYaml.php
/**
     * @internal
     *
     * Builds a Dumper or Parser dependency
     *
     * @param  \yii\di\Container $container
     *
     * @param  array $params parameters
     *    - `class` key - (required) the class of dependency to build
     *    - `baseConfigs` key - array of configuration arrays to merge
     *
     * @param  array $config additional configuration array to merge
     *
     * @return Dumper|Parser the dependency object, depending on the specified
     *     class parameter.
     */
@internal
Builds a Dumper or Parser dependency

@param  \yii\di\Container $container

@param  array $params parameters
- `class` key - (required) the class of dependency to build
- `baseConfigs` key - array of configuration arrays to merge

@param  array $config additional configuration array to merge

@return Dumper|Parser the dependency object, depending on the specified
class parameter.
@internal Builds a Dumper or Parser dependency @param \ yii \ di \ Container $container @param array $params parameters - ` class ` key - ( required ) the class of dependency to build - ` baseConfigs ` key - array of configuration arrays to merge @param array $config additional configuration array to merge @return Dumper|Parser the dependency object depending on the specified class parameter .
public static function buildDependency($container, $params = [], $config = [])
    {
        if (empty($params['class'])) {
            throw new InvalidConfigException('A "class" parameter must be provided to build the dependency.');
        }
        $class = $params['class'];
        unset($params['class']);
        $combinedConfig = [];
        if (is_array($params['baseConfigs'])) {
            foreach ($params['baseConfigs'] as $baseConfig) {
                if (is_callable($baseConfig)) {
                    $baseConfig = call_user_func($baseConfig);
                }
                $combinedConfig = ArrayHelper::merge($combinedConfig, $baseConfig);
            }
        }
        unset($params['baseConfigs']);
        $combinedConfig = ArrayHelper::merge($combinedConfig, $config);
        $nullContainer = Yii::createObject('yii\di\Container');
        return $nullContainer->get($class, $params, $combinedConfig);
    }
public static function buildDependency ( $ container , $ params = [ ] , $ config = [ ] ) { if ( empty ( $ params [ 'class' ] ) ) { throw new InvalidConfigException ( 'A "class" parameter must be provided to build the dependency.' ) ; } $ class = $ params [ 'class' ] ; unset ( $ params [ 'class' ] ) ; $ combinedConfig = [ ] ; if ( is_array ( $ params [ 'baseConfigs' ] ) ) { foreach ( $ params [ 'baseConfigs' ] as $ baseConfig ) { if ( is_callable ( $ baseConfig ) ) { $ baseConfig = call_user_func ( $ baseConfig ) ; } $ combinedConfig = ArrayHelper :: merge ( $ combinedConfig , $ baseConfig ) ; } } unset ( $ params [ 'baseConfigs' ] ) ; $ combinedConfig = ArrayHelper :: merge ( $ combinedConfig , $ config ) ; $ nullContainer = Yii :: createObject ( 'yii\di\Container' ) ; return $ nullContainer -> get ( $ class , $ params , $ combinedConfig ) ; }
@internal
 Builds a Dumper or Parser dependency
@internal Builds a Dumper or Parser dependency
// We want to delegate to container set constructor/configurable params, // but we can't use the provided $container or Yii::$container since // they will lead us straight back to this method in an infinite loop. // So we create an empty container that doesn't know about $class so it // can just build it normally with the provided $params and // $combinedConfig