Skip to content

Commit

Permalink
Merge pull request #6 from eventum/fluent-interface
Browse files Browse the repository at this point in the history
add fluent interface for setter methods
  • Loading branch information
glensc authored May 2, 2018
2 parents b40b76f + 765798e commit 75814af
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
31 changes: 20 additions & 11 deletions src/XmlRpcClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,47 @@ 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;
}

/**
* Set username and password properties for connecting to the RPC server
*
* @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)
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 75814af

Please sign in to comment.