Passed
Push — master ( 182ddb...cf05b0 )
by Gaetano
07:26
created
src/Helper/XMLParser.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
             // q: can php be built without ctype? should we use a regexp?
186 186
             if (is_string($key) && !ctype_digit($key)) {
187 187
                 /// @todo on invalid options, throw/error-out instead of logging an error message?
188
-                switch($key) {
188
+                switch ($key) {
189 189
                     case 'target_charset':
190 190
                         if (function_exists('mb_convert_encoding')) {
191 191
                             $this->current_parsing_options['target_charset'] = $val;
192 192
                         } else {
193
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring");
193
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring");
194 194
                         }
195 195
                         break;
196 196
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                         if (is_callable($val)) {
199 199
                             $this->current_parsing_options['methodname_callback'] = $val;
200 200
                         } else {
201
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable");
201
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable");
202 202
                         }
203 203
                         break;
204 204
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                         break;
210 210
 
211 211
                     default:
212
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": unsupported option: $key");
212
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": unsupported option: $key");
213 213
                 }
214 214
                 unset($mergedOptions[$key]);
215 215
             }
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 
256 256
         try {
257 257
             // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors
258
-            for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
258
+            for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
259 259
                 $chunk = substr($data, $offset, $this->maxChunkLength);
260 260
                 // error handling: xml not well formed
261
-                if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
261
+                if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
262 262
                     $errCode = xml_get_error_code($parser);
263 263
                     $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
264 264
                         xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                     $this->_xh['isf_reason'] = $errStr;
268 268
                 }
269 269
                 // no need to parse further if we already have a fatal error
270
-                if ($this->_xh['isf'] >= 2) {
270
+                if ($this->_xh['isf']>=2) {
271 271
                     break;
272 272
                 }
273 273
             }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
