@param array $config
@param bool  $shortNames if short names (like o for option or v for variables) should be used

@return string
189408
private static function getUriStringFromStackConfig(array $config, $shortNames = true)
    {
        $newOptions = [];

        if (isset($config['operations'])) {
            foreach ($config['operations'] as $values) {
                if ($values instanceof StackOperation) {
                    $newOptions[] = self::getStringForOptions($values->name, $values->options, $values->expressions);
                } else {
                    if (!isset($values['expressions'])) {
                        $values['expressions'] = [];
                    }
                    $newOptions[] = self::getStringForOptions($values['name'], $values['options'], $values['expressions']);
                }
            }
        }

        $newStackOptions = null;
        $nameOptions = $shortNames ? 'o' : 'options';
        if (isset($config['options'])) {
            $newStackOptions = self::getStringForOptions($nameOptions, $config['options']);
        }
        //don't return this, if it's only "options" as string
        if (null !== $newStackOptions && $nameOptions !== $newStackOptions) {
            $newOptions[] = $newStackOptions;
        }

        $newStackVariables = null;
        $nameVariables = $shortNames ? 'v' : 'variables';
        if (isset($config['variables'])) {
            $newStackVariables = self::getStringForOptions($nameVariables, $config['variables']);
        }
        //don't return this, if it's only "variables" as string
        if (null !== $newStackVariables && $nameVariables !== $newStackVariables) {
            $newOptions[] = $newStackVariables;
        }
        $options = implode('--', $newOptions);

        return $options;
    }
685869
public function parseFuelConfig(array $config)
	{
		$params = array();

		$params['driver'] = $config['type'];

		if ($params['driver'] === 'pdo')
		{
			list($type, $dsn) = explode(':', $config['connection']['dsn'], 2);

			$params['driver'] .= '_' . $type;

			$dsn = explode(';', $dsn);

			foreach ($dsn as $d)
			{
				list($k, $v) = explode('=', $d);

				$params[$k] = $v;
			}
		}
		else
		{
			$params['dbname'] = $config['connection']['database'];
			$params['host'] = $config['connection']['hostname'];
			$params['port'] = Arr::get($config, 'connection.port');
		}

		$params['user'] = Arr::get($config, 'connection.username');
		$params['password'] = Arr::get($config, 'connection.password');
		$params['charset'] = Arr::get($config, 'charset');

		return $params;
	}
953303
public function message(array $config): string
    {
        if ($this->message) {
            return $this->message;
        }

        return trans('self-diagnosis::checks.locales_are_installed.message.missing_locales', [
            'locales' => $this->missingLocales->implode(PHP_EOL),
        ]);
    }
1042466
protected function getDsn(array $config)
    {
        if (! empty($config['tns'])) {
            return $config['tns'];
        }

        // parse configuration
        $config = $this->parseConfig($config);

        // check multiple connections/host, comma delimiter
        $config = $this->checkMultipleHostDsn($config);

        // return generated tns
        return $config['tns'];
    }
