Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
Select version
▼
Ethereum PHP
Ethereum-PHP
Web3 Client
Testing using Ganache Docker
Calling contracts fromm the Browser Console
API development
Todo List
Deprecated List
►
Modules
►
Classes
▼
Files
►
File List
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Modules
Pages
EthD20.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ethereum\DataType
;
4
5
use
Ethereum\DataType\EthQ
;
6
14
class
EthD20
extends
EthD
15
{
28
public
function
validateLength
($val)
29
{
30
$un_padded = $this->
unPadEnsureLength
($val);
31
if
($un_padded) {
32
return
$un_padded;
33
}
else
{
34
throw
new \InvalidArgumentException(
'Invalid length for hex binary: '
. $val);
35
}
36
}
37
50
public
static
function
unPadEnsureLength
($string)
51
{
52
53
// Remove leading zeros.
54
// See: https://regex101.com/r/O2Rpei/5
55
$matches = [];
56
if
(preg_match(
'/^0x0*([0-9,a-f]{40})$/is'
, self::ensureHexPrefix($string), $matches)) {
57
$address
=
'0x'
. $matches[1];
58
// Throws an Exception if not valid.
59
if
(self::isValidAddress(
$address
,
true
)) {
60
return
$address
;
61
}
62
}
63
return
null;
64
}
65
71
public
function
isNotNull
() {
72
$checkForValue =
new
EthQ
($this->value);
73
return
$checkForValue->isNotNull();
74
}
75
79
public
static
function
getDataLengthType
()
80
{
81
return
'static'
;
82
}
83
84
}
Ethereum\DataType\EthD20\unPadEnsureLength
static unPadEnsureLength($string)
Definition:
EthD20.php:50
Ethereum\DataType\EthD20\getDataLengthType
static getDataLengthType()
Definition:
EthD20.php:79
Ethereum\DataType
Definition:
Block.php:11
Ethereum\DataType\EthQ
Definition:
EthQ.php:14
Ethereum\DataType\EthD20
Definition:
EthD20.php:14
$address
$address
Definition:
list-balance-example.php:41
EthQ
Ethereum\DataType\EthD
Definition:
EthD.php:15
Ethereum\DataType\EthD20\validateLength
validateLength($val)
Definition:
EthD20.php:28
Ethereum\DataType\EthD20\isNotNull
isNotNull()
Definition:
EthD20.php:71
src
DataType
EthD20.php
Generated by
1.8.13