diff --git a/src/Methods/Net/Listening.php b/src/Methods/Net/Listening.php index 94139f3..2e9945c 100644 --- a/src/Methods/Net/Listening.php +++ b/src/Methods/Net/Listening.php @@ -12,10 +12,9 @@ namespace Web3\Methods\Net; use InvalidArgumentException; -use Web3\Methods\IMethod; -use Web3\Methods\JSONRPC; +use Web3\Methods\EthMethod; -class Listening extends JSONRPC implements IMethod +class Listening extends EthMethod { /** * inputFormatters @@ -31,6 +30,13 @@ class Listening extends JSONRPC implements IMethod */ protected $outputFormatters = []; + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + /** * construct * @@ -42,47 +48,4 @@ class Listening extends JSONRPC implements IMethod // { // parent::__construct($method, $arguments); // } - - /** - * getInputFormatters - * - * @return array - */ - public function getInputFormatters() - { - return $this->inputFormatters; - } - - /** - * getOutputFormatters - * - * @return array - */ - public function getOutputFormatters() - { - return $this->outputFormatters; - } - - /** - * transform - * - * @param array $params - * @param array $rules - * @return array - */ - public function transform($params, $rules) - { - if (!is_array($params)) { - throw new InvalidArgumentException('Please use array params when call transform.'); - } - if (!is_array($rules)) { - throw new InvalidArgumentException('Please use array rules when call transform.'); - } - foreach ($params as $key => $param) { - if (isset($rules[$key])) { - $params[$key] = call_user_func([$rules[$key], 'format'], $param); - } - } - return $params; - } } \ No newline at end of file diff --git a/src/Methods/Net/PeerCount.php b/src/Methods/Net/PeerCount.php index b638dd5..1983dfe 100644 --- a/src/Methods/Net/PeerCount.php +++ b/src/Methods/Net/PeerCount.php @@ -12,11 +12,10 @@ namespace Web3\Methods\Net; use InvalidArgumentException; -use Web3\Methods\IMethod; -use Web3\Methods\JSONRPC; +use Web3\Methods\EthMethod; use Web3\Formatters\BigNumberFormatter; -class PeerCount extends JSONRPC implements IMethod +class PeerCount extends EthMethod { /** * inputFormatters @@ -34,6 +33,13 @@ class PeerCount extends JSONRPC implements IMethod BigNumberFormatter::class ]; + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + /** * construct * @@ -45,47 +51,4 @@ class PeerCount extends JSONRPC implements IMethod // { // parent::__construct($method, $arguments); // } - - /** - * getInputFormatters - * - * @return array - */ - public function getInputFormatters() - { - return $this->inputFormatters; - } - - /** - * getOutputFormatters - * - * @return array - */ - public function getOutputFormatters() - { - return $this->outputFormatters; - } - - /** - * transform - * - * @param array $params - * @param array $rules - * @return array - */ - public function transform($params, $rules) - { - if (!is_array($params)) { - throw new InvalidArgumentException('Please use array params when call transform.'); - } - if (!is_array($rules)) { - throw new InvalidArgumentException('Please use array rules when call transform.'); - } - foreach ($params as $key => $param) { - if (isset($rules[$key])) { - $params[$key] = call_user_func([$rules[$key], 'format'], $param); - } - } - return $params; - } } \ No newline at end of file diff --git a/src/Methods/Net/Version.php b/src/Methods/Net/Version.php index 9abc5ae..cf34149 100644 --- a/src/Methods/Net/Version.php +++ b/src/Methods/Net/Version.php @@ -12,10 +12,9 @@ namespace Web3\Methods\Net; use InvalidArgumentException; -use Web3\Methods\IMethod; -use Web3\Methods\JSONRPC; +use Web3\Methods\EthMethod; -class Version extends JSONRPC implements IMethod +class Version extends EthMethod { /** * inputFormatters @@ -31,6 +30,13 @@ class Version extends JSONRPC implements IMethod */ protected $outputFormatters = []; + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + /** * construct * @@ -42,47 +48,4 @@ class Version extends JSONRPC implements IMethod // { // parent::__construct($method, $arguments); // } - - /** - * getInputFormatters - * - * @return array - */ - public function getInputFormatters() - { - return $this->inputFormatters; - } - - /** - * getOutputFormatters - * - * @return array - */ - public function getOutputFormatters() - { - return $this->outputFormatters; - } - - /** - * transform - * - * @param array $params - * @param array $rules - * @return array - */ - public function transform($params, $rules) - { - if (!is_array($params)) { - throw new InvalidArgumentException('Please use array params when call transform.'); - } - if (!is_array($rules)) { - throw new InvalidArgumentException('Please use array rules when call transform.'); - } - foreach ($params as $key => $param) { - if (isset($rules[$key])) { - $params[$key] = call_user_func([$rules[$key], 'format'], $param); - } - } - return $params; - } } \ No newline at end of file