Repair a string using an optionally provided configuration file

@param string $data
@param mixed $config
@param string $encoding
@param string $data
@param mixed $config
@param string $encoding

@return string Returns the repaired string.
329696
public function repairString($data, $config = NULL, $encoding = NULL, $data, $config = NULL, $encoding = NULL)
    {
    }
657958
private function parseJsonString($data)
    {
        try {
            return json_decode($data, true);
        } catch (Exception $e) {
            throw new ConfigException($e->getMessage());
        }
    }
595057
public static function changeEncode($data, $in_charset = 'GBK', $out_charset = 'UTF-8')
    {
        if (\is_array($data)) {

            foreach ($data as $key => $value) {
                $data[$key] = self::changeEncode($value, $in_charset, $out_charset);
            }

            return $data;
        }

        if (\function_exists('mb_convert_encoding')) {
            return mb_convert_encoding($data, $out_charset, $in_charset);
        }

        return iconv($in_charset, $out_charset . '/' . '/IGNORE', $data);
    }
438112
public function process(array $data, array $config)
	{
		// Merge default or built-in configurations.
		$config = array_merge($this->config, $config);

		// Intersect the data given the with the data keys provided.
		$data = array_intersect_key($data, array_flip(array_keys($config)));

		// Validate and set our errors if they exist.
		$payload = $this->validator->validate($data, $config);

		// Return sanitized data if no validation errors exist.
		if( ! $payload->isStatus(Payload::STATUS_VALID))
		{
			return $payload;
		}

		// Grab payload data for more modification.
		$data = $payload->getData();

		if(array_key_exists(CrudRepository::PAGE_KEY, $data) && array_key_exists(CrudRepository::PER_KEY, $data))
		{
			$data[CrudRepository::PAGINATION_KEY] = [$data[CrudRepository::PAGE_KEY] => $data[CrudRepository::PER_KEY]];
		}

		if(array_key_exists(CrudRepository::FILTER_KEY, $data))
		{
			$data[CrudRepository::FILTER_KEY] = $data[CrudRepository::FILTER_KEY];
		}

		if(array_key_exists(CrudRepository::ORDER_KEY, $data))
		{
			$data[CrudRepository::ORDER_KEY] = $data[CrudRepository::ORDER_KEY];
		}

		if(array_key_exists(CrudRepository::EMBED_KEY, $data))
		{
			$data[CrudRepository::EMBED_KEY] = $data[CrudRepository::EMBED_KEY];
		}

		return new Payload($data, Payload::STATUS_VALID);
	}
1050694
protected function configureEncoding(array $config)
	{
		if( isset($config['charset']))
		{
			$this->pdo->prepare(
				"set names '{$config['charset']}'".$this->getCollation($config)
			)->execute();
		}
	}
1334668
protected function cacheData($key, $data, $config = [])
    {
        $cache = Container::get('cache');

        if (isset($config['tag'])) {
            $cache->tag($config['tag'])->set($key, $data, $config['expire']);
        } else {
            $cache->set($key, $data, $config['expire']);
        }
    }
813594
private function encodeString($data = null)
    {
        $data = is_null($data) ? $this->data : $data;
        return sprintf("%d:%s", strlen($data), $data);
    }
1127338
public static function fromConfig(array $config, string $language): Translator {
        $translations = (new Processor())->
            processConfiguration(new TranslatorConfiguration(), [$config]);

        return new static($translations, $language);
    }
1331917
public static function CaseCompare ($string1, $string2, $encoding = Encoding::DEFAULT_ENCODING) {
		return strcasecmp(Encoding::Adjust($string1, $encoding), Encoding::Adjust($string2, $encoding));
	}
585701
public function setInput($data, $encoding = '')
    {
        $this->_input    = $data;
        $this->_encoding = $encoding;
        $this->reset();
    }
380974
public static function setEncoding($encoding) {

		if(false === is_string($encoding) || 0 === strlen($encoding)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($encoding)), E_USER_ERROR);
		}

		$encoding = strtolower($encoding);

		if(false === in_array($encoding, static :: $encodings)) {
			return trigger_error(sprintf('Argument 1 passed to %s() is not a supported encoding. Provide an encoding supported by htmlspecialchars()', __METHOD__), E_USER_ERROR);
		}

		static :: $encoding = $encoding;
	}
1326273
public static function convertToUtf8($data, $encoding) {
    if (function_exists('iconv')) {
      return @iconv($encoding, 'utf-8', $data);
    }
    elseif (function_exists('mb_convert_encoding')) {
      return @mb_convert_encoding($data, 'utf-8', $encoding);
    }
    elseif (function_exists('recode_string')) {
      return @recode_string($encoding . '..utf-8', $data);
    }
    // Cannot convert.
    return FALSE;
  }
415072
private function parseIniString($data)
    {
        $config = $this->arr();
        $data = parse_ini_string($data, true);
        foreach ($data as $section => $value) {
            $config = $config->mergeRecursive($this->processValue($section, $value));
        }

        return $config;
    }
1370732
public static function strIreplace($search, $replace, $str, $count = null, $encoding = null)
    {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        if (!is_array($search)) {
            $slen = strlen($search);

            if ($slen == 0) {
                return $str;
            }

            $lendif = strlen($replace) - strlen($search);
            $search = static::strtolower($search, $encoding);
            $search = preg_quote($search, '/');
            $lstr = static::strtolower($str, $encoding);
            $i = 0;
            $matched = 0;

            while (preg_match('/(.*)' . $search . '/Us', $lstr, $matches)) {
                if ($count !== null && $i === $count) {
                    break;
                }

                $mlen = strlen($matches[0]);
                $lstr = substr($lstr, $mlen);

                $str = substr_replace($str, $replace, $matched + strlen($matches[1]), $slen);
                $matched += $mlen + $lendif;
                $i++;
            }

            return $str;
        } else {
            $keys = array_keys($search);

            foreach ($keys as $k) {
                if (is_array($replace)) {
                    if (array_key_exists($k, $replace)) {
                        $str = static::strIreplace($search[$k], $replace[$k], $str, $count, $encoding);
                    } else {
                        $str = static::strIreplace($search[$k], '', $str, $count, $encoding);
                    }
                } else {
                    $str = static::strIreplace($search[$k], $replace, $str, $count, $encoding);
                }
            }

            return $str;
        }
    }
1320225
public static function toXml($data, $encoding = 'UTF-8')
    {
        header('Content-Type: text/xml');
        $xml = '<?xml version="1.0" encoding="' . $encoding . "\"?>\n";
        return $xml .= self::_to_xml_body($data);
    }
752162
public function escapeHtml($string, $encoding = 'utf-8') {
		
		$current = Escape :: getEncoding();
		Escape :: setEncoding($encoding);
		$result =  Escape :: html($string);
		Escape :: setEncoding($current);

		return $result;
	}
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;
    }