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

Commit 5656ff4

Browse files
committed
CS fixes
1 parent 0a85a72 commit 5656ff4

19 files changed

+68
-68
lines changed

src/AbstractValue.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function getType()
9292
*/
9393
public static function getGenerator()
9494
{
95-
if (!static::$generator) {
95+
if (! static::$generator) {
9696
if (extension_loaded('xmlwriter')) {
9797
static::$generator = new Generator\XmlWriter();
9898
} else {
@@ -142,7 +142,7 @@ abstract public function getValue();
142142
*/
143143
public function saveXml()
144144
{
145-
if (!$this->xml) {
145+
if (! $this->xml) {
146146
$this->generateXml();
147147
$this->xml = (string) $this->getGenerator();
148148
}
@@ -244,7 +244,7 @@ public static function getXmlRpcTypeByValue($value)
244244
}
245245
return static::getXmlRpcTypeByValue(get_object_vars($value));
246246
} elseif (is_array($value)) {
247-
if (!empty($value) && is_array($value) && (array_keys($value) !== range(0, count($value) - 1))) {
247+
if (! empty($value) && is_array($value) && (array_keys($value) !== range(0, count($value) - 1))) {
248248
return self::XMLRPC_TYPE_STRUCT;
249249
}
250250
return self::XMLRPC_TYPE_ARRAY;
@@ -393,7 +393,7 @@ protected static function xmlStringToNativeXmlRpc($xml)
393393
foreach ($value->member as $member) {
394394
// @todo? If a member doesn't have a <value> tag, we don't add it to the struct
395395
// Maybe we want to throw an exception here ?
396-
if (!isset($member->value) or !isset($member->name)) {
396+
if (! isset($member->value) or ! isset($member->name)) {
397397
continue;
398398
}
399399
$values[(string) $member->name] = static::xmlStringToNativeXmlRpc($member->value);
@@ -442,7 +442,7 @@ protected static function extractTypeAndValue(\SimpleXMLElement $xml, &$type, &$
442442
// Casting is necessary to work with strict-typed systems
443443
$xmlAsArray = (array) $xml;
444444
list($type, $value) = each($xmlAsArray);
445-
if (!$type and $value === null) {
445+
if (! $type and $value === null) {
446446
$namespaces = ['ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions'];
447447
foreach ($namespaces as $namespaceName => $namespaceUri) {
448448
$namespaceXml = $xml->children($namespaceUri);
@@ -456,7 +456,7 @@ protected static function extractTypeAndValue(\SimpleXMLElement $xml, &$type, &$
456456
}
457457

458458
// If no type was specified, the default is string
459-
if (!$type) {
459+
if (! $type) {
460460
$type = self::XMLRPC_TYPE_STRING;
461461
if (empty($value) and preg_match('#^<value>.*</value>$#', $xml->asXML())) {
462462
$value = str_replace(['<value>', '</value>'], '', $xml->asXML());

src/Client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@ public function doRequest($request, $response = null)
210210
'Accept: text/xml',
211211
]);
212212

213-
if (!$headers->get('user-agent')) {
213+
if (! $headers->get('user-agent')) {
214214
$headers->addHeaderLine('user-agent', 'Zend_XmlRpc_Client');
215215
}
216216

217217
$xml = $this->lastRequest->__toString();
218218
$http->setRawBody($xml);
219219
$httpResponse = $http->setMethod('POST')->send();
220220

221-
if (!$httpResponse->isSuccess()) {
221+
if (! $httpResponse->isSuccess()) {
222222
/**
223223
* Exception thrown when an HTTP error occurs
224224
*/
@@ -246,7 +246,7 @@ public function doRequest($request, $response = null)
246246
*/
247247
public function call($method, $params = [])
248248
{
249-
if (!$this->skipSystemLookup() && ('system.' != substr($method, 0, 7))) {
249+
if (! $this->skipSystemLookup() && ('system.' != substr($method, 0, 7))) {
250250
// Ensure empty array/struct params are cast correctly
251251
// If system.* methods are not available, bypass. (ZF-2978)
252252
$success = true;
@@ -269,7 +269,7 @@ public function call($method, $params = [])
269269
AbstractValue::XMLRPC_TYPE_STRUCT,
270270
];
271271

272-
if (!is_array($params)) {
272+
if (! is_array($params)) {
273273
$params = [$params];
274274
}
275275
foreach ($params as $key => $param) {
@@ -280,7 +280,7 @@ public function call($method, $params = [])
280280
if (count($signatures) > 1) {
281281
$type = AbstractValue::getXmlRpcTypeByValue($param);
282282
foreach ($signatures as $signature) {
283-
if (!is_array($signature)) {
283+
if (! is_array($signature)) {
284284
continue;
285285
}
286286
if (isset($signature['parameters'][$key])) {
@@ -295,7 +295,7 @@ public function call($method, $params = [])
295295
$type = null;
296296
}
297297

298-
if (empty($type) || !in_array($type, $validTypes)) {
298+
if (empty($type) || ! in_array($type, $validTypes)) {
299299
$type = AbstractValue::AUTO_DETECT_TYPE;
300300
}
301301

src/Client/ServerIntrospection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function getSignatureForEachMethodByLooping($methods = null)
127127
public function getMethodSignature($method)
128128
{
129129
$signature = $this->system->methodSignature($method);
130-
if (!is_array($signature)) {
130+
if (! is_array($signature)) {
131131
$error = 'Invalid signature for method "' . $method . '"';
132132
throw new Exception\IntrospectException($error);
133133
}

src/Client/ServerProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(XMLRPCClient $client, $namespace = '')
5454
public function __get($namespace)
5555
{
5656
$namespace = ltrim("$this->namespace.$namespace", '.');
57-
if (!isset($this->cache[$namespace])) {
57+
if (! isset($this->cache[$namespace])) {
5858
$this->cache[$namespace] = new $this($this->client, $namespace);
5959
}
6060
return $this->cache[$namespace];

src/Fault.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function getEncoding()
177177
*/
178178
public function loadXml($fault)
179179
{
180-
if (!is_string($fault)) {
180+
if (! is_string($fault)) {
181181
throw new Exception\InvalidArgumentException('Invalid XML provided to fault');
182182
}
183183

@@ -188,7 +188,7 @@ public function loadXml($fault)
188188
// Unsecure XML
189189
throw new Exception\RuntimeException('Failed to parse XML fault: ' . $e->getMessage(), 500, $e);
190190
}
191-
if (!$xml instanceof SimpleXMLElement) {
191+
if (! $xml instanceof SimpleXMLElement) {
192192
$errors = libxml_get_errors();
193193
$errors = array_reduce($errors, function ($result, $item) {
194194
if (empty($result)) {
@@ -202,12 +202,12 @@ public function loadXml($fault)
202202
libxml_use_internal_errors($xmlErrorsFlag);
203203

204204
// Check for fault
205-
if (!$xml->fault) {
205+
if (! $xml->fault) {
206206
// Not a fault
207207
return false;
208208
}
209209

210-
if (!$xml->fault->value->struct) {
210+
if (! $xml->fault->value->struct) {
211211
// not a proper fault
212212
throw new Exception\InvalidArgumentException('Invalid fault structure', 500);
213213
}

src/Request.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function getEncoding()
116116
*/
117117
public function setMethod($method)
118118
{
119-
if (!is_string($method) || !preg_match('/^[a-z0-9_.:\\\\\/]+$/i', $method)) {
119+
if (! is_string($method) || ! preg_match('/^[a-z0-9_.:\\\\\/]+$/i', $method)) {
120120
$this->fault = new Fault(634, 'Invalid method name ("' . $method . '")');
121121
$this->fault->setEncoding($this->getEncoding());
122122
return false;
@@ -196,13 +196,13 @@ public function setParams()
196196
$types = [];
197197
$wellFormed = true;
198198
foreach ($argv[0] as $arg) {
199-
if (!is_array($arg) || !isset($arg['value'])) {
199+
if (! is_array($arg) || ! isset($arg['value'])) {
200200
$wellFormed = false;
201201
break;
202202
}
203203
$params[] = $arg['value'];
204204

205-
if (!isset($arg['type'])) {
205+
if (! isset($arg['type'])) {
206206
$xmlRpcValue = AbstractValue::getXmlRpcValue($arg['value']);
207207
$arg['type'] = $xmlRpcValue->getType();
208208
}
@@ -276,7 +276,7 @@ public function getTypes()
276276
*/
277277
public function loadXml($request)
278278
{
279-
if (!is_string($request)) {
279+
if (! is_string($request)) {
280280
$this->fault = new Fault(635);
281281
$this->fault->setEncoding($this->getEncoding());
282282
return false;
@@ -308,7 +308,7 @@ public function loadXml($request)
308308
libxml_use_internal_errors($xmlErrorsFlag);
309309
return false;
310310
}
311-
if (!$xml instanceof SimpleXMLElement || $error) {
311+
if (! $xml instanceof SimpleXMLElement || $error) {
312312
// Not valid XML
313313
$this->fault = new Fault(631);
314314
$this->fault->setEncoding($this->getEncoding());
@@ -327,11 +327,11 @@ public function loadXml($request)
327327
$this->method = (string) $xml->methodName;
328328

329329
// Check for parameters
330-
if (!empty($xml->params)) {
330+
if (! empty($xml->params)) {
331331
$types = [];
332332
$argv = [];
333333
foreach ($xml->params->children() as $param) {
334-
if (!isset($param->value)) {
334+
if (! isset($param->value)) {
335335
$this->fault = new Fault(633);
336336
$this->fault->setEncoding($this->getEncoding());
337337
return false;
@@ -391,7 +391,7 @@ protected function getXmlRpcParams()
391391
$value = $param['value'];
392392
$type = $param['type'] ?: AbstractValue::AUTO_DETECT_TYPE;
393393

394-
if (!$value instanceof AbstractValue) {
394+
if (! $value instanceof AbstractValue) {
395395
$value = AbstractValue::getXmlRpcValue($value, $type);
396396
}
397397
$params[] = $value;

src/Request/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct()
4747
ErrorHandler::start();
4848
$xml = file_get_contents('php://input');
4949
ErrorHandler::stop();
50-
if (!$xml) {
50+
if (! $xml) {
5151
$this->fault = new Fault(630);
5252
return;
5353
}

src/Request/Stdin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class Stdin extends XmlRpcRequest
3838
public function __construct()
3939
{
4040
$fh = fopen('php://stdin', 'r');
41-
if (!$fh) {
41+
if (! $fh) {
4242
$this->fault = new Fault(630);
4343
return;
4444
}
4545

4646
$xml = '';
47-
while (!feof($fh)) {
47+
while (! feof($fh)) {
4848
$xml .= fgets($fh);
4949
}
5050
fclose($fh);

src/Response.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function getFault()
147147
*/
148148
public function loadXml($response)
149149
{
150-
if (!is_string($response)) {
150+
if (! is_string($response)) {
151151
$this->fault = new Fault(650);
152152
$this->fault->setEncoding($this->getEncoding());
153153
return false;
@@ -161,7 +161,7 @@ public function loadXml($response)
161161
return false;
162162
}
163163

164-
if (!empty($xml->fault)) {
164+
if (! empty($xml->fault)) {
165165
// fault response
166166
$this->fault = new Fault();
167167
$this->fault->setEncoding($this->getEncoding());
@@ -177,7 +177,7 @@ public function loadXml($response)
177177
}
178178

179179
try {
180-
if (!isset($xml->params) || !isset($xml->params->param) || !isset($xml->params->param->value)) {
180+
if (! isset($xml->params) || ! isset($xml->params->param) || ! isset($xml->params->param->value)) {
181181
throw new Exception\ValueException('Missing XML-RPC value in XML');
182182
}
183183
$valueXml = $xml->params->param->value->asXML();

src/Response/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Http extends XmlRpcResponse
2323
*/
2424
public function __toString()
2525
{
26-
if (!headers_sent()) {
26+
if (! headers_sent()) {
2727
header('Content-Type: text/xml; charset=' . strtolower($this->getEncoding()));
2828
}
2929

0 commit comments

Comments
 (0)