306 306
     {
307 307
         // if invalid xml-rpc already detected, skip all processing
308
-        if ($this->_xh['isf'] >= 2) {
308
+        if ($this->_xh['isf']>=2) {
309 309
             return;
310 310
         }
311 311
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             if ($acceptSingleVals === false) {
320 320
                 $accept = $this->current_parsing_options['accept'];
321 321
             } else {
322
-                $this->logDeprecation('Using argument $acceptSingleVals for method ' . __METHOD__ . ' is deprecated');
322
+                $this->logDeprecation('Using argument $acceptSingleVals for method '.__METHOD__.' is deprecated');
323 323
                 $accept = self::ACCEPT_REQUEST | self::ACCEPT_RESPONSE | self::ACCEPT_VALUE;
324 324
             }
325 325
             if (($name == 'METHODCALL' && ($accept & self::ACCEPT_REQUEST)) ||
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                 $this->_xh['rt'] = strtolower($name);
330 330
             } else {
331 331
                 $this->_xh['isf'] = 2;
332
-                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
332
+                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
333 333
 
334 334
                 return;
335 335
             }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
             case 'MEMBER':
433 433
                 // set member name to null, in case we do not find in the xml later on
434
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null;
434
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null;
435 435
                 //$this->_xh['ac']='';
436 436
                 // Drop trough intentionally
437 437
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
      */
495 495
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
496 496
     {
497
-        if ($this->_xh['isf'] >= 2) {
497
+        if ($this->_xh['isf']>=2) {
498 498
             return;
499 499
         }
500 500
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                     $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8');
517 517
                 }
518 518
 
519
-                if ($rebuildXmlrpcvals > 0) {
519
+                if ($rebuildXmlrpcvals>0) {
520 520
                     // build the xml-rpc val out of the data received, and substitute it
521 521
                     $temp = new Value($this->_xh['value'], $this->_xh['vt']);
522 522
                     // in case we got info about underlying php class, save it in the object we're rebuilding
@@ -524,15 +524,15 @@  discard block
 block discarded – undo
524 524
                         $temp->_php_class = $this->_xh['php_class'];
525 525
                     }
526 526
                     $this->_xh['value'] = $temp;
527
-                } elseif ($rebuildXmlrpcvals < 0) {
527
+                } elseif ($rebuildXmlrpcvals<0) {
528 528
                     if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
529
-                        $this->_xh['value'] = (object)array(
529
+                        $this->_xh['value'] = (object) array(
530 530
                             'xmlrpc_type' => 'datetime',
531 531
                             'scalar' => $this->_xh['value'],
532 532
                             'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
533 533
                         );
534 534
                     } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
535
-                        $this->_xh['value'] = (object)array(
535
+                        $this->_xh['value'] = (object) array(
536 536
                             'xmlrpc_type' => 'base64',
537 537
                             'scalar' => $this->_xh['value']
538 538
                         );
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
                 // check if we are inside an array or struct:
548 548
                 // if value just built is inside an array, let's move it into array on the stack
549 549
                 $vscount = count($this->_xh['valuestack']);
550
-                if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
551
-                    $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
550
+                if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
551
+                    $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
552 552
                 }
553 553
                 break;
554 554
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
                     // log if receiving something strange, even though we set the value to false anyway
576 576
                     /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL
577 577
                     if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
578
-                        if (!$this->handleParsingError('invalid data received in BOOLEAN value: ' .
578
+                        if (!$this->handleParsingError('invalid data received in BOOLEAN value: '.
579 579
                             $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
580 580
                             return;
581 581
                         }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 $this->_xh['vt'] = strtolower($name);
596 596
                 $this->_xh['lv'] = 3; // indicate we've found a value
597 597
                 if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) {
598
-                    if (!$this->handleParsingError('non numeric data received in INT value: ' .
598
+                    if (!$this->handleParsingError('non numeric data received in INT value: '.
599 599
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
600 600
                         return;
601 601
                     }
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
604 604
                 } else {
605 605
                     // it's ok, add it on
606
-                    $this->_xh['value'] = (int)$this->_xh['ac'];
606
+                    $this->_xh['value'] = (int) $this->_xh['ac'];
607 607
                 }
608 608
                 break;
609 609
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
                 $this->_xh['vt'] = Value::$xmlrpcDouble;
612 612
                 $this->_xh['lv'] = 3; // indicate we've found a value
613 613
                 if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) {
614
-                    if (!$this->handleParsingError('non numeric data received in DOUBLE value: ' .
614
+                    if (!$this->handleParsingError('non numeric data received in DOUBLE value: '.
615 615
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
616 616
                         return;
617 617
                     }
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
620 620
                 } else {
621 621
                     // it's ok, add it on
622
-                    $this->_xh['value'] = (double)$this->_xh['ac'];
622
+                    $this->_xh['value'] = (double) $this->_xh['ac'];
623 623
                 }
624 624
                 break;
625 625
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
                 $this->_xh['vt'] = Value::$xmlrpcDateTime;
628 628
                 $this->_xh['lv'] = 3; // indicate we've found a value
629 629
                 if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) {
630
-                    if (!$this->handleParsingError('invalid data received in DATETIME value: ' .
630
+                    if (!$this->handleParsingError('invalid data received in DATETIME value: '.
631 631
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
632 632
                         return;
633 633
                     }
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 
639 639
                     // the default regex used to validate the date string a few lines above should make this case impossible,
640 640
                     // but one never knows...
641
-                    } catch(\Exception $e) {
641
+                    } catch (\Exception $e) {
642 642
                         // what to do? We can not guarantee that a valid date can be created. We return null...
643
-                        if (!$this->handleParsingError('invalid data received in DATETIME value. Error ' .
643
+                        if (!$this->handleParsingError('invalid data received in DATETIME value. Error '.
644 644
                             $e->getMessage(), __METHOD__)) {
645 645
                             return;
646 646
                         }
@@ -657,14 +657,14 @@  discard block
 block discarded – undo
657 657
                     $v = base64_decode($this->_xh['ac'], true);
658 658
                     if ($v === false) {
659 659
                         $this->_xh['isf'] = 2;
660
-                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateValueForLog($this->_xh['ac']);
660
+                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateValueForLog($this->_xh['ac']);
661 661
                         return;
662 662
                     }
663 663
                 } else {
664 664
                     $v = base64_decode($this->_xh['ac']);
665 665
                     if ($v === '' && $this->_xh['ac'] !== '') {
666 666
                         // only the empty string should decode to the empty string
667
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' .
667
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '.
668 668
                             $this->truncateValueForLog($this->_xh['ac']));
669 669
                     }
670 670
                 }
@@ -672,20 +672,20 @@  discard block
 block discarded – undo
672 672
                 break;
673 673
 
674 674
             case 'NAME':
675
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
675
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
676 676
                 break;
677 677
 
678 678
             case 'MEMBER':
679 679
                 // add to array in the stack the last element built, unless no VALUE or no NAME were found
680 680
                 if ($this->_xh['vt']) {
681 681
                     $vscount = count($this->_xh['valuestack']);
682
-                    if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) {
682
+                    if ($this->_xh['valuestack'][$vscount-1]['name'] === null) {
683 683
                         if (!$this->handleParsingError('missing NAME inside STRUCT in received xml', __METHOD__)) {
684 684
                             return;
685 685
                         }
686
-                        $this->_xh['valuestack'][$vscount - 1]['name'] = '';
686
+                        $this->_xh['valuestack'][$vscount-1]['name'] = '';
687 687
                     }
688
-                    $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
688
+                    $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
689 689
                 } else {
690 690
                     if (!$this->handleParsingError('missing VALUE inside STRUCT in received xml', __METHOD__)) {
691 691
                         return;
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
     public function xmlrpc_cd($parser, $data)
802 802
     {
803 803
         // skip processing if xml fault already detected
804
-        if ($this->_xh['isf'] >= 2) {
804
+        if ($this->_xh['isf']>=2) {
805 805
             return;
806 806
         }
807 807
 
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
     public function xmlrpc_dh($parser, $data)
824 824
     {
825 825
         // skip processing if xml fault already detected
826
-        if ($this->_xh['isf'] >= 2) {
826
+        if ($this->_xh['isf']>=2) {
827 827
             return;
828 828
         }
829 829
 
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
         // Details:
900 900
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
901 901
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
902
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
903
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
902
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
903
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
904 904
             $xmlChunk, $matches)) {
905 905
             return strtoupper(substr($matches[2], 1, -1));
906 906
         }
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
919 919
             // IANA also likes better US-ASCII, so go with it
920 920
             if ($enc == 'ASCII') {
921
-                $enc = 'US-' . $enc;
921
+                $enc = 'US-'.$enc;
922 922
             }
923 923
 
924 924
             return $enc;
@@ -955,8 +955,8 @@  discard block
 block discarded – undo
955 955
         // Details:
956 956
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
957 957
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
958
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
959
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
958
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
959
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
960 960
             $xmlChunk)) {
961 961
             return true;
962 962
         }
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
             $this->_xh['isf_reason'] = ucfirst($message);
977 977
             return false;
978 978
         } else {
979
-            $this->getLogger()->error('XML-RPC: ' . ($method != '' ? $method . ': ' : '') . $message);
979
+            $this->getLogger()->error('XML-RPC: '.($method != '' ? $method.': ' : '').$message);
980 980
             return true;
981 981
         }
982 982
     }
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
      */
989 989
     protected function truncateValueForLog($data)
990 990
     {
991
-        if (strlen($data) > $this->maxLogValueLength) {
992
-            return substr($data, 0, $this->maxLogValueLength - 3) . '...';
991
+        if (strlen($data)>$this->maxLogValueLength) {
992
+            return substr($data, 0, $this->maxLogValueLength-3).'...';
993 993
         }
994 994
 
995 995
         return $data;
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
     public function xmlrpc_se_any($parser, $name, $attrs)
1011 1011
     {
1012 1012
         // this will be spamming the log if this method is in use...
1013
-        $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated');
1013
+        $this->logDeprecation('Method '.__METHOD__.' is deprecated');
1014 1014
 
1015 1015
         $this->xmlrpc_se($parser, $name, $attrs, true);
1016 1016
     }
@@ -1020,13 +1020,13 @@  discard block
 block discarded – undo
1020 1020
         switch ($name) {
1021 1021
             // this should only ever be called by subclasses which overtook `parse()`
1022 1022
             case 'accept':
1023
-                $this->logDeprecation('Setting property XMLParser::' . $name . ' is deprecated');
1023
+                $this->logDeprecation('Setting property XMLParser::'.$name.' is deprecated');
1024 1024
                 $this->current_parsing_options['accept'] = $value;
1025 1025
                 break;
1026 1026
             default:
1027 1027
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1028 1028
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1029
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1029
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1030 1030
         }
1031 1031
     }
1032 1032
 
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
     {
1035 1035
         switch ($name) {
1036 1036
             case 'accept':
1037
-                $this->logDeprecation('Checking property XMLParser::' . $name . ' is deprecated');
1037
+                $this->logDeprecation('Checking property XMLParser::'.$name.' is deprecated');
1038 1038
                 return isset($this->current_parsing_options['accept']);
1039 1039
             default:
1040 1040
                 return false;
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
         switch ($name) {
1047 1047
             // q: does this make sense at all?
1048 1048
             case 'accept':
1049
-                $this->logDeprecation('Unsetting property XMLParser::' . $name . ' is deprecated');
1049
+                $this->logDeprecation('Unsetting property XMLParser::'.$name.' is deprecated');
1050 1050
                 unset($this->current_parsing_options['accept']);
1051 1051
                 break;
1052 1052
             default:
1053 1053
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1054 1054
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1055
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1055
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1056 1056
         }
1057 1057
     }
1058 1058
 }
Please login to merge, or discard this patch.
src/Traits/DeprecationLogger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
             return;
15 15
         }
16 16
 
17
-        $this->getLogger()->warning('XML-RPC Deprecated: ' . $message);
17
+        $this->getLogger()->warning('XML-RPC Deprecated: '.$message);
18 18
     }
19 19
 
20 20
     /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             return;
35 35
         }
36 36
 
37
-        $this->getLogger()->warning('XML-RPC Deprecated: ' . $trace[1]['class'] . '::' . $trace[1]['function'] .
38
-            ' is only supposed to be called by ' . $expectedCaller);
37
+        $this->getLogger()->warning('XML-RPC Deprecated: '.$trace[1]['class'].'::'.$trace[1]['function'].
38
+            ' is only supposed to be called by '.$expectedCaller);
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
extras/benchmark.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 use PhpXmlRpc\Encoder;
20 20
 
21 21
 /// @todo allow autoloading when the library is installed as dependency
22
-include_once __DIR__ . '/../vendor/autoload.php';
22
+include_once __DIR__.'/../vendor/autoload.php';
23 23
 
24
-include __DIR__ . '/../tests/parse_args.php';
24
+include __DIR__.'/../tests/parse_args.php';
25 25
 $args = argParser::getArgs();
26 26
 
27 27
 function begin_test($test_name, $test_case)
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     if (!isset($test_results[$test_name][$test_case])) {
42 42
         trigger_error('ending test that was not started');
43 43
     }
44
-    $test_results[$test_name][$test_case]['time'] = $end - $test_results[$test_name][$test_case]['time'];
44
+    $test_results[$test_name][$test_case]['time'] = $end-$test_results[$test_name][$test_case]['time'];
45 45
     $test_results[$test_name][$test_case]['result'] = $test_result;
46 46
     echo '.';
47 47
     flush();
@@ -75,24 +75,24 @@  discard block
 block discarded – undo
75 75
 }
76 76
 
77 77
 if ($is_web) {
78
-    echo "<h3>Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "</h3>\n";
78
+    echo "<h3>Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."</h3>\n";
79 79
     if ($xd) {
80
-        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: " . htmlspecialchars(xdebug_get_profiler_filename()) . "</h4>\n";
80
+        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n";
81 81
     }
82 82
     flush();
83 83
     ob_flush();
84 84
 } else {
85
-    echo "Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "\n";
85
+    echo "Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."\n";
86 86
     if ($xd) {
87
-        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: " . xdebug_get_profiler_filename() . "\n";
87
+        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: ".xdebug_get_profiler_filename()."\n";
88 88
     }
89 89
 }
90 90
 
91 91
 // test 'manual style' data encoding vs. 'automatic style' encoding
92 92
 begin_test('Data encoding (large array)', 'manual encoding');
93
-for ($i = 0; $i < $num_tests; $i++) {
93
+for ($i = 0; $i<$num_tests; $i++) {
94 94
     $vals = array();
95
-    for ($j = 0; $j < 10; $j++) {
95
+    for ($j = 0; $j<10; $j++) {
96 96
         $valarray = array();
97 97
         foreach ($data[$j] as $key => $val) {
98 98
             $values = array();
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 begin_test('Data encoding (large array)', 'automatic encoding');
119 119
 $encoder = new Encoder();
120
-for ($i = 0; $i < $num_tests; $i++) {
120
+for ($i = 0; $i<$num_tests; $i++) {
121 121
     $value = $encoder->encode($data, array('auto_dates'));
122 122
     $out = $value->serialize();
123 123
 }
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 if (function_exists('xmlrpc_set_type')) {
127 127
     begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
128
-    for ($i = 0; $i < $num_tests; $i++) {
129
-        for ($j = 0; $j < 10; $j++) {
128
+    for ($i = 0; $i<$num_tests; $i++) {
129
+        for ($j = 0; $j<10; $j++) {
130 130
             foreach ($keys as $k) {
131 131
                 xmlrpc_set_type($data[$j][$k][4], 'datetime');
132 132
                 xmlrpc_set_type($data[$j][$k][8], 'datetime');
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 // test 'old style' data decoding vs. 'automatic style' decoding
141 141
 $dummy = new Request('');
142 142
 $out = new Response($value);
143
-$in = '<?xml version="1.0" ?>' . "\n" . $out->serialize();
143
+$in = '<?xml version="1.0" ?>'."\n".$out->serialize();
144 144
 
145 145
 begin_test('Data decoding (large array)', 'manual decoding');
146
-for ($i = 0; $i < $num_tests; $i++) {
146
+for ($i = 0; $i<$num_tests; $i++) {
147 147
     $response = $dummy->ParseResponse($in, true);
148 148
     $value = $response->value();
149 149
     $result = array();
150
-    foreach($value as $val1) {
150
+    foreach ($value as $val1) {
151 151
         $out = array();
152
-        foreach($val1 as $name => $val) {
152
+        foreach ($val1 as $name => $val) {
153 153
             $out[$name] = array();
154
-            foreach($val as $data) {
154
+            foreach ($val as $data) {
155 155
                 $out[$name][] = $data->scalarVal();
156 156
             }
157 157
         }
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
 end_test('Data decoding (large array)', 'manual decoding', $result);
162 162
 
163 163
 begin_test('Data decoding (large array)', 'manual decoding deprecated');
164
-for ($i = 0; $i < $num_tests; $i++) {
164
+for ($i = 0; $i<$num_tests; $i++) {
165 165
     $response = $dummy->ParseResponse($in, true);
166 166
     $value = $response->value();
167 167
     $result = array();
168 168
     $l = $value->arraySize();
169
-    for ($k = 0; $k < $l; $k++) {
169
+    for ($k = 0; $k<$l; $k++) {
170 170
         $val1 = $value->arrayMem($k);
171 171
         $out = array();
172
-        foreach($val1 as $name => $val) {
172
+        foreach ($val1 as $name => $val) {
173 173
             $out[$name] = array();
174 174
             $m = $val->arraySize();
175
-            for ($j = 0; $j < $m; $j++) {
175
+            for ($j = 0; $j<$m; $j++) {
176 176
                 $data = $val->arrayMem($j);
177 177
                 $out[$name][] = $data->scalarVal();
178 178
             }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 end_test('Data decoding (large array)', 'manual decoding deprecated', $result);
184 184
 
185 185
 begin_test('Data decoding (large array)', 'automatic decoding');
186
-for ($i = 0; $i < $num_tests; $i++) {
186
+for ($i = 0; $i<$num_tests; $i++) {
187 187
     $response = $dummy->parseResponse($in, true, 'phpvals');
188 188
     $value = $response->value();
189 189
 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 if (function_exists('xmlrpc_decode')) {
193 193
     begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
194
-    for ($i = 0; $i < $num_tests; $i++) {
194
+    for ($i = 0; $i<$num_tests; $i++) {
195 195
         $response = $dummy->parseResponse($in, true, 'xml');
196 196
         $value = xmlrpc_decode($response->value());
197 197
     }
@@ -208,16 +208,16 @@  discard block
 block discarded – undo
208 208
     $value = $encoder->encode($data1, array('auto_dates'));
209 209
     $req = new Request('interopEchoTests.echoValue', array($value));
210 210
     $reqs = array();
211
-    for ($i = 0; $i < $num_tests; $i++) {
211
+    for ($i = 0; $i<$num_tests; $i++) {
212 212
         $reqs[] = $req;
213 213
     }
214 214
 
215 215
     $server = explode(':', $args['HTTPSERVER']);
216
-    if (count($server) > 1) {
217
-        $srv = 'http://' . $server[0] . '://' . $server[1] . $args['HTTPURI'];
216
+    if (count($server)>1) {
217
+        $srv = 'http://'.$server[0].'://'.$server[1].$args['HTTPURI'];
218 218
         $c = new Client($args['HTTPURI'], $server[0], $server[1]);
219 219
     } else {
220
-        $srv = 'http://' . $args['HTTPSERVER'] . $args['HTTPURI'];
220
+        $srv = 'http://'.$args['HTTPSERVER'].$args['HTTPURI'];
221 221
         $c = new Client($args['HTTPURI'], $args['HTTPSERVER']);
222 222
     }
223 223
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
     begin_test($testName, 'http 10');
231 231
     $response = array();
232
-    for ($i = 0; $i < $num_tests; $i++) {
232
+    for ($i = 0; $i<$num_tests; $i++) {
233 233
         $resp = $c->send($req);
234 234
         $response[] = $resp->value();
235 235
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $c->keepalive = false;
240 240
         begin_test($testName, 'http 11 no keepalive');
241 241
         $response = array();
242
-        for ($i = 0; $i < $num_tests; $i++) {
242
+        for ($i = 0; $i<$num_tests; $i++) {
243 243
             $resp = $c->send($req, 10, 'http11');
244 244
             $response[] = $resp->value();
245 245
         }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
         begin_test($testName, 'http 11 w. keep-alive');
249 249
         $response = array();
250
-        for ($i = 0; $i < $num_tests; $i++) {
250
+        for ($i = 0; $i<$num_tests; $i++) {
251 251
             $resp = $c->send($req, 10, 'http11');
252 252
             $response[] = $resp->value();
253 253
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         begin_test($testName, 'http 10 w. compression');
271 271
         $response = array();
272
-        for ($i = 0; $i < $num_tests; $i++) {
272
+        for ($i = 0; $i<$num_tests; $i++) {
273 273
             $resp = $c->send($req);
274 274
             $response[] = $resp->value();
275 275
         }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             $c->keepalive = false;
280 280
             begin_test($testName, 'http 11 w. compression and no keepalive');
281 281
             $response = array();
282
-            for ($i = 0; $i < $num_tests; $i++) {
282
+            for ($i = 0; $i<$num_tests; $i++) {
283 283
                 $resp = $c->send($req, 10, 'http11');
284 284
                 $response[] = $resp->value();
285 285
             }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
             $c->keepalive = true;
289 289
             begin_test($testName, 'http 11 w. keep-alive and compression');
290 290
             $response = array();
291
-            for ($i = 0; $i < $num_tests; $i++) {
291
+            for ($i = 0; $i<$num_tests; $i++) {
292 292
                 $resp = $c->send($req, 10, 'http11');
293 293
                 $response[] = $resp->value();
294 294
             }
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
         /// test multicall vs. many calls vs. keep-alives - HTTPS
310 310
 
311 311
         $server = explode(':', $args['HTTPSSERVER']);
312
-        if (count($server) > 1) {
313
-            $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI'];
312
+        if (count($server)>1) {
313
+            $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI'];
314 314
             $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https');
315 315
         } else {
316
-            $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI'];
316
+            $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI'];
317 317
             $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'https');
318 318
         }
319 319
         $c->setSSLVerifyPeer(!$args['HTTPSIGNOREPEER']);
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         begin_test($testName, 'https no keep-alive');
328 328
         $c->keepalive = false;
329 329
         $response = array();
330
-        for ($i = 0; $i < $num_tests; $i++) {
330
+        for ($i = 0; $i<$num_tests; $i++) {
331 331
             $resp = $c->send($req);
332 332
             $response[] = $resp->value();
333 333
         }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         begin_test($testName, 'https w. keep-alive');
337 337
         $c->keepalive = true;
338 338
         $response = array();
339
-        for ($i = 0; $i < $num_tests; $i++) {
339
+        for ($i = 0; $i<$num_tests; $i++) {
340 340
             $resp = $c->send($req, 10);
341 341
             $response[] = $resp->value();
342 342
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             $c->keepalive = false;
358 358
             begin_test($testName, 'https w. compression and no keepalive');
359 359
             $response = array();
360
-            for ($i = 0; $i < $num_tests; $i++) {
360
+            for ($i = 0; $i<$num_tests; $i++) {
361 361
                 $resp = $c->send($req);
362 362
                 $response[] = $resp->value();
363 363
             }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $c->keepalive = true;
367 367
             begin_test($testName, 'https w. keep-alive and compression');
368 368
             $response = array();
369
-            for ($i = 0; $i < $num_tests; $i++) {
369
+            for ($i = 0; $i<$num_tests; $i++) {
370 370
                 $resp = $c->send($req, 10);
371 371
                 $response[] = $resp->value();
372 372
             }
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
         /// test multicall vs. many calls vs. keep-alives - HTTP/2
388 388
 
389 389
         $server = explode(':', $args['HTTPSSERVER']);
390
-        if (count($server) > 1) {
391
-            $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI'];
390
+        if (count($server)>1) {
391
+            $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI'];
392 392
             $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https');
393 393
         } else {
394
-            $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI'];
394
+            $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI'];
395 395
             $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'h2');
396 396
         }
397 397
         $c->setSSLVerifyPeer(!$args['HTTPSIGNOREPEER']);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         begin_test($testName, 'http2 no keep-alive');
406 406
         $c->keepalive = false;
407 407
         $response = array();
408
-        for ($i = 0; $i < $num_tests; $i++) {
408
+        for ($i = 0; $i<$num_tests; $i++) {
409 409
             $resp = $c->send($req);
410 410
             $response[] = $resp->value();
411 411
         }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         begin_test($testName, 'http2 w. keep-alive');
415 415
         $c->keepalive = true;
416 416
         $response = array();
417
-        for ($i = 0; $i < $num_tests; $i++) {
417
+        for ($i = 0; $i<$num_tests; $i++) {
418 418
             $resp = $c->send($req, 10);
419 419
             $response[] = $resp->value();
420 420
         }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             $c->keepalive = false;
436 436
             begin_test($testName, 'http2 w. compression and no keepalive');
437 437
             $response = array();
438
-            for ($i = 0; $i < $num_tests; $i++) {
438
+            for ($i = 0; $i<$num_tests; $i++) {
439 439
                 $resp = $c->send($req);
440 440
                 $response[] = $resp->value();
441 441
             }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             $c->keepalive = true;
445 445
             begin_test($testName, 'http2 w. keep-alive and compression');
446 446
             $response = array();
447
-            for ($i = 0; $i < $num_tests; $i++) {
447
+            for ($i = 0; $i<$num_tests; $i++) {
448 448
                 $resp = $c->send($req, 10);
449 449
                 $response[] = $resp->value();
450 450
             }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 foreach ($test_results as $test => $results) {
467 467
     echo "\nTEST: $test\n";
468 468
     foreach ($results as $case => $data) {
469
-        echo "  $case: {$data['time']} secs - Output data CRC: " . crc32(serialize($data['result'])) . "\n";
469
+        echo "  $case: {$data['time']} secs - Output data CRC: ".crc32(serialize($data['result']))."\n";
470 470
     }
471 471
 }
472 472
 
Please login to merge, or discard this patch.