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

Commit

Permalink
[PSR-2] fixers=braces,elseif,short_tag,php_closing_tag,trailing_space…
Browse files Browse the repository at this point in the history
…s,linefeed

Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed
  • Loading branch information
Maks3w committed Jul 12, 2012
1 parent e1fdc01 commit bd53446
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function _encodeValue(&$value)
{
if (is_object($value)) {
return $this->_encodeObject($value);
} else if (is_array($value)) {
} elseif (is_array($value)) {
return $this->_encodeArray($value);
}

Expand Down Expand Up @@ -148,7 +148,7 @@ protected function _encodeObject(&$value)
}

$className = get_class($value);
return '{"__className":'
return '{"__className":'
. $this->_encodeString($className)
. $props . '}';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
* @package Zend_Json
* @subpackage Exception
*/
class BadMethodCallException extends \BadMethodCallException implements
class BadMethodCallException extends \BadMethodCallException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
* @category Zend
* @package Zend_Json
*/
class InvalidArgumentException extends \InvalidArgumentException implements
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{}
23 changes: 12 additions & 11 deletions src/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected static function _recursiveJsonExprFinder(
* @param SimpleXMLElement $simpleXmlElementObject
* @return Zend_Json_Expr|string
*/
protected static function _getXmlValue($simpleXmlElementObject)
protected static function _getXmlValue($simpleXmlElementObject)
{
$pattern = '/^[\s]*new Zend[_\\]Json[_\\]Expr[\s]*\([\s]*[\"\']{1}(.*)[\"\']{1}[\s]*\)[\s]*$/';
$matchings = array();
Expand Down Expand Up @@ -226,13 +226,13 @@ protected static function _getXmlValue($simpleXmlElementObject)
* @param integer $recursionDepth
* @return array
*/
protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttributes, $recursionDepth = 0)
protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttributes, $recursionDepth = 0)
{
// Keep an eye on how deeply we are involved in recursion.
if ($recursionDepth > self::$maxRecursionDepthAllowed) {
// XML tree is too deep. Exit now by throwing an exception.
throw new RecursionException(
"Function _processXml exceeded the allowed recursion depth of "
"Function _processXml exceeded the allowed recursion depth of "
. self::$maxRecursionDepthAllowed
);
}
Expand All @@ -249,7 +249,7 @@ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttribu
}
if (!empty($value)) {
$attributes['@text'] = $value;
}
}
return array($name => $attributes);
}

