Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 30 changed files with 255 additions and 255 deletions.
28 changes: 14 additions & 14 deletions src/AbstractValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ abstract class AbstractValue
* If the native type of this object is array or struct, this will be an array
* of Value objects
*/
protected $_value;
protected $value;

/**
* The native XML-RPC type of this object
* One of the XMLRPC_TYPE_* constants
*/
protected $_type;
protected $type;

/**
* XML code representation of this object (will be calculated only once)
*/
protected $_xml;
protected $xml;

/**
* @var Zend\XmlRpc\Generator\GeneratorAbstract
*/
protected static $_generator;
protected static $generator;

/**
* Specify that the XML-RPC native type will be auto detected from a PHP variable type
Expand Down Expand Up @@ -85,7 +85,7 @@ abstract class AbstractValue
*/
public function getType()
{
return $this->_type;
return $this->type;
}

/**
Expand All @@ -95,15 +95,15 @@ public function getType()
*/
public static function getGenerator()
{
if (!self::$_generator) {
if (!self::$generator) {
if (extension_loaded('xmlwriter')) {
self::$_generator = new Generator\XmlWriter();
self::$generator = new Generator\XmlWriter();
} else {
self::$_generator = new Generator\DomDocument();
self::$generator = new Generator\DomDocument();
}
}

return self::$_generator;
return self::$generator;
}

/**
Expand All @@ -114,7 +114,7 @@ public static function getGenerator()
*/
public static function setGenerator(Generator\GeneratorInterface $generator = null)
{
self::$_generator = $generator;
self::$generator = $generator;
}

/**
Expand Down Expand Up @@ -145,11 +145,11 @@ abstract public function getValue();
*/
public function saveXml()
{
if (!$this->_xml) {
if (!$this->xml) {
$this->generateXml();
$this->_xml = (string) $this->getGenerator();
$this->xml = (string) $this->getGenerator();
}
return $this->_xml;
return $this->xml;
}

/**
Expand Down Expand Up @@ -463,6 +463,6 @@ protected static function _extractTypeAndValue(\SimpleXMLElement $xml, &$type, &
*/
protected function _setXML($xml)
{
$this->_xml = $this->getGenerator()->stripDeclaration($xml);
$this->xml = $this->getGenerator()->stripDeclaration($xml);
}
}
60 changes: 30 additions & 30 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,43 @@ class Client implements ServerClient
* @var string
* @example http://time.xmlrpc.com/RPC2
*/
protected $_serverAddress;
protected $serverAddress;

/**
* HTTP Client to use for requests
* @var Zend\Http\Client
*/
protected $_httpClient = null;
protected $httpClient = null;

/**
* Introspection object
* @var Zend\Http\Client\ServerIntrospection
*/
protected $_introspector = null;
protected $introspector = null;

/**
* Request of the last method call
* @var Zend\XmlRpc\Request
*/
protected $_lastRequest = null;
protected $lastRequest = null;

/**
* Response received from the last method call
* @var Zend\XmlRpc\Response
*/
protected $_lastResponse = null;
protected $lastResponse = null;

/**
* Proxy object for more convenient method calls
* @var array of Zend\XmlRpc\Client\ServerProxy
*/
protected $_proxyCache = array();
protected $proxyCache = array();

/**
* Flag for skipping system lookup
* @var bool
*/
protected $_skipSystemLookup = false;
protected $skipSystemLookup = false;

/**
* Create a new XML-RPC client to a remote server
Expand All @@ -77,13 +77,13 @@ class Client implements ServerClient
public function __construct($server, Http\Client $httpClient = null)
{
if ($httpClient === null) {
$this->_httpClient = new Http\Client();
$this->httpClient = new Http\Client();
} else {
$this->_httpClient = $httpClient;
$this->httpClient = $httpClient;
}

$this->_introspector = new Client\ServerIntrospection($this);
$this->_serverAddress = $server;
$this->introspector = new Client\ServerIntrospection($this);
$this->serverAddress = $server;
}


Expand All @@ -95,7 +95,7 @@ public function __construct($server, Http\Client $httpClient = null)
*/
public function setHttpClient(Http\Client $httpClient)
{
return $this->_httpClient = $httpClient;
return $this->httpClient = $httpClient;
}


Expand All @@ -106,7 +106,7 @@ public function setHttpClient(Http\Client $httpClient)
*/
public function getHttpClient()
{
return $this->_httpClient;
return $this->httpClient;
}


Expand All @@ -118,7 +118,7 @@ public function getHttpClient()
*/
public function setIntrospector(Client\ServerIntrospection $introspector)
{
return $this->_introspector = $introspector;
return $this->introspector = $introspector;
}


Expand All @@ -129,7 +129,7 @@ public function setIntrospector(Client\ServerIntrospection $introspector)
*/
public function getIntrospector()
{
return $this->_introspector;
return $this->introspector;
}


Expand All @@ -140,7 +140,7 @@ public function getIntrospector()
*/
public function getLastRequest()
{
return $this->_lastRequest;
return $this->lastRequest;
}


Expand All @@ -151,7 +151,7 @@ public function getLastRequest()
*/
public function getLastResponse()
{
return $this->_lastResponse;
return $this->lastResponse;
}


Expand All @@ -163,11 +163,11 @@ public function getLastResponse()
*/
public function getProxy($namespace = '')
{
if (empty($this->_proxyCache[$namespace])) {
if (empty($this->proxyCache[$namespace])) {
$proxy = new Client\ServerProxy($this, $namespace);
$this->_proxyCache[$namespace] = $proxy;
$this->proxyCache[$namespace] = $proxy;
}
return $this->_proxyCache[$namespace];
return $this->proxyCache[$namespace];
}

/**
Expand All @@ -178,7 +178,7 @@ public function getProxy($namespace = '')
*/
public function setSkipSystemLookup($flag = true)
{
$this->_skipSystemLookup = (bool) $flag;
$this->skipSystemLookup = (bool) $flag;
return $this;
}

Expand All @@ -189,7 +189,7 @@ public function setSkipSystemLookup($flag = true)
*/
public function skipSystemLookup()
{
return $this->_skipSystemLookup;
return $this->skipSystemLookup;
}

/**
Expand All @@ -202,7 +202,7 @@ public function skipSystemLookup()
*/
public function doRequest($request, $response = null)
{
$this->_lastRequest = $request;
$this->lastRequest = $request;

iconv_set_encoding('input_encoding', 'UTF-8');
iconv_set_encoding('output_encoding', 'UTF-8');
Expand All @@ -211,7 +211,7 @@ public function doRequest($request, $response = null)
$http = $this->getHttpClient();
$httpRequest = $http->getRequest();
if ($httpRequest->getUriString() === null) {
$http->setUri($this->_serverAddress);
$http->setUri($this->serverAddress);
}

$headers = $httpRequest->getHeaders();
Expand All @@ -224,7 +224,7 @@ public function doRequest($request, $response = null)
$headers->addHeaderLine('user-agent', 'Zend_XmlRpc_Client');
}

$xml = $this->_lastRequest->__toString();
$xml = $this->lastRequest->__toString();
$http->setRawBody($xml);
$httpResponse = $http->setMethod('POST')->send();

Expand All @@ -242,8 +242,8 @@ public function doRequest($request, $response = null)
$response = new Response();
}

$this->_lastResponse = $response;
$this->_lastResponse->loadXml(trim($httpResponse->getBody()));
$this->lastResponse = $response;
$this->lastResponse->loadXml(trim($httpResponse->getBody()));
}

/**
Expand Down Expand Up @@ -318,8 +318,8 @@ public function call($method, $params=array())

$this->doRequest($request);

if ($this->_lastResponse->isFault()) {
$fault = $this->_lastResponse->getFault();
if ($this->lastResponse->isFault()) {
$fault = $this->lastResponse->getFault();
/**
* Exception thrown when an XML-RPC fault is returned
*/
Expand All @@ -329,7 +329,7 @@ public function call($method, $params=array())
);
}

return $this->_lastResponse->getReturnValue();
return $this->lastResponse->getReturnValue();
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Client/ServerIntrospection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ class ServerIntrospection
/**
* @var \Zend\XmlRpc\Client\ServerProxy
*/
private $_system = null;
private $system = null;


/**
* @param Zend\XmlRpc\Client $client
*/
public function __construct(XMLRPCClient $client)
{
$this->_system = $client->getProxy('system');
$this->system = $client->getProxy('system');
}

/**
Expand Down Expand Up @@ -79,7 +79,7 @@ public function getSignatureForEachMethodByMulticall($methods = null)
'params' => array($method));
}

$serverSignatures = $this->_system->multicall($multicallParams);
$serverSignatures = $this->system->multicall($multicallParams);

if (! is_array($serverSignatures)) {
$type = gettype($serverSignatures);
Expand Down Expand Up @@ -130,7 +130,7 @@ public function getSignatureForEachMethodByLooping($methods = null)
*/
public function getMethodSignature($method)
{
$signature = $this->_system->methodSignature($method);
$signature = $this->system->methodSignature($method);
if (!is_array($signature)) {
$error = 'Invalid signature for method "' . $method . '"';
throw new Exception\IntrospectException($error);
Expand All @@ -146,7 +146,7 @@ public function getMethodSignature($method)
*/
public function listMethods()
{
return $this->_system->listMethods();
return $this->system->listMethods();
}

}
Loading

0 comments on commit 737988b

Please sign in to comment.