diff --git a/CHANGELOG.md b/CHANGELOG.md index 1480c7b..5af69ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,10 @@ ## UNRELEASED - Make cloning object do clone used objects as well, [#5] +- Add fluent interface for setter methods, [#6] [#5]: https://github.com/eventum/rpc/pull/5 +[#6]: https://github.com/eventum/rpc/pull/6 ## [4.2.0] - 2018-05-01 diff --git a/src/XmlRpcClient.php b/src/XmlRpcClient.php index cf20e28..d98c263 100644 --- a/src/XmlRpcClient.php +++ b/src/XmlRpcClient.php @@ -43,10 +43,13 @@ public function __clone() * Change the current debug mode * * @param int $debug where 1 = on, 0 = off + * @return $this */ public function setDebug($debug) { $this->client->setDebug($debug); + + return $this; } /** @@ -54,17 +57,33 @@ public function setDebug($debug) * * @param string $username the user name * @param string $password the password + * @return $this */ public function setCredentials($username, $password) { $this->client->setCredentials($username, $password); + + return $this; + } + + /** + * Add identifier to user agent + * + * @param string $userAgent + * @return $this + */ + public function addUserAgent($userAgent) + { + $this->client->user_agent .= ' ' . $userAgent; + + return $this; } /** * Implementation independent method to encode value as binary * * @param mixed $value - * @return \PhpXmlRpc\Value + * @return PhpXmlRpc\Value * @since 3.0.1 */ public function encodeBinary($value) @@ -108,14 +127,4 @@ public function __call($method, $args = array()) return $this->encoder->decode($result->value()); } - - /** - * Add identifier to user agent - * - * @param string $userAgent - */ - public function addUserAgent($userAgent) - { - $this->client->user_agent .= ' ' . $userAgent; - } }