Retorna o valor do cookie.
O valor será retornado usando "percent-encode".

@param       bool $urldecoded
Indica se o valor retornado deve ser convertido
para o formato "natural", sem "percent-encode".

@return      string
160524
public function getValue(bool $urldecoded = true) : string
    {
        return (($urldecoded === true) ? rawurldecode($this->value) : $this->value);
    }
379127
public static String urlDecode(String value, String enc) {
        return urlDecode(value, enc, false);
    }
637677
public function encode($aValue)
    {
        $encoded = '';
        $vlq = $this->toVLQSigned($aValue);

        do {
            $digit = $vlq & $this->mask;
            $vlq = $this->zeroFill($vlq, $this->shift);

            if ($vlq > 0) {
                $digit |= $this->continuationBit;
            }

            $encoded .= $this->base64Encode($digit);
        } while ($vlq > 0);

        return $encoded;
    }
87240
public function encrypt(string $decrypted): string {
        $status = openssl_public_encrypt($decrypted, $encrypted, $this);
        if(!$status) {
            throw new RuntimeException('Encrypt failed');
        }
        return $encrypted;
    }
467765
public static function decode($uri, $dotMode = true)
    {
        if (0 === strpos($uri, 'http')) {
            //return base64_decode($uri);
            if ($dotMode) {
                //$returnValue = urldecode(str_replace('__', '.', $uri));
                //$returnValue = str_replace('w_org', 'w3.org', $returnValue);
                $returnValue = str_replace(['_0_', '_1_', '_2_', '_3_', '_4_'], ['.', '/', '://', '#', ':'], $uri);
            } else {
                $returnValue = str_replace(['_1_', '_2_', '_3_', '_4_'], ['/', '://', '#', ':'], $uri);
            }
        } else {
            $returnValue = $uri;
        }


        return (string)$returnValue;
    }
193916
public function getUid(): string
	{
		$uid = $this->request->getCookie(self::TRACKING_COOKIE);
		if (empty($uid)) {
			$charList = 'a-f0-9';
			$uid = Random::generate(8, $charList);
			$uid .= "-" . Random::generate(4, $charList);
			$uid .= "-5" . Random::generate(3, $charList);
			$uid .= "-" . Random::generate(4, $charList);
			$uid .= "-" . Random::generate(12, $charList);

			$this->response->setCookie(self::TRACKING_COOKIE, $uid, self::TRACKING_EXPIRE);
		}
		return $uid;
	}
457075
protected function decodePunycode($encoded)
    {
        $prefix = 'xn--';
        $safe_char = 0xFFFC;
        $base = 36;
        $tmin = 1;
        $tmax = 26;
        $skew = 38;
        $damp = 700;

        if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) {
            return $encoded;
        }

        $is_first = true;
        $bias = 72;
        $idx = 0;
        $char = 0x80;
        $decoded = array();
        $output = '';

        $delim_pos = strrpos($encoded, '-');
        if ($delim_pos > strlen($prefix)) {
            for ($k = strlen($prefix); $k < $delim_pos; ++$k) {
                $decoded[] = ord($encoded{$k});
            }
        }
        $deco_len = count($decoded);
        $enco_len = strlen($encoded);

        for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
            for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) {
                $cp = ord($encoded{$enco_idx++});
                $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base));
                $idx += $digit * $w;
                $t = ($k <= $bias) ? $tmin : (($k >= $bias + $tmax) ? $tmax : ($k - $bias));
                if ($digit < $t) {
                    break;
                }
                $w = (int)($w * ($base - $t));
            }
            $delta = $idx - $old_idx;
            $delta = intval($is_first ? ($delta / $damp) : ($delta / 2));
            $delta += intval($delta / ($deco_len + 1));
            for ($k = 0; $delta > (($base - $tmin) * $tmax) / 2; $k += $base) {
                $delta = intval($delta / ($base - $tmin));
            }
            $bias = intval($k + ($base - $tmin + 1) * $delta / ($delta + $skew));
            $is_first = false;
            $char += (int)($idx / ($deco_len + 1));
            $idx %= ($deco_len + 1);
            if ($deco_len > 0) {
                for ($i = $deco_len; $i > $idx; $i--) {
                    $decoded[$i] = $decoded[($i - 1)];
                }
            }
            $decoded[$idx++] = $char;
        }

        foreach ($decoded as $k => $v) {
            if ($v < 128) {
                $output .= chr($v);
            } // 7bit are transferred literally
            elseif ($v < (1 << 11)) {
                $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
            } // 2 bytes
            elseif ($v < (1 << 16)) {
                $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
            } // 3 bytes
            elseif ($v < (1 << 21)) {
                $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
            } // 4 bytes
            else {
                $output .= $safe_char;
            } //  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
        }
        return $output;
    }
