@param string $string
@param Config $config

@return string
351291
protected function replaceVars($string, Config $config)
    {
        while (0 < preg_match_all('/\{\{([^\}]+)\}\}/', $string, $matches)) {
            foreach ($matches[0] as $i => $match) {
                $string = str_replace($match, $config->get($matches[1][$i]), $string);
            }
        }

        return $string;
    }
893505
protected function buildConnectionString(array $config): string
    {
        if (isset($config['connection_string'])) {
            return $config['connection_string'];
        }

        $result = 'mongodb://';

        // If username is present, append "<username>:<password>@"
        if (isset($config['username'])) {
            $result .= sprintf(
                '%s:%s@',
                $config['username'],
                $config['password'] ?? ''
            );
        }

        // Append "<hostname>/<database>"
        $result .= sprintf(
            '%s/%s',
            $this->buildHostname($config),
            $config['database'] ?? 'mongolid'
        );

        if (isset($config['cluster']['replica_set'])) {
            $result .= '?replicaSet='.$config['cluster']['replica_set'];
        }

        return $result;
    }
23763
public function setConfig(Config $config)
    {
        $this->config = $this->server->setConfig($config);

        return $this;
    }
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;
    }
687268
public function filter($text, $config = array())
    {
        $context = $this->_chain->getContext();
        $context->data = $text;
        $context->config = $config;
        if ($context->config->filter) {
            $filter = (array) AnConfig::unbox($context->config->filter);
            $filter[] = 'ptag';
            $context->config->filter = $filter;
        }
        $this->_chain->run('filter', $context);

        return $context->data;
    }
368076
public function parseAttributeString($string, $config, $context) {
        $string = (string) $string; // quick typecast

        if ($string == '') return array(); // no attributes

        $e = false;
        if ($config->get('Core.CollectErrors')) {
            $e =& $context->get('ErrorCollector');
        }

        // let's see if we can abort as quickly as possible
        // one equal sign, no spaces => one attribute
        $num_equal = substr_count($string, '=');
        $has_space = strpos($string, ' ');
        if ($num_equal === 0 && !$has_space) {
            // bool attribute
            return array($string => $string);
        } elseif ($num_equal === 1 && !$has_space) {
            // only one attribute
            list($key, $quoted_value) = explode('=', $string);
            $quoted_value = trim($quoted_value);
            if (!$key) {
                if ($e) $e->send(E_ERROR, 'Lexer: Missing attribute key');
                return array();
            }
            if (!$quoted_value) return array($key => '');
            $first_char = @$quoted_value[0];
            $last_char  = @$quoted_value[strlen($quoted_value)-1];

            $same_quote = ($first_char == $last_char);
            $open_quote = ($first_char == '"' || $first_char == "'");

            if ( $same_quote && $open_quote) {
                // well behaved
                $value = substr($quoted_value, 1, strlen($quoted_value) - 2);
            } else {
                // not well behaved
                if ($open_quote) {
                    if ($e) $e->send(E_ERROR, 'Lexer: Missing end quote');
                    $value = substr($quoted_value, 1);
                } else {
                    $value = $quoted_value;
                }
            }
            if ($value === false) $value = '';
            return array($key => $value);
        }

        // setup loop environment
        $array  = array(); // return assoc array of attributes
        $cursor = 0; // current position in string (moves forward)
        $size   = strlen($string); // size of the string (stays the same)

        // if we have unquoted attributes, the parser expects a terminating
        // space, so let's guarantee that there's always a terminating space.
        $string .= ' ';

        while(true) {

            if ($cursor >= $size) {
                break;
            }

            $cursor += ($value = strspn($string, $this->_whitespace, $cursor));
            // grab the key

            $key_begin = $cursor; //we're currently at the start of the key

            // scroll past all characters that are the key (not whitespace or =)
            $cursor += strcspn($string, $this->_whitespace . '=', $cursor);

            $key_end = $cursor; // now at the end of the key

            $key = substr($string, $key_begin, $key_end - $key_begin);

            if (!$key) {
                if ($e) $e->send(E_ERROR, 'Lexer: Missing attribute key');
                $cursor += strcspn($string, $this->_whitespace, $cursor + 1); // prevent infinite loop
                continue; // empty key
            }

            // scroll past all whitespace
            $cursor += strspn($string, $this->_whitespace, $cursor);

            if ($cursor >= $size) {
                $array[$key] = $key;
                break;
            }

            // if the next character is an equal sign, we've got a regular
            // pair, otherwise, it's a bool attribute
            $first_char = @$string[$cursor];

            if ($first_char == '=') {
                // key="value"

                $cursor++;
                $cursor += strspn($string, $this->_whitespace, $cursor);

                if ($cursor === false) {
                    $array[$key] = '';
                    break;
                }

                // we might be in front of a quote right now

                $char = @$string[$cursor];

                if ($char == '"' || $char == "'") {
                    // it's quoted, end bound is $char
                    $cursor++;
                    $value_begin = $cursor;
                    $cursor = strpos($string, $char, $cursor);
                    $value_end = $cursor;
                } else {
                    // it's not quoted, end bound is whitespace
                    $value_begin = $cursor;
                    $cursor += strcspn($string, $this->_whitespace, $cursor);
                    $value_end = $cursor;
                }

                // we reached a premature end
                if ($cursor === false) {
                    $cursor = $size;
                    $value_end = $cursor;
                }

                $value = substr($string, $value_begin, $value_end - $value_begin);
                if ($value === false) $value = '';
                $array[$key] = $this->parseData($value);
                $cursor++;

            } else {
                // boolattr
                if ($key !== '') {
                    $array[$key] = $key;
                } else {
                    // purely theoretical
                    if ($e) $e->send(E_ERROR, 'Lexer: Missing attribute key');
                }

            }
        }
        return $array;
    }
