protected function addRuntimeSettings() {
        $newSettings = [];

        foreach ($this->config['options'] as $option => $value) {
            if (in_array($option, ['s', 'setting'])) {
                switch (gettype($value)) {
                    case 'string':
                        $newSettings[] = $value;
                        break;
                    case 'array':
                        foreach ($value as $item) {
                            if (!is_string($item)) {
                                throw new Exception(sprintf(
                                    'Unknown value "%s" for option "%s"',
                                    $item,
                                    $option
                                ));
                            }

                            $newSettings[] = $item;
                        }
                        break;
                    default:
                        throw new Exception(sprintf(
                            'Unknown value "%s" for option "%s"',
                            $value,
                            $option
                        ), ExitApp::BAD_USER_INTERACTION);
                }
            }
        }

        foreach ($newSettings as $newSetting) {
            $key = strstr($newSetting, '=', true);
            $value = strstr($newSetting, '=');

            if ($key === false || $value === false ||
                strlen($key) === 0 || strlen($value) <= 1) {
                throw new Exception('Invalid runtime settings', ExitApp::BAD_USER_INTERACTION);
            }

            // Crop "=":
            $value = substr($value, 1);

            // Type casting:
            if (is_numeric($value) && (int) $value == $value) {
                $value = (int) $value;
            } elseif (is_numeric($value) && (float) $value == $value) {
                $value = (float) $value;
            } elseif (strtolower($value) === 'true') {
                $value = true;
            } elseif (strtolower($value) === 'false') {
                $value = false;
            }

            $keys = explode('.', $key);

            $settings = $this->buildSettings($keys, $value);

            $this->addConfigSettings($settings);
        }

        return $this;
    }
protected function addRuntimeSettings() {
        $newSettings = [];

        foreach ($this->config['options'] as $option => $value) {
            if (in_array($option, ['s', 'setting'])) {
                switch (gettype($value)) {
                    case 'string':
                        $newSettings[] = $value;
                        break;
                    case 'array':
                        foreach ($value as $item) {
                            if (!is_string($item)) {
                                throw new Exception(sprintf(
                                    'Unknown value "%s" for option "%s"',
                                    $item,
                                    $option
                                ));
                            }

                            $newSettings[] = $item;
                        }
                        break;
                    default:
                        throw new Exception(sprintf(
                            'Unknown value "%s" for option "%s"',
                            $value,
                            $option
                        ), ExitApp::BAD_USER_INTERACTION);
                }
            }
        }

        foreach ($newSettings as $newSetting) {
            $key = strstr($newSetting, '=', true);
            $value = strstr($newSetting, '=');

            if ($key === false || $value === false ||
                strlen($key) === 0 || strlen($value) <= 1) {
                throw new Exception('Invalid runtime settings', ExitApp::BAD_USER_INTERACTION);
            }

            // Crop "=":
            $value = substr($value, 1);

            // Type casting:
            if (is_numeric($value) && (int) $value == $value) {
                $value = (int) $value;
            } elseif (is_numeric($value) && (float) $value == $value) {
                $value = (float) $value;
            } elseif (strtolower($value) === 'true') {
                $value = true;
            } elseif (strtolower($value) === 'false') {
                $value = false;
            }

            $keys = explode('.', $key);

            $settings = $this->buildSettings($keys, $value);

            $this->addConfigSettings($settings);
        }

        return $this;
    }
protected function addRuntimeSettings ( ) { $ newSettings = [ ] ; foreach ( $ this -> config [ 'options' ] as $ option => $ value ) { if ( in_array ( $ option , [ 's' , 'setting' ] ) ) { switch ( gettype ( $ value ) ) { case 'string' : $ newSettings [ ] = $ value ; break ; case 'array' : foreach ( $ value as $ item ) { if ( ! is_string ( $ item ) ) { throw new Exception ( sprintf ( 'Unknown value "%s" for option "%s"' , $ item , $ option ) ) ; } $ newSettings [ ] = $ item ; } break ; default : throw new Exception ( sprintf ( 'Unknown value "%s" for option "%s"' , $ value , $ option ) , ExitApp :: BAD_USER_INTERACTION ) ; } } } foreach ( $ newSettings as $ newSetting ) { $ key = strstr ( $ newSetting , '=' , true ) ; $ value = strstr ( $ newSetting , '=' ) ; if ( $ key === false || $ value === false || strlen ( $ key ) === 0 || strlen ( $ value ) <= 1 ) { throw new Exception ( 'Invalid runtime settings' , ExitApp :: BAD_USER_INTERACTION ) ; } // Crop "=": $ value = substr ( $ value , 1 ) ; // Type casting: if ( is_numeric ( $ value ) && ( int ) $ value == $ value ) { $ value = ( int ) $ value ; } elseif ( is_numeric ( $ value ) && ( float ) $ value == $ value ) { $ value = ( float ) $ value ; } elseif ( strtolower ( $ value ) === 'true' ) { $ value = true ; } elseif ( strtolower ( $ value ) === 'false' ) { $ value = false ; } $ keys = explode ( '.' , $ key ) ; $ settings = $ this -> buildSettings ( $ keys , $ value ) ; $ this -> addConfigSettings ( $ settings ) ; } return $ this ; }
Look for additional configuration settings given as options

@return self Returns itself

@throws Exception on error
Look for additional configuration settings given as options