-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
125 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of web3.php package. | ||
* | ||
* (c) Kuan-Cheng,Lai <[email protected]> | ||
* | ||
* @author Peter Lai <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
||
namespace Web3\Methods\Eth; | ||
|
||
use InvalidArgumentException; | ||
use Web3\Methods\EthMethod; | ||
use Web3\Validators\TagValidator; | ||
use Web3\Validators\QuantityValidator; | ||
use Web3\Validators\ArrayNumberValidator; | ||
use Web3\Formatters\QuantityFormatter; | ||
use Web3\Formatters\OptionalQuantityFormatter; | ||
|
||
class FeeHistory extends EthMethod | ||
{ | ||
/** | ||
* validators | ||
* | ||
* @var array | ||
*/ | ||
protected $validators = [ | ||
QuantityValidator::class, [ | ||
TagValidator::class, QuantityValidator::class | ||
], ArrayNumberValidator::class | ||
]; | ||
|
||
/** | ||
* inputFormatters | ||
* | ||
* @var array | ||
*/ | ||
protected $inputFormatters = [ | ||
QuantityFormatter::class, OptionalQuantityFormatter::class | ||
]; | ||
|
||
/** | ||
* outputFormatters | ||
* | ||
* @var array | ||
*/ | ||
protected $outputFormatters = [ | ||
]; | ||
|
||
/** | ||
* defaultValues | ||
* | ||
* @var array | ||
*/ | ||
protected $defaultValues = []; | ||
|
||
/** | ||
* construct | ||
* | ||
* @param string $method | ||
* @param array $arguments | ||
* @return void | ||
*/ | ||
// public function __construct($method='', $arguments=[]) | ||
// { | ||
// parent::__construct($method, $arguments); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of web3.php package. | ||
* | ||
* (c) Kuan-Cheng,Lai <[email protected]> | ||
* | ||
* @author Peter Lai <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
||
namespace Web3\Validators; | ||
|
||
use Web3\Validators\IValidator; | ||
|
||
class ArrayNumberValidator | ||
{ | ||
/** | ||
* validate | ||
* TODO: add min & max validation | ||
* | ||
* @param array[int|float] $value | ||
* @return bool | ||
*/ | ||
public static function validate($value) | ||
{ | ||
if (!is_array($value)) { | ||
return false; | ||
} | ||
foreach ($value as $val) { | ||
if (!(is_int($val) || is_float($val))) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters