35 if (is_string((
string)$return) && $this->checkUtf8($return)) {
39 throw new \InvalidArgumentException(
'Can not decode value: ' . $val);
52 return new EthS(self::ensureHexPrefix($rlpItem[0]->
get()));
102 private function checkUtf8($str)
104 if (preg_match(
'%^(?: 105 [\x09\x0A\x0D\x20-\x7E] # ASCII 106 | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte 107 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs 108 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte 109 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates 110 | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 111 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 112 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 130 $hex = unpack(
'H*', $string);
131 return array_shift($hex);
149 return pack(
'H*', self::removeHexPrefix($string));
static cretateFromRLP($hexVal)
static ensureHexPrefix($str)
validate($val, array $params)
static decode(string $hexVal)
static hasHexPrefix($str)
static encode(string $val)