From 39c982a96db54967093892d0dda7abfaa21202e9 Mon Sep 17 00:00:00 2001 From: axios Date: Mon, 10 Jun 2019 09:55:13 +0800 Subject: [PATCH] get&set func change; supported special param name --- library/core/lib/Request.php | 11 ----------- library/core/lib/RoaRequest.php | 13 +++++++++++++ library/core/lib/RpcRequest.php | 13 +++++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/library/core/lib/Request.php b/library/core/lib/Request.php index 05012c5..eedf1fe 100644 --- a/library/core/lib/Request.php +++ b/library/core/lib/Request.php @@ -200,15 +200,4 @@ protected function property($property, $value = null) } return $this->$property; } - - public function __call($name, $arguments) - { - if (false !== strpos($name, "get")) { - $name = str_replace("get", "", $name); - return $this->params($name); - } - $name = str_replace("set", "", $name); - $this->params($name, $arguments[0]); - return $this; - } } \ No newline at end of file diff --git a/library/core/lib/RoaRequest.php b/library/core/lib/RoaRequest.php index 2b58ecb..f1cfd91 100644 --- a/library/core/lib/RoaRequest.php +++ b/library/core/lib/RoaRequest.php @@ -33,4 +33,17 @@ public function region($region = null) $this->params("region-id", Aliyun::region()); return parent::region($region); } + + public function __call($name, $arguments) + { + if (false !== strpos($name, "get")) { + $name = str_replace("get", "", $name); + $name = str_replace("_", "-", $name); + return $this->params($name); + } + $name = str_replace("set", "", $name); + $name = str_replace("_", "-", $name); + $this->params($name, $arguments[0]); + return $this; + } } \ No newline at end of file diff --git a/library/core/lib/RpcRequest.php b/library/core/lib/RpcRequest.php index 92f8e6c..a6f37d7 100644 --- a/library/core/lib/RpcRequest.php +++ b/library/core/lib/RpcRequest.php @@ -17,4 +17,17 @@ public function __construct() { $this->region = Aliyun::region(); } + + public function __call($name, $arguments) + { + if (false !== strpos($name, "get")) { + $name = str_replace("get", "", $name); + $name = str_replace("_", ".", $name); + return $this->params($name); + } + $name = str_replace("set", "", $name); + $name = str_replace("_", ".", $name); + $this->params($name, $arguments[0]); + return $this; + } } \ No newline at end of file