数组对象Emoji反解析处理
@param array $data
@return array
540251
public static function buildDeEmojiData(array $data)
    {
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $data[$key] = self::buildDeEmojiData($value);
            } elseif (is_string($value)) {
                $data[$key] = self::emojiDecode($value);
            } else {
                $data[$key] = $value;
            }
        }
        return $data;
    }
578741
protected function _unserialize($data)
	{
		$data = @unserialize(stripslashes($data));

		if (is_array($data))
		{
			foreach ($data as $key => $val)
			{
				if (is_string($val))
				{
					$data[$key] = str_replace('{{slash}}', '\\', $val);
				}
			}

			return $data;
		}

		return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data;
	}
303380
protected function parseSet($data) {
        foreach ($data as $key=>$val){
            if(is_array($val) && 'exp' == $val[0]){
                $set[]  =   $this->parseKey($key).'='.$val[1];
            }elseif(is_null($val)){
                $set[]  =   $this->parseKey($key).'=NULL';
            }elseif(is_scalar($val)) {// 过滤非标量数据
                if(0===strpos($val,':') && in_array($val,array_keys($this->bind)) ){
                    $set[]  =   $this->parseKey($key).'='.$this->escapeString($val);
                }else{
                    $name   =   count($this->bind);
                    $set[]  =   $this->parseKey($key).'=:'.$name;
                    $this->bindParam($name,$val);
                }
            }
        }
        return ' SET '.implode(',',$set);
    }
1236522
final protected function sanitize($data)
    {
        // Recursively loop through the data array and return the sanitized data
        $sanitized = [];
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                $sanitized[$key] = $this->sanitize($value);
            }
        } else {
            $sanitized = trim(strip_tags($data));
        }
        return $sanitized;
    }
292090
public static function utf8Encode($data) {
		if (is_string($data)) {
			return utf8_encode($data);

		} else if (is_array($data)) {
			foreach ($data as $key => $value) {
				$data[utf8_encode($key)] = self::utf8Encode($value);
			}

		} else if (is_object($data)) {
			foreach ($data as $key => $value) {
				$data->{$key} = self::utf8Encode($value);
			}
		}

		return $data;
	}
1158680
public function massSendAll(array $data)
    {
        $url = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
97786
private function parseMark(array $data): MarkInterface
    {
        switch ($data['type']) {
            case Mark\Bold::getType():
                return new Mark\Bold();
            case Mark\Code::getType():
                return new Mark\Code();
            case Mark\Italic::getType():
                return new Mark\Italic();
            case Mark\Underline::getType():
                return new Mark\Underline();
            default:
                throw new \InvalidArgumentException(\sprintf(
                    'Unrecognized mark type "%s" when trying to parse rich text.',
                    $data['type']
                ));
        }
    }
1352219
public function encodeArray($data) {
        $d = array();
        foreach ($data as $key => $value) {
            if (is_string($key))
                $key = htmlspecialchars($key);
            if (is_string($value))
                $value = htmlspecialchars($value);
            elseif (is_array($value))
                $value = self::encodeArray($value);
            $d[$key] = $value;
        }
        return $d;
    }
605309
private function normalizeData($data)
    {
        $normalizedData = [];

        foreach ($data as $key => $value) {
            if ('#text' === $key) {
                $key = 'direction';
            }

            $normalizedData[trim($key, '_')] = $value;
        }

        return $normalizedData;
    }
636768
private function generateSignature($data)
    {
        return base64_encode(
            hash_hmac('sha512',
                $this->getMerchantId() . $data . $this->getMerchantId(),
                $this->getPrivateKey())
        );
    }
1053129
protected function _normalizeResult(array $data): array
    {
        $result = [];
        for ($i = 0; $i < $data['count']; $i++) {
            $item = $data[$i];

            // construct label
            preg_match('/^.*?,OU=(.*?),/i', $item['dn'], $match);
            $label = !empty($match[1]) ? $match[1] . ' / ' . $item['cn'][0] : $item['cn'][0];

            $result[$item['dn']] = $label;
        }

        asort($result);

        return $result;
    }
1258033
public function decode($data)
    {
        try {
            return Yaml::parse($data);
        }
        catch (ParseException $e) {
            printf("Unable to parse the YAML string: %s", $e->getMessage());
            return [];
        }
    }
1108137
protected function xss($data)
    {
        if (is_array($data))
        {
            return filter_var_array($data, FILTER_SANITIZE_STRING);
        }

        return filter_var($data, FILTER_SANITIZE_STRING);
    }
1073650
protected function _format(array $data) {
		foreach (['id', 'rev'] as $key) {
			if (isset($data["_{$key}"])) {
				$data[$key] = $data["_{$key}"];
				unset($data["_{$key}"]);
			}
		}
		return $data;
	}
613870
protected function encode(array $data)
    {

        foreach ($data as $key => $value) {
            if (is_string($value)) {
                $data[$key] = base64_encode($value);
            }
        }

        return $data;
    }
562020
private function format($data)
    {
        $_data = [];
        foreach ($data as $fields => $value) {
            $fields = array_map('trim', explode(',', $fields)); //拆分多个字段一个值，形如['field1,field2'=>value]
            foreach ($fields as $field) {
                $_data[$field] = $value;
            }
        }
        return $_data;
    }
1312383
protected function _url($data)
  {
    if (is_array($data)) {
      return array_map([
        $this,
        '_url'
      ], $data);
    } elseif (is_scalar($data)) {
      return str_replace([
        '+',
        '!',
        '*',
        "'",
        '(',
        ')'
      ], [
        ' ',
        '%21',
        '%2A',
        '%27',
        '%28',
        '%29'
      ], rawurlencode($data));
    }
    return '';
  }