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

Commit

Permalink
Merge branch 'master' into rfc/escaper
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 61 changed files with 626 additions and 417 deletions.
36 changes: 21 additions & 15 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc;

use Zend\Http,
Expand Down Expand Up @@ -87,7 +84,7 @@ class Client implements ServerClient
*
* @param string $server Full address of the XML-RPC service
* (e.g. http://time.xmlrpc.com/RPC2)
* @param Zend\Http\Client $httpClient HTTP Client to use for requests
* @param \Zend\Http\Client $httpClient HTTP Client to use for requests
* @return void
*/
public function __construct($server, Http\Client $httpClient = null)
Expand Down Expand Up @@ -259,7 +256,7 @@ public function doRequest($request, $response = null)
}

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

/**
Expand All @@ -278,7 +275,7 @@ public function call($method, $params=array())
$success = true;
try {
$signatures = $this->getIntrospector()->getMethodSignature($method);
} catch (\Zend\XmlRpc\Exception $e) {
} catch (\Zend\XmlRpc\Exception\ExceptionInterface $e) {
$success = false;
}
if ($success) {
Expand All @@ -299,21 +296,30 @@ public function call($method, $params=array())
$params = array($params);
}
foreach ($params as $key => $param) {

if ($param instanceof Value) {
continue;
}

$type = Value::AUTO_DETECT_TYPE;
foreach ($signatures as $signature) {
if (!is_array($signature)) {
continue;
if (count($signatures) > 1) {
$type = Value::getXmlRpcTypeByValue($param);
foreach ($signatures as $signature) {
if (!is_array($signature)) {
continue;
}
if (isset($signature['parameters'][$key])) {
if ($signature['parameters'][$key] == $type) {
break;
}
}
}
} elseif (isset($signatures[0]['parameters'][$key])) {
$type = $signatures[0]['parameters'][$key];
} else {
$type = null;
}

if (isset($signature['parameters'][$key])) {
$type = $signature['parameters'][$key];
$type = in_array($type, $validTypes) ? $type : Value::AUTO_DETECT_TYPE;
}
if (empty($type) || !in_array($type, $validTypes)) {
$type = Value::AUTO_DETECT_TYPE;
}

$params[$key] = Value::getXmlRpcValue($param, $type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc\Client;
namespace Zend\XmlRpc\Client\Exception;

use Zend\XmlRpc\Exception\ExceptionInterface as Exception;

/**
* Base class for all Zend_XmlRpc_Client_* exceptions
*
* @uses Zend\XmlRpc\Exception
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception extends \Zend\XmlRpc\Exception
{}
interface ExceptionInterface extends Exception
{}
12 changes: 5 additions & 7 deletions src/Client/Exception/FaultException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc\Client\Exception;

use Zend\XmlRpc\Exception;

/**
* Thrown by Zend_XmlRpc_Client when an XML-RPC fault response is returned.
*
* @uses Zend\XmlRpc\Client\Exception
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class FaultException
extends \BadMethodCallException
implements \Zend\XmlRpc\Client\Exception
{}
extends Exception\BadMethodCallException
implements ExceptionInterface
{}
4 changes: 0 additions & 4 deletions src/Client/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc\Client\Exception;

/**
* Thrown by Zend_XmlRpc_Client when an HTTP error occurs during an
* XML-RPC method call.
*
* @uses Zend\XmlRpc\Client\Exception
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
Expand Down
9 changes: 2 additions & 7 deletions src/Client/Exception/IntrospectException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,17 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc\Client\Exception;

/**
* Thrown by Zend_XmlRpc_Client_Introspection when any error occurs.
*
* @uses Zend\XmlRpc\Client\Exception
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class IntrospectException
extends \InvalidArgumentException
implements \Zend\XmlRpc\Client\Exception
{}
extends InvalidArgumentException
{}
8 changes: 5 additions & 3 deletions src/Client/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Zend\XmlRpc\Client\Exception;

use Zend\XmlRpc\Exception;

class InvalidArgumentException
extends \InvalidArgumentException
implements \Zend\XmlRpc\Exception
{}
extends Exception\InvalidArgumentException
implements ExceptionInterface
{}
9 changes: 5 additions & 4 deletions src/Client/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Zend\XmlRpc\Client\Exception;

use Zend\XmlRpc\Exception;

class RuntimeException
extends \RuntimeException
implements \Zend\XmlRpc\Client\Exception
{}

extends Exception\RuntimeException
implements ExceptionInterface
{}
5 changes: 0 additions & 5 deletions src/Client/ServerIntrospection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc\Client;

use Zend\XmlRpc\Client as XMLRPCClient;

/**
* Wraps the XML-RPC system.* introspection methods
*
* @uses Zend\XmlRpc\Client\FaultException
* @uses Zend\XmlRpc\Client\IntrospectException
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
Expand Down
3 changes: 0 additions & 3 deletions src/Client/ServerProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc\Client;

use Zend\XmlRpc\Client as XMLRPCClient;
Expand Down
8 changes: 8 additions & 0 deletions src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Zend\XmlRpc\Exception;

class BadMethodCallException
extends \BadMethodCallException
implements ExceptionInterface
{}
7 changes: 2 additions & 5 deletions src/Exception.php → src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc;
namespace Zend\XmlRpc\Exception;

/**
* @category Zend
* @package Zend_XmlRpc
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
interface ExceptionInterface
{}
3 changes: 1 addition & 2 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@

class InvalidArgumentException
extends \InvalidArgumentException
implements \Zend\XmlRpc\Exception
implements ExceptionInterface
{}

3 changes: 1 addition & 2 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@

class RuntimeException
extends \RuntimeException
implements \Zend\XmlRpc\Exception
implements ExceptionInterface
{}

9 changes: 2 additions & 7 deletions src/Exception/ValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc\Exception;

/**
* @uses \Zend\XmlRpc\Exception
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
Expand All @@ -34,6 +30,5 @@
*/
class ValueException
extends \LogicException
implements \Zend\XmlRpc\Exception
{}

