public function preInit(&$config)
    {
        if (!isset($config['id'])) {
            throw new InvalidConfigException('The "id" configuration for the Application is required.');
        }
        if (isset($config['basePath'])) {
            $this->setBasePath($config['basePath']);
            unset($config['basePath']);
        } else {
            throw new InvalidConfigException('The "basePath" configuration for the Application is required.');
        }

        if (isset($config['vendorPath'])) {
            $this->setVendorPath($config['vendorPath']);
            unset($config['vendorPath']);
        } else {
            // set "@vendor"
            $this->getVendorPath();
        }
        if (isset($config['runtimePath'])) {
            $this->setRuntimePath($config['runtimePath']);
            unset($config['runtimePath']);
        } else {
            // set "@runtime"
            $this->getRuntimePath();
        }

        if (isset($config['timeZone'])) {
            $this->setTimeZone($config['timeZone']);
            unset($config['timeZone']);
        } elseif (!ini_get('date.timezone')) {
            $this->setTimeZone('UTC');
        }

        // merge core components with custom components
        foreach ($this->coreComponents() as $id => $component) {
            if (!isset($config['components'][$id])) {
                $config['components'][$id] = $component;
            } elseif (is_array($config['components'][$id]) && !isset($config['components'][$id]['class'])) {
                $config['components'][$id]['class'] = $component['class'];
            }
        }
    }
public function preInit(&$config)
    {
        if (!isset($config['id'])) {
            throw new InvalidConfigException('The "id" configuration for the Application is required.');
        }
        if (isset($config['basePath'])) {
            $this->setBasePath($config['basePath']);
            unset($config['basePath']);
        } else {
            throw new InvalidConfigException('The "basePath" configuration for the Application is required.');
        }

        if (isset($config['vendorPath'])) {
            $this->setVendorPath($config['vendorPath']);
            unset($config['vendorPath']);
        } else {
            // set "@vendor"
            $this->getVendorPath();
        }
        if (isset($config['runtimePath'])) {
            $this->setRuntimePath($config['runtimePath']);
            unset($config['runtimePath']);
        } else {
            // set "@runtime"
            $this->getRuntimePath();
        }

        if (isset($config['timeZone'])) {
            $this->setTimeZone($config['timeZone']);
            unset($config['timeZone']);
        } elseif (!ini_get('date.timezone')) {
            $this->setTimeZone('UTC');
        }

        // merge core components with custom components
        foreach ($this->coreComponents() as $id => $component) {
            if (!isset($config['components'][$id])) {
                $config['components'][$id] = $component;
            } elseif (is_array($config['components'][$id]) && !isset($config['components'][$id]['class'])) {
                $config['components'][$id]['class'] = $component['class'];
            }
        }
    }
public function preInit ( & $ config ) { if ( ! isset ( $ config [ 'id' ] ) ) { throw new InvalidConfigException ( 'The "id" configuration for the Application is required.' ) ; } if ( isset ( $ config [ 'basePath' ] ) ) { $ this -> setBasePath ( $ config [ 'basePath' ] ) ; unset ( $ config [ 'basePath' ] ) ; } else { throw new InvalidConfigException ( 'The "basePath" configuration for the Application is required.' ) ; } if ( isset ( $ config [ 'vendorPath' ] ) ) { $ this -> setVendorPath ( $ config [ 'vendorPath' ] ) ; unset ( $ config [ 'vendorPath' ] ) ; } else { // set "@vendor" $ this -> getVendorPath ( ) ; } if ( isset ( $ config [ 'runtimePath' ] ) ) { $ this -> setRuntimePath ( $ config [ 'runtimePath' ] ) ; unset ( $ config [ 'runtimePath' ] ) ; } else { // set "@runtime" $ this -> getRuntimePath ( ) ; } if ( isset ( $ config [ 'timeZone' ] ) ) { $ this -> setTimeZone ( $ config [ 'timeZone' ] ) ; unset ( $ config [ 'timeZone' ] ) ; } elseif ( ! ini_get ( 'date.timezone' ) ) { $ this -> setTimeZone ( 'UTC' ) ; } // merge core components with custom components foreach ( $ this -> coreComponents ( ) as $ id => $ component ) { if ( ! isset ( $ config [ 'components' ] [ $ id ] ) ) { $ config [ 'components' ] [ $ id ] = $ component ; } elseif ( is_array ( $ config [ 'components' ] [ $ id ] ) && ! isset ( $ config [ 'components' ] [ $ id ] [ 'class' ] ) ) { $ config [ 'components' ] [ $ id ] [ 'class' ] = $ component [ 'class' ] ; } } }
Pre-initializes the application.
This method is called at the beginning of the application constructor.
It initializes several important application properties.
If you override this method, please make sure you call the parent implementation.
@param array $config the application configuration
@throws InvalidConfigException if either [[id]] or [[basePath]] configuration is missing.
Pre - initializes the application . This method is called at the beginning of the application constructor . It initializes several important application properties . If you override this method please make sure you call the parent implementation .