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

Commit

Permalink
Merge branch 'hotfix/dependencies'
Browse files Browse the repository at this point in the history
Close #17
  • Loading branch information
weierophinney committed Apr 21, 2016
2 parents 2993f22 + 3ee5397 commit 8d7016d
Show file tree
Hide file tree
Showing 42 changed files with 791 additions and 671 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
coverage_clover: clover.xml
json_path: coveralls-upload.json
src_dir: src
45 changes: 0 additions & 45 deletions .php_cs

This file was deleted.

19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,37 @@ matrix:
include:
- php: 5.5
env:
- EXECUTE_CS_CHECK=true
- CS_CHECK=true
- php: 5.6
env:
- EXECUTE_TEST_COVERALLS=true
- TEST_COVERAGE=true
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
- PATH="$HOME/.local/bin:$PATH"
- php: 7
- php: hhvm
allow_failures:
- php: 7
- php: hhvm

notifications:
irc: "irc.freenode.org#zftalk.dev"
email: false

before_install:
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- composer self-update
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- travis_retry composer self-update

install:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
- travis_retry composer install --no-interaction --ignore-platform-reqs

script:
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; fi
- if [[ $TEST_COVERAGE != 'true' ]]; then composer test ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
- if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi

after_success:
- if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi

after_script:
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#17](https://github.com/zendframework/zend-xmlrpc/pull/17) updates
dependencies to allow zend-stdlib v3 releases.
43 changes: 28 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@
"Zend\\XmlRpc\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"ZendTest\\XmlRpc\\": "test/"
},
"files": [
"test/TestAsset/functions.php"
]
},
"require": {
"php": ">=5.5",
"zendframework/zend-http": "~2.5",
"zendframework/zend-math": "~2.5",
"zendframework/zend-server": "~2.5",
"zendframework/zend-stdlib": "~2.5",
"zendframework/zendxml": "1.*"
"php": "^5.5 || ^7.0",
"zendframework/zend-http": "^2.5.4",
"zendframework/zend-math": "^2.7",
"zendframework/zend-server": "^2.6.1",
"zendframework/zend-stdlib": "^2.7 || ^3.0",
"zendframework/zendxml": "^1.0.2"
},
"require-dev": {
"phpunit/PHPUnit": "^4.8",
"squizlabs/php_codesniffer": "^2.3.1"
},
"suggest": {
"zendframework/zend-cache": "To support Zend\\XmlRpc\\Server\\Cache usage"
Expand All @@ -31,14 +43,15 @@
"dev-develop": "2.6-dev"
}
},
"autoload-dev": {
"psr-4": {
"ZendTest\\XmlRpc\\": "test/"
}
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/PHPUnit": "~4.0",
"zendframework/zend-servicemanager": "~2.5"
"scripts": {
"check": [
"@cs-check",
"@test"
],
"upload-coverage": "coveralls -v",
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit",
"test-coverage": "phpunit --coverage-clover clover.xml"
}
}
23 changes: 23 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<ruleset name="Zend Framework coding standard">
<description>Zend Framework coding standard</description>

<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>

<!-- inherit rules from: -->
<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>

<!-- Paths to check -->
<file>src</file>
<file>test</file>
<exclude-pattern>test/_files/*</exclude-pattern>
<exclude-pattern>test/TestAsset/*</exclude-pattern>
</ruleset>
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./test/bootstrap.php"
bootstrap="./vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="zend-xmlrpc Test Suite">
Expand Down
31 changes: 16 additions & 15 deletions src/AbstractValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Zend\XmlRpc;

use DateTime;
use SimpleXMLElement;

/**
* Represent a native XML-RPC value entity, used as parameters for the methods
Expand Down Expand Up @@ -155,7 +156,7 @@ public function saveXml()
*/
public function generateXml()
{
$this->_generateXml();
$this->generate();
}

