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 60 changed files with 714 additions and 1,315 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

23 changes: 13 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
{
"name": "zendframework/zend-xml-rpc",
"description": "Zend\\XmlRpc component",
"name": "zendframework/zend-xmlrpc",
"description": " ",
"license": "BSD-3-Clause",
"keywords": [
"zf2",
"xml-rpc"
"xmlrpc"
],
"autoload": {
"psr-4": {
"Zend\\XmlRpc\\": "src/"
"Zend\\XmlRpc": "src/"
}
},
"require": {
"php": ">=5.3.23"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"satooshi/php-coveralls": "dev-master",
"phpunit/PHPUnit": "~4.0"
"php": ">=5.3.3",
"zendframework/zend-http": "self.version",
"zendframework/zend-math": "self.version",
"zendframework/zend-server": "self.version"
},
"homepage": "https://github.com/zendframework/zend-xml-rpc",
"autoload-dev": {
"psr-4": {
"ZendTest\\XmlRpc\\": "test/"
}
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"satooshi/php-coveralls": "dev-master",
"phpunit/PHPUnit": "~4.0"
}
}
41 changes: 13 additions & 28 deletions src/Value.php → src/AbstractValue.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc;

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

/**
Expand All @@ -36,10 +24,8 @@
* from PHP variables, XML string or by specifing the exact XML-RPC natvie type
*
* @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
*/
abstract class Value
abstract class AbstractValue
{
/**
* The native XML-RPC representation of this object's value
Expand Down Expand Up @@ -188,7 +174,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 +238,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 +271,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 All @@ -304,8 +290,7 @@ protected static function _phpVarToNativeXmlRpc($value)
}
}

switch (self::getXmlRpcTypeByValue($value))
{
switch (self::getXmlRpcTypeByValue($value)) {
case self::XMLRPC_TYPE_DATETIME:
return new Value\DateTime($value);

Expand Down Expand Up @@ -341,7 +326,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
61 changes: 24 additions & 37 deletions src/Client.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

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
*
* @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 Client implements ServerClient
{
Expand Down Expand Up @@ -223,11 +210,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 +267,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 +306,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
26 changes: 7 additions & 19 deletions src/Client/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;
Expand All @@ -29,8 +18,7 @@
* @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 ExceptionInterface extends Exception
{}
{
}
30 changes: 8 additions & 22 deletions src/Client/Exception/FaultException.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;
Expand All @@ -29,10 +18,7 @@
* @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 Exception\BadMethodCallException
implements ExceptionInterface
{}
class FaultException extends Exception\BadMethodCallException implements ExceptionInterface
{
}
29 changes: 8 additions & 21 deletions src/Client/Exception/HttpException.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;
Expand All @@ -28,9 +17,7 @@
* @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 HttpException
extends RuntimeException
{}
class HttpException extends RuntimeException
{
}
Loading

0 comments on commit 3521702

Please sign in to comment.