protected function applyConfigs(Container $app, $config)
    {
        foreach ($config as $varName => $options) {
            if (isset($options[self::CONFIG_KEY_DEFAULT])) {
                if (isset($app[$varName]) === false) {
                    $app[$varName] = $options[self::CONFIG_KEY_DEFAULT];
                }
            }

            if (isset($options[self::CONFIG_KEY_REQUIRED])) {
                if ($options[self::CONFIG_KEY_REQUIRED]) {
                    \Dotenv::required($app['env.options']['prefix'].'_'.strtoupper($varName));
                }
            }

            if (isset($options[self::CONFIG_KEY_ALLOWED])) {
                \Dotenv::required(
                    $app['env.options']['prefix'].'_'.strtoupper($varName),
                    $options[self::CONFIG_KEY_ALLOWED]
                );
            }

            if (isset($options[self::CONFIG_KEY_CAST])) {
                switch ($options[self::CONFIG_KEY_CAST]) {
                    case self::CAST_TYPE_INT:
                        $app[$varName] = (int)$app[$varName];
                        break;
                    case self::CAST_TYPE_FLOAT:
                        $app[$varName] = (float)$app[$varName];
                        break;
                    case self::CAST_TYPE_BOOLEAN:
                        $app[$varName] = filter_var(($app[$varName]), FILTER_VALIDATE_BOOLEAN);
                        break;
                    default: //string
                        break;
                }
            }

        }

    }
protected function applyConfigs(Container $app, $config)
    {
        foreach ($config as $varName => $options) {
            if (isset($options[self::CONFIG_KEY_DEFAULT])) {
                if (isset($app[$varName]) === false) {
                    $app[$varName] = $options[self::CONFIG_KEY_DEFAULT];
                }
            }

            if (isset($options[self::CONFIG_KEY_REQUIRED])) {
                if ($options[self::CONFIG_KEY_REQUIRED]) {
                    \Dotenv::required($app['env.options']['prefix'].'_'.strtoupper($varName));
                }
            }

            if (isset($options[self::CONFIG_KEY_ALLOWED])) {
                \Dotenv::required(
                    $app['env.options']['prefix'].'_'.strtoupper($varName),
                    $options[self::CONFIG_KEY_ALLOWED]
                );
            }

            if (isset($options[self::CONFIG_KEY_CAST])) {
                switch ($options[self::CONFIG_KEY_CAST]) {
                    case self::CAST_TYPE_INT:
                        $app[$varName] = (int)$app[$varName];
                        break;
                    case self::CAST_TYPE_FLOAT:
                        $app[$varName] = (float)$app[$varName];
                        break;
                    case self::CAST_TYPE_BOOLEAN:
                        $app[$varName] = filter_var(($app[$varName]), FILTER_VALIDATE_BOOLEAN);
                        break;
                    default: //string
                        break;
                }
            }

        }

    }
protected function applyConfigs ( Container $ app , $ config ) { foreach ( $ config as $ varName => $ options ) { if ( isset ( $ options [ self :: CONFIG_KEY_DEFAULT ] ) ) { if ( isset ( $ app [ $ varName ] ) === false ) { $ app [ $ varName ] = $ options [ self :: CONFIG_KEY_DEFAULT ] ; } } if ( isset ( $ options [ self :: CONFIG_KEY_REQUIRED ] ) ) { if ( $ options [ self :: CONFIG_KEY_REQUIRED ] ) { \ Dotenv :: required ( $ app [ 'env.options' ] [ 'prefix' ] . '_' . strtoupper ( $ varName ) ) ; } } if ( isset ( $ options [ self :: CONFIG_KEY_ALLOWED ] ) ) { \ Dotenv :: required ( $ app [ 'env.options' ] [ 'prefix' ] . '_' . strtoupper ( $ varName ) , $ options [ self :: CONFIG_KEY_ALLOWED ] ) ; } if ( isset ( $ options [ self :: CONFIG_KEY_CAST ] ) ) { switch ( $ options [ self :: CONFIG_KEY_CAST ] ) { case self :: CAST_TYPE_INT : $ app [ $ varName ] = ( int ) $ app [ $ varName ] ; break ; case self :: CAST_TYPE_FLOAT : $ app [ $ varName ] = ( float ) $ app [ $ varName ] ; break ; case self :: CAST_TYPE_BOOLEAN : $ app [ $ varName ] = filter_var ( ( $ app [ $ varName ] ) , FILTER_VALIDATE_BOOLEAN ) ; break ; default : //string break ; } } } }
applies config options to expected vars

@param Container $app
@param $config
applies config options to expected vars