implements ExceptionInterface
{}
16 changes: 5 additions & 11 deletions src/Fault.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\XmlRpc;

/**
Expand All @@ -33,9 +30,6 @@
* To allow method chaining, you may only use the {@link getInstance()} factory
* to instantiate a Zend_XmlRpc_Server_Fault.
*
* @uses SimpleXMLElement
* @uses Zend\XmlRpc\Exception
* @uses Zend\XmlRpc\Value\Value
* @category Zend
* @package Zend_XmlRpc
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
Expand Down Expand Up @@ -121,7 +115,7 @@ public function __construct($code = 404, $message = '')
* Set the fault code
*
* @param int $code
* @return Zend\XmlRpc\Fault
* @return Fault
*/
public function setCode($code)
{
Expand All @@ -143,7 +137,7 @@ public function getCode()
* Retrieve fault message
*
* @param string
* @return Zend\XmlRpc\Fault
* @return Fault
*/
public function setMessage($message)
{
Expand All @@ -165,7 +159,7 @@ public function getMessage()
* Set encoding to use in fault response
*
* @param string $encoding
* @return Zend\XmlRpc\Fault
* @return Fault
*/
public function setEncoding($encoding)
{
Expand All @@ -190,7 +184,7 @@ public function getEncoding()
* @param string $fault
* @return boolean Returns true if successfully loaded fault response, false
* if response was not a fault response
* @throws Zend\XmlRpc\Exception if no or faulty XML provided, or if fault
* @throws \Zend\XmlRpc\Exception\ExceptionInterface if no or faulty XML provided, or if fault
* response does not contain either code or message
*/
public function loadXml($fault)
Expand Down Expand Up @@ -261,7 +255,7 @@ public static function isFault($xml)
$fault = new self();
try {
$isFault = $fault->loadXml($xml);
} catch (Exception $e) {
} catch (Exception\ExceptionInterface $e) {
$isFault = false;
}

Expand Down
Loading

0 comments on commit 6c44bc5

Please sign in to comment.