41237
public static function generateNameValueList( $config = [] ) {

		$config = static::applySiteFilters( $config );

		$modelClass	= static::$modelClass;
		$modelTable = $modelClass::tableName();

		// map columns
		$nameColumn		= $config[ 'nameColumn' ] ?? 'name';
		$valueColumn	= $config[ 'valueColumn' ] ?? 'value';

		// column alias
		$nameAlias		= $config[ 'nameAlias' ] ?? 'name';
		$valueAlias		= $config[ 'valueAlias' ] ?? 'value';

		// limit
		$limit			= $config[ 'limit' ] ?? 0;

		// Query
		$query = $config[ 'query' ] ?? new Query();

		// Conditions, Filters and Sorting
		$conditions	= $config[ 'conditions' ] ?? null;
		$filters	= $config[ 'filters' ] ?? null;
		$order		= $config[ 'order' ] ?? null;

		// additional data
		$prepend		= $config[ 'prepend' ] ?? [];
		$append			= $config[ 'append' ] ?? [];

		// Conditions ----------

		$query->select( [ "$nameColumn as $nameAlias", "$valueColumn as $valueAlias" ] )
			  ->from( $modelTable );

		if( isset( $conditions ) ) {

			foreach( $conditions as $ckey => $condition ) {

				if( is_numeric( $ckey ) ) {

					$query->andWhere( $condition );

					unset( $conditions[ $ckey ] );
				}
			}

			$query->andWhere( $conditions );
		}

		$interfaces = class_implements( static::class );

		if( isset( $interfaces[ 'cmsgears\core\common\services\interfaces\base\IApproval' ] ) ) {

			$statusFilter = $modelClass::STATUS_TERMINATED;

			$query->andWhere( "$modelTable.status<$statusFilter" );
		}

		// Filters -------------

		if( isset( $filters ) ) {

			foreach( $filters as $filter ) {

				$query = $query->andFilterWhere( $filter );
			}
		}

		// Sorting -------------

		if( isset( $order ) ) {

			$query->orderBy( $order );
		}

		// Limit ---------------

		if( $limit > 0 ) {

			$query->limit( $limit );
		}

		// Quering -------------

		// Create command
		$command = $query->createCommand();

		// Execute the command
		$arrayList = $command->queryAll();

		// Result --------------

		// Prepend given list
		if( count( $prepend ) > 0 ) {

			$arrayList = ArrayHelper::merge( $prepend, $arrayList );
		}

		// Append given list
		if( count( $append ) > 0 ) {

			$arrayList = ArrayHelper::merge( $arrayList, $append );
		}

		return $arrayList;
	}
206543
public function getMetaBoxConfig($config, $key = null)
    {
        // allow shorthand
        if (!array_key_exists('fields', $config)) {
            $fields = array();
            foreach ($config as $field) {
                // Arbitrary HTML is allowed
                if (preg_match('/^\</', $field) && preg_match('/\>$/', $field)) {
                    $fields[md5(mt_rand())] = array(
                        'type'=>'html',
                        'label'=>null,
                        'value'=>$field,
                    );
                    continue;
                }

                $fields[$field] = $this->getField($field);
            }
            $config = array('fields'=>$fields);
        }
        if (Arr::iterable($config['fields'])) {
            $fields = array();
            foreach ($config['fields'] as $k => $v) {
                if (is_array($v)) {
                    $fields[$k] = $v;
                } else {
                    $fields[$v] = $this->getField($v);
                }
            }
            $config['fields'] = $fields;
        }

        // defaults
        $config['title']    = (array_key_exists('title', $config)) ? $config['title'] : $this->getMetaBoxTitle($key);
        $config['context']  = (array_key_exists('context', $config)) ? $config['context'] : 'normal';
        $config['priority'] = (array_key_exists('priority', $config)) ? $config['priority'] : 'high';
        return $config;
    }
166839
static public function config($config = array())
    {
        !empty($config) && self::$config = array_merge(self::$config, $config);
        if (!empty(self::$config['cachepath'])) {
            Cache::$cachepath = self::$config['cachepath'];
        }
        if (empty(self::$config['component_verify_ticket'])) {
            self::$config['component_verify_ticket'] = Cache::get('component_verify_ticket');
        }
        if (empty(self::$config['token']) && !empty(self::$config['component_token'])) {
            self::$config['token'] = self::$config['component_token'];
        }
        if (empty(self::$config['appsecret']) && !empty(self::$config['component_appsecret'])) {
            self::$config['appsecret'] = self::$config['component_appsecret'];
        }
        if (empty(self::$config['encodingaeskey']) && !empty(self::$config['component_encodingaeskey'])) {
            self::$config['encodingaeskey'] = self::$config['component_encodingaeskey'];
        }
        return self::$config;
    }
