Skip to content

Commit

Permalink
get&set func change; supported special param name
Browse files Browse the repository at this point in the history
  • Loading branch information
AxiosLeo committed Jun 10, 2019
1 parent 0fcdb69 commit 39c982a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
11 changes: 0 additions & 11 deletions library/core/lib/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
13 changes: 13 additions & 0 deletions library/core/lib/RoaRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
13 changes: 13 additions & 0 deletions library/core/lib/RpcRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 39c982a

Please sign in to comment.