87801
protected String urlDecode(String token) {
    try {
      return URLDecoder.decode(token, "utf-8");
    }
    catch (UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
  }
119532
public static function base64Encode($data, $url = false)
    {
        if ($url) {
            return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
        } else {
            return base64_encode($data);
        }
    }
1009959
public function toString($encode = false) {
        $query = http_build_query($this->query, '', '&', PHP_QUERY_RFC3986);

        if ( ! $encode) {
            return rawurldecode($query);
        }

        return $query;
    }
706327
public static function encode($aValue)
    {
        $encoded = "";

        $vlq = self::toVLQSigned($aValue);

        do {
            $digit = $vlq & self::$MASK;
            $vlq = self::zeroFill($vlq, self::$SHIFT);
            if ($vlq > 0) {
                $digit |= self::$CONTINUATION_BIT;
            }
            $encoded .= self::base64Encode($digit);
        } while ($vlq > 0);

        return $encoded;
    }
1285544
public function encrypt(string $decrypted): string {
        $status = openssl_private_encrypt($decrypted, $encrypted, $this);
        if(!$status) {
            throw new RuntimeException('Encrypt failed');
        }
        return $encrypted;
    }
518335
public static function fromString($cookie, $decode = false)
    {
        $data = array(
            'expires' => 0,
            'path' => '/',
            'domain' => null,
            'secure' => false,
            'httponly' => true,
            'raw' => !$decode,
            'samesite' => null,
        );
        foreach (explode(';', $cookie) as $part) {
            if (false === strpos($part, '=')) {
                $key = trim($part);
                $value = true;
            } else {
                list($key, $value) = explode('=', trim($part), 2);
                $key = trim($key);
                $value = trim($value);
            }
            if (!isset($data['name'])) {
                $data['name'] = $decode ? urldecode($key) : $key;
                $data['value'] = true === $value ? null : ($decode ? urldecode($value) : $value);
                continue;
            }
            switch ($key = strtolower($key)) {
            case 'name':
            case 'value':
                break;
            case 'max-age':
                $data['expires'] = time() + (int) $value;
                break;
            default:
                $data[$key] = $value;
                break;
            }
        }

        return new static($data['name'], $data['value'], $data['expires'], $data['path'], $data['domain'], $data['secure'], $data['httponly'], $data['raw'], $data['samesite']);
    }
5677
private static String URLDecode(String text) {
        String result = null;
        try {
            result = URLDecoder.decode(text, "UTF8");
        } catch (UnsupportedEncodingException e) {
            // Should never happen - all JDKs must support UTF8
            FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsMessageFactoryImpl.URLDecode", "293");
        }
        return result;
    }
985428
public static String urlDecode(final String part) {
		try {
			return URLDecoder.decode(part, DEFAULT_URL_ENCODING);
		} catch (UnsupportedEncodingException e) {
			throw new ImpossibleException(e);
		}
	}
508564
public static String urlDecode(String content, Charset charset, TestContext context) {
        return new UrlDecodeFunction().execute(Arrays.asList(content, charset.displayName()), context);
    }
1018565
private function _getCnonce()
    {
        // TODO: I reused the nonce function from the DigestMD5 class.
        // I should probably make this a protected function in Common.
        if (@file_exists('/dev/urandom') && $fd = @fopen('/dev/urandom', 'r')) {
            return base64_encode(fread($fd, 32));

        } elseif (@file_exists('/dev/random') && $fd = @fopen('/dev/random', 'r')) {
            return base64_encode(fread($fd, 32));

        } else {
            $str = '';
            for ($i=0; $i<32; $i++) {
                $str .= chr(mt_rand(0, 255));
            }

            return base64_encode($str);
        }
    }