1162523
public function optionlist($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'options'   => array(),
            'name'      => 'id',
            'selected'  => null,
            'disabled'  => null,
            'translate' => false,
            'attribs'   => array('size' => 1),
        ));

        $html = array();

        $html[] = '<select name="'. $config->name .'" '. $this->buildAttributes($config->attribs) .'>';

        foreach($config->options as $group => $options)
        {
            if (is_numeric($group)) {
                $options = array($options);
            } else {
                $html[] = '<optgroup label="' . StringEscaper::attr($group) . '">';
            }

            foreach ($options as $option)
            {
                $value = $option->value;
                $label = $config->translate ? $this->getObject('translator')->translate( $option->label ) : $option->label;

                $extra = '';
                if(isset($option->disabled) && $option->disabled) {
                    $extra .= 'disabled="disabled"';
                }

                if(isset($option->attribs)) {
                    $extra .= ' '.$this->buildAttributes($option->attribs);
                }

                if(!is_null($config->selected))
                {
                    if ($config->selected instanceof ObjectConfig)
                    {
                        foreach ($config->selected as $selected)
                        {
                            $sel = is_object($selected) ? $selected->value : $selected;
                            if ((string) $value == (string) $sel)
                            {
                                $extra .= 'selected="selected"';
                                break;
                            }
                        }
                    }
                    else $extra .= ((string) $value == (string) $config->selected ? ' selected="selected"' : '');
                }

                $html[] = '<option value="'. $value .'" '.$extra.'>' . $label . '</option>';
            }

            if (!is_numeric($group)) {
                $html[] = '</optgroup>';
            }
        }

        $html[] = '</select>';

        return implode(PHP_EOL, $html);
    }
1097158
public function getOptions(array $config)
    {
        $options = array_get($config, 'options', array());

        return array_diff_key($this->options, $options) + $options;
    }
282260
protected function getValues( array $config )
	{
		$values = array(
			'package' => 'Aimeos.Shop',
			'subpackage' => null,
			'absoluteUri' => false,
			'format' => 'html',
		);

		if( isset( $config['package'] ) ) {
			$values['package'] = (string) $config['package'];
		}

		if( isset( $config['subpackage'] ) ) {
			$values['subpackage'] = (string) $config['subpackage'];
		}

		if( isset( $config['absoluteUri'] ) ) {
			$values['absoluteUri'] = (bool) $config['absoluteUri'];
		}

		if( isset( $config['format'] ) ) {
			$values['format'] = (string) $config['format'];
		}

		return $values;
	}
565897
protected function getRecursive(&$config, $names)
    {
        if (empty($names)) {
            return $config;
        }

        $name = array_shift($names);

        if (!isset($config[$name])) {
            return null;
        }

        return $this->getRecursive($config[$name], $names);
    }
1118766
private function getPrefix(Config $config)
    {
        $parts = explode(':', $config->name);
        if ($config->parent && 2 === count($parts)) {
            // nested route that contains 'App:*
            array_shift($parts);
        }

        return strtolower(str_replace(array('/', '\\', ':'), '_', implode('_', $parts)));
    }
363830
protected function checkName(TinyMCEConfig $config)
    {
        $configs = HTMLEditorConfig::get_available_configs_map();
        foreach ($configs as $id => $name) {
            if (HTMLEditorConfig::get($id) === $config) {
                return $id;
            }
        }
        return 'custom';
    }
1358321
protected function parseDescriptorField($config)
    {
        if (is_array($config)) {
            $descriptor = [];
            foreach ($config as $field) {
                if (!empty($this->{$field})) {
                    $descriptor[] = $this->{$field};
                }
            }

            return implode(' ', $descriptor);
        } else {
            return $this->{$config};
        }
    }
702863
private function formatElementName(string $elementName, array $configs): string
    {
        $elementName = ucfirst($elementName);

        if ($configs['convertUnderlines']) {
            $elementName = $this->convertUnderlines($elementName);
        }

        return $elementName;
    }
475063
public function initialize(array $config = [])
    {
        $config = array_merge($this->config, $config);

        if (empty($this->engine)) {
            $this->engine = new \O2System\Parser\String\Engines\Shortcodes($config);
        }

        return $this;
    }
1306412
protected function getDsn(array $config)
    {
        return $this->configHasSocket($config) ? $this->getSocketDsn($config) : $this->getHostDsn($config);
    }