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' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 48 changed files with 362 additions and 444 deletions.
14 changes: 0 additions & 14 deletions .travis/run-tests.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .travis/skipped-components

This file was deleted.

61 changes: 0 additions & 61 deletions .travis/tested-components

This file was deleted.

15 changes: 7 additions & 8 deletions src/Value.php → src/AbstractValue.php
Expand Up @@ -22,7 +22,6 @@
namespace Zend\XmlRpc;

use DateTime;
use Zend\Date;
use Zend\Math\BigInteger;

/**
Expand All @@ -39,7 +38,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Value
abstract class AbstractValue
{
/**
* The native XML-RPC representation of this object's value
Expand Down Expand Up @@ -188,7 +187,7 @@ public function generateXml()
*
* @param mixed $value
* @param Zend\XmlRpc\Value::constant $type
* @return Value
* @return AbstractValue
*/
public static function getXmlRpcValue($value, $type = self::AUTO_DETECT_TYPE)
{
Expand Down Expand Up @@ -252,9 +251,9 @@ public static function getXmlRpcValue($value, $type = self::AUTO_DETECT_TYPE)
public static function getXmlRpcTypeByValue($value)
{
if (is_object($value)) {
if ($value instanceof Value) {
if ($value instanceof AbstractValue) {
return $value->getType();
} elseif (($value instanceof Date\Date) || ($value instanceof DateTime)) {
} elseif ($value instanceof DateTime) {
return self::XMLRPC_TYPE_DATETIME;
}
return self::getXmlRpcTypeByValue(get_object_vars($value));
Expand Down Expand Up @@ -285,14 +284,14 @@ public static function getXmlRpcTypeByValue($value)
*
* @param mixed $value The PHP variable for convertion
*
* @return Value
* @return AbstractValue
* @static
*/
protected static function _phpVarToNativeXmlRpc($value)
{
// @see http://framework.zend.com/issues/browse/ZF-8623
if (is_object($value)) {
if ($value instanceof Value) {
if ($value instanceof AbstractValue) {
return $value;
}
if ($value instanceof BigInteger) {
Expand Down Expand Up @@ -341,7 +340,7 @@ protected static function _phpVarToNativeXmlRpc($value)
* @param string|SimpleXMLElement $xml A SimpleXMLElement object represent the XML string
* It can be also a valid XML string for convertion
*
* @return Zend\XmlRpc\Value\Value
* @return Zend\XmlRpc\Value\AbstractValue
* @static
*/
protected static function _xmlStringToNativeXmlRpc($xml)
Expand Down
38 changes: 19 additions & 19 deletions src/Client.php
Expand Up @@ -21,9 +21,9 @@

namespace Zend\XmlRpc;

use Zend\Http,
Zend\Server\Client as ServerClient,
Zend\XmlRpc\Value;
use Zend\Http;
use Zend\Server\Client as ServerClient;
use Zend\XmlRpc\AbstractValue;

/**
* An XML-RPC client implementation
Expand Down Expand Up @@ -223,11 +223,11 @@ public function doRequest($request, $response = null)

$http = $this->getHttpClient();
$httpRequest = $http->getRequest();
if ($httpRequest->getUri() === null) {
if ($httpRequest->getUriString() === null) {
$http->setUri($this->_serverAddress);
}

$headers = $httpRequest->headers();
$headers = $httpRequest->getHeaders();
$headers->addHeaders(array(
'Content-Type: text/xml; charset=utf-8',
'Accept: text/xml',
Expand Down Expand Up @@ -280,28 +280,28 @@ public function call($method, $params=array())
}
if ($success) {
$validTypes = array(
Value::XMLRPC_TYPE_ARRAY,
Value::XMLRPC_TYPE_BASE64,
Value::XMLRPC_TYPE_BOOLEAN,
Value::XMLRPC_TYPE_DATETIME,
Value::XMLRPC_TYPE_DOUBLE,
Value::XMLRPC_TYPE_I4,
Value::XMLRPC_TYPE_INTEGER,
Value::XMLRPC_TYPE_NIL,
Value::XMLRPC_TYPE_STRING,
Value::XMLRPC_TYPE_STRUCT,
AbstractValue::XMLRPC_TYPE_ARRAY,
AbstractValue::XMLRPC_TYPE_BASE64,
AbstractValue::XMLRPC_TYPE_BOOLEAN,
AbstractValue::XMLRPC_TYPE_DATETIME,
AbstractValue::XMLRPC_TYPE_DOUBLE,
AbstractValue::XMLRPC_TYPE_I4,
AbstractValue::XMLRPC_TYPE_INTEGER,
AbstractValue::XMLRPC_TYPE_NIL,
AbstractValue::XMLRPC_TYPE_STRING,
AbstractValue::XMLRPC_TYPE_STRUCT,
);

if (!is_array($params)) {
$params = array($params);
}
foreach ($params as $key => $param) {
if ($param instanceof Value) {
if ($param instanceof AbstractValue) {
continue;
}

if (count($signatures) > 1) {
$type = Value::getXmlRpcTypeByValue($param);
$type = AbstractValue::getXmlRpcTypeByValue($param);
foreach ($signatures as $signature) {
if (!is_array($signature)) {
continue;
Expand All @@ -319,10 +319,10 @@ public function call($method, $params=array())
}

if (empty($type) || !in_array($type, $validTypes)) {
$type = Value::AUTO_DETECT_TYPE;
$type = AbstractValue::AUTO_DETECT_TYPE;
}

$params[$key] = Value::getXmlRpcValue($param, $type);
$params[$key] = AbstractValue::getXmlRpcValue($param, $type);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Client/Exception/ExceptionInterface.php
Expand Up @@ -33,4 +33,5 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ExceptionInterface extends Exception
{}
{
}
7 changes: 3 additions & 4 deletions src/Client/Exception/FaultException.php
Expand Up @@ -32,7 +32,6 @@
* @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 Exception\BadMethodCallException
implements ExceptionInterface
{}
class FaultException extends Exception\BadMethodCallException implements ExceptionInterface
{
}
6 changes: 3 additions & 3 deletions src/Client/Exception/HttpException.php
Expand Up @@ -31,6 +31,6 @@
* @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 HttpException
extends RuntimeException
{}
class HttpException extends RuntimeException
{
}
6 changes: 3 additions & 3 deletions src/Client/Exception/IntrospectException.php
Expand Up @@ -30,6 +30,6 @@
* @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
{}
class IntrospectException extends InvalidArgumentException
{
}
7 changes: 3 additions & 4 deletions src/Client/Exception/InvalidArgumentException.php
Expand Up @@ -4,7 +4,6 @@

use Zend\XmlRpc\Exception;

class InvalidArgumentException
extends Exception\InvalidArgumentException
implements ExceptionInterface
{}
class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface
{
}
7 changes: 3 additions & 4 deletions src/Client/Exception/RuntimeException.php
Expand Up @@ -4,7 +4,6 @@

use Zend\XmlRpc\Exception;

class RuntimeException
extends Exception\RuntimeException
implements ExceptionInterface
{}
class RuntimeException extends Exception\RuntimeException implements ExceptionInterface
{
}
7 changes: 3 additions & 4 deletions src/Exception/BadMethodCallException.php
Expand Up @@ -2,7 +2,6 @@

namespace Zend\XmlRpc\Exception;

class BadMethodCallException
extends \BadMethodCallException
implements ExceptionInterface
{}
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
{
}
3 changes: 2 additions & 1 deletion src/Exception/ExceptionInterface.php
Expand Up @@ -27,4 +27,5 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ExceptionInterface
{}
{
}
7 changes: 3 additions & 4 deletions src/Exception/InvalidArgumentException.php
Expand Up @@ -2,7 +2,6 @@

namespace Zend\XmlRpc\Exception;

class InvalidArgumentException
extends \InvalidArgumentException
implements ExceptionInterface
{}
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
7 changes: 3 additions & 4 deletions src/Exception/RuntimeException.php
Expand Up @@ -2,7 +2,6 @@

namespace Zend\XmlRpc\Exception;

class RuntimeException
extends \RuntimeException
implements ExceptionInterface
{}
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
7 changes: 3 additions & 4 deletions src/Exception/ValueException.php
Expand Up @@ -28,7 +28,6 @@
* @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 ValueException
extends \LogicException
implements ExceptionInterface
{}
class ValueException extends \LogicException implements ExceptionInterface
{
}
8 changes: 4 additions & 4 deletions src/Fault.php
Expand Up @@ -164,7 +164,7 @@ public function getMessage()
public function setEncoding($encoding)
{
$this->_encoding = $encoding;
Value::setEncoding($encoding);
AbstractValue::setEncoding($encoding);
return $this;
}

Expand Down Expand Up @@ -212,7 +212,7 @@ public function loadXml($fault)
}

$structXml = $xml->fault->value->asXML();
$struct = Value::getXmlRpcValue($structXml, Value::XML_STRING);
$struct = AbstractValue::getXmlRpcValue($structXml, AbstractValue::XML_STRING);
$struct = $struct->getValue();

if (isset($struct['faultCode'])) {
Expand Down Expand Up @@ -274,9 +274,9 @@ public function saveXml()
'faultCode' => $this->getCode(),
'faultString' => $this->getMessage()
);
$value = Value::getXmlRpcValue($faultStruct);
$value = AbstractValue::getXmlRpcValue($faultStruct);

$generator = Value::getGenerator();
$generator = AbstractValue::getGenerator();
$generator->openElement('methodResponse')
->openElement('fault');
$value->generateXml();
Expand Down

0 comments on commit 05d994b

Please sign in to comment.