Expand Down Expand Up @@ -310,7 +310,8 @@ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttribu
* @return mixed - JSON formatted string on success
* @throws \Zend\Json\Exception\RuntimeException if the input not a XML formatted string
*/
public static function fromXml ($xmlStringContents, $ignoreXmlAttributes=true) {
public static function fromXml ($xmlStringContents, $ignoreXmlAttributes=true)
{
// Load the XML formatted string into a Simple XML Element object.
$simpleXmlElementObject = simplexml_load_string($xmlStringContents);

Expand All @@ -332,9 +333,9 @@ public static function fromXml ($xmlStringContents, $ignoreXmlAttributes=true) {

/**
* Pretty-print JSON string
*
*
* Use 'indent' option to select indentation string - by default it's a tab
*
*
* @param string $json Original JSON string
* @param array $options Encoding options
* @return string
Expand All @@ -344,16 +345,16 @@ public static function prettyPrint($json, $options = array())
$tokens = preg_split('|([\{\}\]\[,])|', $json, -1, PREG_SPLIT_DELIM_CAPTURE);
$result = "";
$indent = 0;

$ind = "\t";
if(isset($options['indent'])) {
$ind = $options['indent'];
}

$inLiteral = false;
foreach($tokens as $token) {
if($token == "") continue;

$prefix = str_repeat($ind, $indent);
if(!$inLiteral && ($token == "{" || $token == "[")) {
$indent++;
Expand All @@ -364,7 +365,7 @@ public static function prettyPrint($json, $options = array())
} else if(!$inLiteral && ($token == "}" || $token == "]")) {
$indent--;
$prefix = str_repeat($ind, $indent);
$result .= "\n$prefix$token";
$result .= "\n$prefix$token";
} else if(!$inLiteral && $token == ",") {
$result .= "$token\n";
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Exception/ErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @package Zend_Json
* @subpackage Server
*/
class ErrorException extends Exception\BadMethodCallException implements
class ErrorException extends Exception\BadMethodCallException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Server/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* @package Zend_Json
* @subpackage Server
*/
class InvalidArgumentException extends Exception\InvalidArgumentException implements
class InvalidArgumentException extends Exception\InvalidArgumentException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Server/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* @package Zend_Json
* @subpackage Server
*/
class RuntimeException extends Exception\RuntimeException implements
class RuntimeException extends Exception\RuntimeException implements
ExceptionInterface
{}
4 changes: 2 additions & 2 deletions src/Server/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ protected function _handle()
if ('function' == $callback->getType()) {
$reflection = new ReflectionFunction( $callback->getFunction() );
} else {
$reflection = new ReflectionMethod(

$reflection = new ReflectionMethod(
$callback->getClass(),
$callback->getMethod()
);
Expand Down
14 changes: 7 additions & 7 deletions test/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -732,15 +732,15 @@ public function testEncodeObjectImplementingIterator()
{
$this->markTestIncomplete('Test is not yet finished.');
}

/**
* @group ZF-8663
*/
public function testNativeJSONEncoderWillProperlyEncodeSolidusInStringValues()
{
$source = "</foo><foo>bar</foo>";
$target = '"\u003C\/foo\u003E\u003Cfoo\u003Ebar\u003C\/foo\u003E"';

// first test ext/json
Json\Json::$useBuiltinEncoderDecoder = false;
$this->assertEquals($target, Json\Json::encode($source));
Expand All @@ -750,20 +750,20 @@ public function testNativeJSONEncoderWillProperlyEncodeHtmlSpecialCharsInStringV
{
$source = "<>&'\"";
$target = '"\u003C\u003E\u0026\u0027\u0022"';

// first test ext/json
Json\Json::$useBuiltinEncoderDecoder = false;
$this->assertEquals($target, Json\Json::encode($source));
}

/**
* @group ZF-8663
*/
public function testBuiltinJSONEncoderWillProperlyEncodeSolidusInStringValues()
{
$source = "</foo><foo>bar</foo>";
$target = '"\u003C\/foo\u003E\u003Cfoo\u003Ebar\u003C\/foo\u003E"';

// first test ext/json
Json\Json::$useBuiltinEncoderDecoder = true;
$this->assertEquals($target, Json\Json::encode($source));
Expand All @@ -773,12 +773,12 @@ public function testBuiltinJSONEncoderWillProperlyEncodeHtmlSpecialCharsInString
{
$source = "<>&'\"";
$target = '"\u003C\u003E\u0026\u0027\u0022"';

// first test ext/json
Json\Json::$useBuiltinEncoderDecoder = true;
$this->assertEquals($target, Json\Json::encode($source));
}

/**
* @group ZF-8918
*/
Expand Down
4 changes: 2 additions & 2 deletions test/JsonXmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ public function testUsingXML7()
/**
* @group ZF-3257
*/
public function testUsingXML8() {

public function testUsingXML8()
{
// Set the XML contents that will be tested here.
$xmlStringContents = <<<EOT
<?xml version="1.0"?>
Expand Down
6 changes: 3 additions & 3 deletions test/Server/Smd/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testConstructorShouldThrowExceptionWhenNoNameSetWhenNullProvided
$this->setExpectedException('Zend\Json\Server\Exception\InvalidArgumentException', 'requires a name');
$service = new Service(null);
}

public function testConstructorShouldThrowExceptionWhenNoNameSetWhenArrayProvided()
{
$this->setExpectedException('Zend\Json\Server\Exception\InvalidArgumentException', 'requires a name');
Expand All @@ -58,7 +58,7 @@ public function testSettingNameShouldThrowExceptionWhenContainingInvalidFormatSt
$this->setExpectedException('Zend\Json\Server\Exception\InvalidArgumentException', 'Invalid name');
$this->service->setName('0ab-?');
}

public function testNameAccessorsShouldWorkWithNormalInput()
{
$this->assertEquals('foo', $this->service->getName());
Expand All @@ -82,7 +82,7 @@ public function testSettingTransportThrowsExceptionWhenSetToRest()
$this->setExpectedException('Zend\Json\Server\Exception\InvalidArgumentException', 'Invalid transport');
$this->service->setTransport('REST');
}

public function testTransportAccessorsShouldWorkUnderNormalInput()
{
$this->service->setTransport('POST');
Expand Down
4 changes: 2 additions & 2 deletions test/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function testHandleShouldAllowNamedParamsInAnyOrder1()
->setReturnResponse(true);
$request = $this->server->getRequest();
$request->setMethod('bar')
->setParams( array(
->setParams( array(
'three' => 3,
'two' => 2,
'one' => 1
Expand All @@ -322,7 +322,7 @@ public function testHandleShouldAllowNamedParamsInAnyOrder2()
->setReturnResponse(true);
$request = $this->server->getRequest();
$request->setMethod('bar')
->setParams( array(
->setParams( array(
'three' => 3,
'one' => 1,
'two' => 2,
Expand Down

0 comments on commit bd53446

Please sign in to comment.