/**
Expand All @@ -178,11 +179,11 @@ public static function getXmlRpcValue($value, $type = self::AUTO_DETECT_TYPE)
switch ($type) {
case self::AUTO_DETECT_TYPE:
// Auto detect the XML-RPC native type from the PHP type of $value
return static::_phpVarToNativeXmlRpc($value);
return static::phpVarToNativeXmlRpc($value);

case self::XML_STRING:
// Parse the XML string given in $value and get the XML-RPC value in it
return static::_xmlStringToNativeXmlRpc($value);
return static::xmlStringToNativeXmlRpc($value);

case self::XMLRPC_TYPE_I4:
// fall through to the next case
Expand Down Expand Up @@ -273,7 +274,7 @@ public static function getXmlRpcTypeByValue($value)
* @return AbstractValue
* @static
*/
protected static function _phpVarToNativeXmlRpc($value)
protected static function phpVarToNativeXmlRpc($value)
{
// @see http://framework.zend.com/issues/browse/ZF-8623
if ($value instanceof AbstractValue) {
Expand Down Expand Up @@ -320,11 +321,11 @@ protected static function _phpVarToNativeXmlRpc($value)
* @return \Zend\XmlRpc\AbstractValue
* @static
*/
protected static function _xmlStringToNativeXmlRpc($xml)
protected static function xmlStringToNativeXmlRpc($xml)
{
static::_createSimpleXMLElement($xml);
static::createSimpleXMLElement($xml);

static::_extractTypeAndValue($xml, $type, $value);
static::extractTypeAndValue($xml, $type, $value);

switch ($type) {
// All valid and known XML-RPC native values
Expand Down Expand Up @@ -381,7 +382,7 @@ protected static function _xmlStringToNativeXmlRpc($xml)
// Parse all the elements of the array from the XML string
// (simple xml element) to Value objects
foreach ($data->value as $element) {
$values[] = static::_xmlStringToNativeXmlRpc($element);
$values[] = static::xmlStringToNativeXmlRpc($element);
}
$xmlrpcValue = new Value\ArrayValue($values);
break;
Expand All @@ -395,7 +396,7 @@ protected static function _xmlStringToNativeXmlRpc($xml)
if (!isset($member->value) or !isset($member->name)) {
continue;
}
$values[(string) $member->name] = static::_xmlStringToNativeXmlRpc($member->value);
$values[(string) $member->name] = static::xmlStringToNativeXmlRpc($member->value);
}
$xmlrpcValue = new Value\Struct($values);
break;
Expand All @@ -405,19 +406,19 @@ protected static function _xmlStringToNativeXmlRpc($xml)
);
break;
}
$xmlrpcValue->_setXML($xml->asXML());
$xmlrpcValue->setXML($xml->asXML());

return $xmlrpcValue;
}

protected static function _createSimpleXMLElement(&$xml)
protected static function createSimpleXMLElement(&$xml)
{
if ($xml instanceof \SimpleXMLElement) {
if ($xml instanceof SimpleXMLElement) {
return;
}

try {
$xml = new \SimpleXMLElement($xml);
$xml = new SimpleXMLElement($xml);
} catch (\Exception $e) {
// The given string is not a valid XML
throw new Exception\ValueException(
Expand All @@ -436,7 +437,7 @@ protected static function _createSimpleXMLElement(&$xml)
* @param string &$value Value bind variable
* @return void
*/
protected static function _extractTypeAndValue(\SimpleXMLElement $xml, &$type, &$value)
protected static function extractTypeAndValue(\SimpleXMLElement $xml, &$type, &$value)
{
// Casting is necessary to work with strict-typed systems
$xmlAsArray = (array) $xml;
Expand Down Expand Up @@ -467,7 +468,7 @@ protected static function _extractTypeAndValue(\SimpleXMLElement $xml, &$type, &
* @param $xml
* @return void
*/
protected function _setXML($xml)
protected function setXML($xml)
{
$this->xml = $this->getGenerator()->stripDeclaration($xml);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public function call($method, $params = [])
}
}

$request = $this->_createRequest($method, $params);
$request = $this->createRequest($method, $params);

$this->doRequest($request);

Expand All @@ -329,7 +329,7 @@ public function call($method, $params = [])
* @param array $params
* @return \Zend\XmlRpc\Request
*/
protected function _createRequest($method, $params)
protected function createRequest($method, $params)
{
return new Request($method, $params);
}
Expand Down
18 changes: 9 additions & 9 deletions src/Generator/AbstractGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ abstract class AbstractGenerator implements GeneratorInterface
public function __construct($encoding = 'UTF-8')
{
$this->setEncoding($encoding);
$this->_init();
$this->init();
}

/**
* Initialize internal objects
*
* @return void
*/
abstract protected function _init();
abstract protected function init();

/**
* Start XML element
Expand All @@ -50,9 +50,9 @@ abstract protected function _init();
*/
public function openElement($name, $value = null)
{
$this->_openElement($name);
$this->openXmlElement($name);
if ($value !== null) {
$this->_writeTextData($value);
$this->writeTextData($value);
}

return $this;
Expand All @@ -68,7 +68,7 @@ public function openElement($name, $value = null)
*/
public function closeElement($name)
{
$this->_closeElement($name);
$this->closeXmlElement($name);

return $this;
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public function setEncoding($encoding)
public function flush()
{
$xml = $this->saveXml();
$this->_init();
$this->init();
return $xml;
}

Expand Down Expand Up @@ -133,19 +133,19 @@ public function stripDeclaration($xml)
*
* @param string $name XML element name
*/
abstract protected function _openElement($name);
abstract protected function openXmlElement($name);

/**
* Write XML text data into the currently opened XML element
*
* @param string $text
*/
abstract protected function _writeTextData($text);
abstract protected function writeTextData($text);

/**
* End XML element
*
* @param string $name
*/
abstract protected function _closeElement($name);
abstract protected function closeXmlElement($name);
}
Loading

0 comments on commit 8d7016d

Please sign in to comment.