src/generators/FileGenerator.php
protected function runProviders(array $providers, array $properties = array())
    {
        $data = array();

        foreach ($providers as $config) {
            if (is_string($config)) {
                $config = array($config);
            }

            $className = array_shift($config);

            if (isset(self::$config->providers[$className])) {
                $config = \CMap::mergeArray(self::$config->providers[$className], $config);
            } else {
                $config['class'] = $className;
            }

            if (!class_exists($config['class'])) {
                throw new Exception("Provider '{$config['class']}' does not exist.");
            }

            $class = new \ReflectionClass($config['class']);
            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                $name = $property->getName();

                if (!isset($config[$name]) && isset($properties[$name])) {
                    $config[$name] = $properties[$name];
                }
            }

            $provider = \Yii::createComponent($config);

            $data = array_merge($data, $provider->provide());
        }

        return $data;
    }
protected function runProviders(array $providers, array $properties = array())
    {
        $data = array();

        foreach ($providers as $config) {
            if (is_string($config)) {
                $config = array($config);
            }

            $className = array_shift($config);

            if (isset(self::$config->providers[$className])) {
                $config = \CMap::mergeArray(self::$config->providers[$className], $config);
            } else {
                $config['class'] = $className;
            }

            if (!class_exists($config['class'])) {
                throw new Exception("Provider '{$config['class']}' does not exist.");
            }

            $class = new \ReflectionClass($config['class']);
            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                $name = $property->getName();

                if (!isset($config[$name]) && isset($properties[$name])) {
                    $config[$name] = $properties[$name];
                }
            }

            $provider = \Yii::createComponent($config);

            $data = array_merge($data, $provider->provide());
        }

        return $data;
    }
protected function runProviders ( array $ providers , array $ properties = array ( ) ) { $ data = array ( ) ; foreach ( $ providers as $ config ) { if ( is_string ( $ config ) ) { $ config = array ( $ config ) ; } $ className = array_shift ( $ config ) ; if ( isset ( self :: $ config -> providers [ $ className ] ) ) { $ config = \ CMap :: mergeArray ( self :: $ config -> providers [ $ className ] , $ config ) ; } else { $ config [ 'class' ] = $ className ; } if ( ! class_exists ( $ config [ 'class' ] ) ) { throw new Exception ( "Provider '{$config['class']}' does not exist." ) ; } $ class = new \ ReflectionClass ( $ config [ 'class' ] ) ; foreach ( $ class -> getProperties ( \ ReflectionProperty :: IS_PUBLIC ) as $ property ) { $ name = $ property -> getName ( ) ; if ( ! isset ( $ config [ $ name ] ) && isset ( $ properties [ $ name ] ) ) { $ config [ $ name ] = $ properties [ $ name ] ; } } $ provider = \ Yii :: createComponent ( $ config ) ; $ data = array_merge ( $ data , $ provider -> provide ( ) ) ; } return $ data ; }
Runs a set of providers for this generator.

@param array $providers provider configurations.
@param array $properties an array of properties to set for providers.
@return array an array with the provided data.
Runs a set of providers for this generator .