Passed
Push — master ( 3fbb2c...cdd150 )
by Gaetano
07:31
created
src/Value.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                     $this->me['struct'] = $val;
88 88
                     break;
89 89
                 default:
90
-                    Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
90
+                    Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)");
91 91
             }
92 92
         }
93 93
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         if ($typeOf !== 1) {
115
-            Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
115
+            Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
116 116
             return 0;
117 117
         }
118 118
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 
130 130
         switch ($this->mytype) {
131 131
             case 1:
132
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
132
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
133 133
                 return 0;
134 134
             case 3:
135
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
135
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
136 136
                 return 0;
137 137
             case 2:
138 138
                 // we're adding a scalar value to an array here
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
             return 1;
176 176
         } else {
177
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
177
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
178 178
             return 0;
179 179
         }
180 180
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
             return 1;
207 207
         } else {
208
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
208
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
209 209
             return 0;
210 210
         }
211 211
     }
@@ -241,19 +241,19 @@  discard block
 block discarded – undo
241 241
             case 1:
242 242
                 switch ($typ) {
243 243
                     case static::$xmlrpcBase64:
244
-                        $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>";
244
+                        $rs .= "<${typ}>".base64_encode($val)."</${typ}>";
245 245
                         break;
246 246
                     case static::$xmlrpcBoolean:
247
-                        $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
247
+                        $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>";
248 248
                         break;
249 249
                     case static::$xmlrpcString:
250 250
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
251
-                        $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>";
251
+                        $rs .= "<${typ}>".Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>";
252 252
                         break;
253 253
                     case static::$xmlrpcInt:
254 254
                     case static::$xmlrpcI4:
255 255
                     case static::$xmlrpcI8:
256
-                        $rs .= "<${typ}>" . (int)$val . "</${typ}>";
256
+                        $rs .= "<${typ}>".(int) $val."</${typ}>";
257 257
                         break;
258 258
                     case static::$xmlrpcDouble:
259 259
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -261,15 +261,15 @@  discard block
 block discarded – undo
261 261
                         // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
262 262
                         // The code below tries its best at keeping max precision while avoiding exp notation,
263 263
                         // but there is of course no limit in the number of decimal places to be used...
264
-                        $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</${typ}>";
264
+                        $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</${typ}>";
265 265
                         break;
266 266
                     case static::$xmlrpcDateTime:
267 267
                         if (is_string($val)) {
268 268
                             $rs .= "<${typ}>${val}</${typ}>";
269 269
                         } elseif (is_a($val, 'DateTime')) {
270
-                            $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>";
270
+                            $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
271 271
                         } elseif (is_int($val)) {
272
-                            $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>";
272
+                            $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>";
273 273
                         } else {
274 274
                             // not really a good idea here: but what shall we output anyway? left for backward compat...
275 275
                             $rs .= "<${typ}>${val}</${typ}>";
@@ -291,14 +291,14 @@  discard block
 block discarded – undo
291 291
             case 3:
292 292
                 // struct
293 293
                 if ($this->_php_class) {
294
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
294
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
295 295
                 } else {
296 296
                     $rs .= "<struct>\n";
297 297
                 }
298 298
                 $charsetEncoder = Charset::instance();
299 299
                 /** @var Value $val2 */
300 300
                 foreach ($val as $key2 => $val2) {
301
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
301
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
302 302
                     //$rs.=$this->serializeval($val2);
303 303
                     $rs .= $val2->serialize($charsetEncoding);
304 304
                     $rs .= "</member>\n";
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         $val = reset($this->me);
335 335
         $typ = key($this->me);
336 336
 
337
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
337
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
338 338
     }
339 339
 
340 340
     /**
Please login to merge, or discard this patch.
src/Encoder.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
                                 'scalar' => $val,
47 47
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val)
48 48
                             );
49
-                            return (object)$xmlrpcVal;
49
+                            return (object) $xmlrpcVal;
50 50
                         case 'base64':
51 51
                             $xmlrpcVal = array(
52 52
                                 'xmlrpc_type' => 'base64',
53 53
                                 'scalar' => $val
54 54
                             );
55
-                            return (object)$xmlrpcVal;
55
+                            return (object) $xmlrpcVal;
56 56
                         default:
57 57
                             return $xmlrpcVal->scalarval();
58 58
                     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 return $xmlrpcVal->scalarval();
78 78
             case 'array':
79 79
                 $arr = array();
80
-                foreach($xmlrpcVal as $value) {
80
+                foreach ($xmlrpcVal as $value) {
81 81
                     $arr[] = $this->decode($value, $options);
82 82
                 }
83 83
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             case 'msg':
108 108
                 $paramCount = $xmlrpcVal->getNumParams();
109 109
                 $arr = array();
110
-                for ($i = 0; $i < $paramCount; $i++) {
110
+                for ($i = 0; $i<$paramCount; $i++) {
111 111
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
112 112
                 }
113 113
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
                 } else {
202 202
                     $arr = array();
203
-                    foreach($phpVal as $k => $v) {
203
+                    foreach ($phpVal as $k => $v) {
204 204
                         $arr[$k] = $this->encode($v, $options);
205 205
                     }
206 206
                     $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                 break;
223 223
             case 'resource':
224 224
                 if (in_array('extension_api', $options)) {
225
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
225
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
226 226
                 } else {
227 227
                     $xmlrpcVal = new Value();
228 228
                 }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                     if (extension_loaded('mbstring')) {
271 271
                         $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding);
272 272
                     } else {
273
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
273
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
274 274
                     }
275 275
                 }
276 276
             }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $xmlRpcParser = new XMLParser($options);
287 287
         $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE | XMLParser::ACCEPT_FAULT);
288 288
 
289
-        if ($xmlRpcParser->_xh['isf'] > 1) {
289
+        if ($xmlRpcParser->_xh['isf']>1) {
290 290
             // test that $xmlrpc->_xh['value'] is an obj, too???
291 291
 
292 292
             Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']);
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                 return $r;
311 311
             case 'methodcall':
312 312
                 $req = new Request($xmlRpcParser->_xh['method']);
313
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
313
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
314 314
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
315 315
                 }
316 316
 
Please login to merge, or discard this patch.