1146640
private Map<String, String> parseconfig(String config) {

        Map<String, String> result = new HashMap<String, String>();
        m_selected = "";
        String[] labels = config.split("\\|");
        for (int i = 0; i < labels.length; i++) {

            if (labels[i].indexOf("*") >= 0) {
                labels[i] = labels[i].replace("*", "");
                m_selected += labels[i] + "|";
            }
            result.put(labels[i], labels[i]);
        }
        m_selected = m_selected.substring(0, m_selected.lastIndexOf("|"));
        return result;
    }
1237154
public function write($path, $contents, array $config = [])
    {
        [$prefix, $path] = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->write($path, $contents, $config);
    }
1124346
public static function get($key, $config = null)
    {
        if ($key === '') {
            throw new \InvalidArgumentException("Key cannot be an empty string");
        }

        if (!is_string($key)) {
            throw new \InvalidArgumentException("Parameter of type string is expected, \"".gettype($key)."\" given");
        }

        self::initConfig();

        $config = ($config === null) ? self::$config : $config;
        try {
            if (self::isComplexKey($key)) {
                $keys = explode('.', $key);
                $childKey = array_shift($keys);
                if (self::has($childKey, $config)) {
                    $config = self::get($childKey, $config);
                    $key = implode(".", $keys);
                } else {
                    throw new ConfigNotFoundException("Config key \"{$key}\" was not found in config");
                }
            }

            if (!self::has($key, $config)) {
                throw new ConfigNotFoundException("Config key \"{$key}\" was not found in config");
            }

            return $config[$key];
        } catch (ConfigNotFoundException $e) {
            return array();
        }
    }
189439
public static function get($key,$config)
    {
        static::initRedis();
        /**
         * 确定key
         */
        static::$key = $key;
        if(is_array($key) && count($key) == 2){
            static::$group = $key[0];
            static::$key = $key[1];
        }
        static::$md5key =  md5(static::$key );
        $returnData = unserialize(static::$Redis->get('cache_'.static::$typeCache.'_'.static::$group.'_'.static::$md5key));
        static::staticEmpty();
        return $returnData;

    }
299718
public function generate(Config $config)
    {
        $parts = array();
        if ($config->parent) {
            $parts[] = str_replace(
                array('{id}', '.{_format}'),
                array(sprintf('{%sId}', $this->getPrefix($config->parent)), ''),
                $this->generate($config->parent)
            );
        }
        $parts[] = $this->getPrefix($config);

        $prefix = implode('/', array_filter($parts));
        $pattern = $this->getPattern($config);

        if (isset($pattern[0]) && '/' !== $pattern[0] && '.' !== $pattern[0]) {
            return rtrim($prefix, '/').'/'.$pattern;
        }

        return $prefix.$pattern;
    }
816044
protected function getOptionsFromConfig(Config $config)
    {
        $options = $this->options;
        foreach (static::$mappingOptions as $option => $ossOption) {
            if (! $config->has($option)) {
                continue;
            }
            $options[$ossOption] = $config->get($option);
        }

        return $options;
    }
193351
public static function getInstance(Configuration $config = null)
    {
        if (!self::$instance) {
            self::$instance = new self($config);
        }

        return self::$instance;
    }
1090951
protected function parseConfig($config)
    {
        $parsed = [];

        foreach ($config as $key=>$value) {
            if ($value instanceof XType) {
                $parsed[$key] = $value;
                continue;
            }
            $parsed[$key] = $this->stringToType($value);
        }

        return $parsed;
    }
1281863
private function prepareUploadConfig(Config $config)
    {
        $options = [];

        if (isset($this->config['encrypt']) && $this->config['encrypt']) {
            $options['params']['ServerSideEncryption'] = 'AES256';
        }

        if ($config->has('params')) {
            $options['params'] = $config->get('params');
        }

        if ($config->has('visibility')) {
            $options['params']['ACL'] = $this->normalizeVisibility($config->get('visibility'));
        }

        return $options;
    }
196529
public static function get(string $config)
  {
    $conf = explode('.', $config);
    $path = DEPConfig::$appdir . 'config' . DIRECTORY_SEPARATOR . $conf[0] . '.php';

    $service = require $path;
    unset($conf[0]);

    foreach($conf as $setting) {
      if (isset($service[$setting])) {
        $service = $service[$setting];
      } else {
        return null;
      }
    }

    return $service;
  }
590650
public function makeHTMLInputString($config)
    {
        $custom = $this->getCustom($config);
        $multiple = $this->isMultiple($config, 'multiple');
        $multipleArray = $this->isMultiple($config, '[]');
        $floatingNumber = $this->getFloatingNumber($config);
        $population = $this->getPopulation($config);

        if (is_array($config['objectValue']) && $config['type'] === 'file') {
            $population = '';
        }

        $inputString = '<input '.$this->processCustom($custom).' id="'.$this->getId($config).'" class="'.$config['class'].'" type="'.$config['type'].'" name="'.$config['name'].$multipleArray.'" '.$floatingNumber.' '.$multiple.' '.$population.' placeholder="'.$config['placeholder'].'">';

        return $inputString;
    }