27 private const SCHEMA_MAP = [
43 'Q|T' =>
'EthBlockParam',
45 'Array|DATA' =>
'EthBytes',
49 'B|EthSyncing' =>
'EthB',
52 'DATA|Transaction' =>
'Transaction',
53 'FilterChange' =>
'FilterChange' 62 private const ABI_MAP = [
66 'address' =>
'EthD20',
81 'bytes' =>
'EthBytes',
99 'bytes10' =>
'EthD32',
100 'bytes11' =>
'EthD32',
101 'bytes12' =>
'EthD32',
102 'bytes13' =>
'EthD32',
103 'bytes14' =>
'EthD32',
104 'bytes15' =>
'EthD32',
105 'bytes16' =>
'EthD32',
106 'bytes17' =>
'EthD32',
107 'bytes18' =>
'EthD32',
108 'bytes19' =>
'EthD32',
109 'bytes20' =>
'EthD20',
110 'bytes21' =>
'EthD32',
111 'bytes22' =>
'EthD32',
112 'bytes23' =>
'EthD32',
113 'bytes24' =>
'EthD32',
114 'bytes25' =>
'EthD32',
115 'bytes26' =>
'EthD32',
116 'bytes27' =>
'EthD32',
117 'bytes28' =>
'EthD32',
118 'bytes29' =>
'EthD32',
119 'bytes30' =>
'EthD32',
120 'bytes31' =>
'EthD32',
121 'bytes32' =>
'EthD32',
191 $val = strtolower($val);
192 if (method_exists($this,
'validateLength')) {
193 $val = call_user_func([$this,
'validateLength'], $val);
199 throw new \InvalidArgumentException(
'Can not decode hex binary: ' . $val);
222 if (!ctype_xdigit(substr($val, 2))) {
223 throw new \InvalidArgumentException(
'A non well formed hex value encountered: ' . $val);
238 return [
'EthD',
'EthD20',
'EthD32',
'EthQ',
'EthB',
'EthS'];
263 $map = self::SCHEMA_MAP;
264 if (isset($map[$type])) {
285 $schema_type = array_search($class_name, self::SCHEMA_MAP);
286 if (is_string($schema_type)) {
290 throw new \Exception(
'Could not determine data type.');
304 $class_name = get_called_class();
305 if (substr($class_name, 0, strlen(__NAMESPACE__)) === __NAMESPACE__) {
307 $class_name = substr(get_called_class(), strlen(__NAMESPACE__) + 1);
309 return self::reverseTypeMap($class_name);
327 $class =
'\Ethereum\\DataType\\' . $this->
typeMap($type);
328 $obj =
new $class($this->
hexVal());
343 'value' => get_class(),
356 'value' => $this->value,
391 return substr($this->value, 2);
const const __construct($val, array $params=[])
validate($val, array $params)
static ensureHexPrefix($str)
static reverseTypeMap($class_name)
static typeMap(string $type)
setValue($val, array $params=[])
static convertByAbi(string $abiType, EthD $value)
static getPrimitiveTypes()