Passed
Push — master ( c803c8...b166f8 )
by Gaetano
05:21
created
src/Helper/XMLParser.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
         foreach ($mergedOptions as $key => $val) {
183 183
             // q: can php be built without ctype? should we use a regexp?
184 184
             if (is_string($key) && !ctype_digit($key)) {
185
-                switch($key) {
185
+                switch ($key) {
186 186
                     case 'target_charset':
187 187
                         if (function_exists('mb_convert_encoding')) {
188 188
                             $this->current_parsing_options['target_charset'] = $val;
189 189
                         } else {
190
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring");
190
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring");
191 191
                         }
192 192
                         break;
193 193
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                             //$this->_xh['isf'] = 4;
199 199
                             //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable";
200 200
                             //return;
201
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable");
201
+                            $this->getLogger()->errorLog('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()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key");
212
+                        $this->getLogger()->errorLog('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));
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                     break;
269 269
                 }
270 270
                 // no need to parse further if we already have a fatal error
271
-                if ($this->_xh['isf'] >= 2) {
271
+                if ($this->_xh['isf']>=2) {
272 272
                     break;
273 273
                 }
274 274
             }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
301 301
     {
302 302
         // if invalid xml-rpc already detected, skip all processing
303
-        if ($this->_xh['isf'] >= 2) {
303
+        if ($this->_xh['isf']>=2) {
304 304
             return;
305 305
         }
306 306
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                 $this->_xh['rt'] = strtolower($name);
324 324
             } else {
325 325
                 $this->_xh['isf'] = 2;
326
-                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
326
+                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
327 327
 
328 328
                 return;
329 329
             }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             case 'MEMBER':
427 427
                 // set member name to null, in case we do not find in the xml later on
428 428
                 /// @todo we could reject structs missing a NAME in the MEMBER element
429
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = '';
429
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = '';
430 430
                 //$this->_xh['ac']='';
431 431
                 // Drop trough intentionally
432 432
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
      */
499 499
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
500 500
     {
501
-        if ($this->_xh['isf'] >= 2) {
501
+        if ($this->_xh['isf']>=2) {
502 502
             return;
503 503
 
504 504
         }
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
                     $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8');
521 521
                 }
522 522
 
523
-                if ($rebuildXmlrpcvals > 0) {
523
+                if ($rebuildXmlrpcvals>0) {
524 524
                     // build the xml-rpc val out of the data received, and substitute it
525 525
                     $temp = new Value($this->_xh['value'], $this->_xh['vt']);
526 526
                     // in case we got info about underlying php class, save it in the object we're rebuilding
@@ -528,15 +528,15 @@  discard block
 block discarded – undo
528 528
                         $temp->_php_class = $this->_xh['php_class'];
529 529
                     }
530 530
                     $this->_xh['value'] = $temp;
531
-                } elseif ($rebuildXmlrpcvals < 0) {
531
+                } elseif ($rebuildXmlrpcvals<0) {
532 532
                     if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
533
-                        $this->_xh['value'] = (object)array(
533
+                        $this->_xh['value'] = (object) array(
534 534
                             'xmlrpc_type' => 'datetime',
535 535
                             'scalar' => $this->_xh['value'],
536 536
                             'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
537 537
                         );
538 538
                     } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
539
-                        $this->_xh['value'] = (object)array(
539
+                        $this->_xh['value'] = (object) array(
540 540
                             'xmlrpc_type' => 'base64',
541 541
                             'scalar' => $this->_xh['value']
542 542
                         );
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
                 // check if we are inside an array or struct:
552 552
                 // if value just built is inside an array, let's move it into array on the stack
553 553
                 $vscount = count($this->_xh['valuestack']);
554
-                if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
555
-                    $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
554
+                if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
555
+                    $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
556 556
                 }
557 557
                 break;
558 558
 
@@ -579,11 +579,11 @@  discard block
 block discarded – undo
579 579
                     // log if receiving something strange, even though we set the value to false anyway
580 580
                     /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL
581 581
                     if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
582
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' . $this->_xh['ac']);
582
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '.$this->_xh['ac']);
583 583
                         if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
584 584
                         {
585 585
                             $this->_xh['isf'] = 2;
586
-                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->_xh['ac'];
586
+                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->_xh['ac'];
587 587
                             return;
588 588
                         }
589 589
                     }
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
                 $this->_xh['vt'] = strtolower($name);
603 603
                 $this->_xh['lv'] = 3; // indicate we've found a value
604 604
                 if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) {
605
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' . $this->_xh['ac']);
605
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in INT: '.$this->_xh['ac']);
606 606
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
607 607
                     {
608 608
                         $this->_xh['isf'] = 2;
609
-                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->_xh['ac'];
609
+                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->_xh['ac'];
610 610
                         return;
611 611
                     }
612 612
                     /// @todo: find a better way of reporting an error value than this! Use NaN?
613 613
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
614 614
                 } else {
615 615
                     // it's ok, add it on
616
-                    $this->_xh['value'] = (int)$this->_xh['ac'];
616
+                    $this->_xh['value'] = (int) $this->_xh['ac'];
617 617
                 }
618 618
                 break;
619 619
 
@@ -621,18 +621,18 @@  discard block
 block discarded – undo
621 621
                 $this->_xh['vt'] = Value::$xmlrpcDouble;
622 622
                 $this->_xh['lv'] = 3; // indicate we've found a value
623 623
                 if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) {
624
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' . $this->_xh['ac']);
624
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '.$this->_xh['ac']);
625 625
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
626 626
                     {
627 627
                         $this->_xh['isf'] = 2;
628
-                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' . $this->_xh['ac'];
628
+                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '.$this->_xh['ac'];
629 629
                         return;
630 630
                     }
631 631
 
632 632
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
633 633
                 } else {
634 634
                     // it's ok, add it on
635
-                    $this->_xh['value'] = (double)$this->_xh['ac'];
635
+                    $this->_xh['value'] = (double) $this->_xh['ac'];
636 636
                 }
637 637
                 break;
638 638
 
@@ -640,20 +640,20 @@  discard block
 block discarded – undo
640 640
                 $this->_xh['vt'] = Value::$xmlrpcDateTime;
641 641
                 $this->_xh['lv'] = 3; // indicate we've found a value
642 642
                 if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) {
643
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' . $this->_xh['ac']);
643
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '.$this->_xh['ac']);
644 644
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
645 645
                     {
646 646
                         $this->_xh['isf'] = 2;
647
-                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->_xh['ac'];
647
+                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->_xh['ac'];
648 648
                         return;
649 649
                     }
650 650
                 }
651 651
                 if ($this->current_parsing_options['xmlrpc_return_datetimes']) {
652 652
                     try {
653 653
                         $this->_xh['value'] = new \DateTime($this->_xh['ac']);
654
-                    } catch(\Exception $e) {
654
+                    } catch (\Exception $e) {
655 655
                         // q: what to do? we can not guarantee that a valid date can be created. Return null or throw?
656
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage());
656
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': '.$e->getMessage());
657 657
                         $this->_xh['value'] = null;
658 658
                     }
659 659
                 } else {
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                 if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
668 668
                     $v = base64_decode($this->_xh['ac'], true);
669 669
                     if ($v === false) {
670
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value');
670
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value');
671 671
                         $this->_xh['isf'] = 2;
672 672
                         $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value';
673 673
                         return;
@@ -676,14 +676,14 @@  discard block
 block discarded – undo
676 676
                     $v = base64_decode($this->_xh['ac']);
677 677
                     if ($v === '' && $this->_xh['ac'] !== '') {
678 678
                         // only the empty string should decode to the empty string
679
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value');
679
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value');
680 680
                     }
681 681
                 }
682 682
                 $this->_xh['value'] = $v;
683 683
                 break;
684 684
 
685 685
             case 'NAME':
686
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
686
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
687 687
                 break;
688 688
 
689 689
             case 'MEMBER':
@@ -693,14 +693,14 @@  discard block
 block discarded – undo
693 693
                     // NB: atm we always initialize members with an empty name in xmlrpc__ee, so no need for this check.
694 694
                     // We could make parsing stricter though...
695 695
                     //if (isset($this->_xh['valuestack'][$vscount - 1]['name'])) {
696
-                        $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
696
+                        $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
697 697
                     //} else {
698 698
                     //    /// @todo return a parsing error if $this->current_parsing_options['xmlrpc_reject_invalid_values']?
699 699
                     //    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml');
700 700
                     //}
701 701
                 } else {
702 702
                     /// @todo return a parsing error $this->current_parsing_options['xmlrpc_reject_invalid_values']?
703
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml');
703
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml');
704 704
                 }
705 705
                 break;
706 706
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
                     $this->_xh['pt'][] = $this->_xh['vt'];
727 727
                 } else {
728 728
                     /// @todo return a parsing error? esp. if if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
729
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml');
729
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml');
730 730
                 }
731 731
                 break;
732 732
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
     public function xmlrpc_cd($parser, $data)
806 806
     {
807 807
         // skip processing if xml fault already detected
808
-        if ($this->_xh['isf'] >= 2) {
808
+        if ($this->_xh['isf']>=2) {
809 809
             return;
810 810
         }
811 811
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
     public function xmlrpc_dh($parser, $data)
828 828
     {
829 829
         // skip processing if xml fault already detected
830
-        if ($this->_xh['isf'] >= 2) {
830
+        if ($this->_xh['isf']>=2) {
831 831
             return;
832 832
         }
833 833
 
@@ -901,8 +901,8 @@  discard block
 block discarded – undo
901 901
         // Details:
902 902
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
903 903
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
904
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
905
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
904
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
905
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
906 906
             $xmlChunk, $matches)) {
907 907
             return strtoupper(substr($matches[2], 1, -1));
908 908
         }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
921 921
             // IANA also likes better US-ASCII, so go with it
922 922
             if ($enc == 'ASCII') {
923
-                $enc = 'US-' . $enc;
923
+                $enc = 'US-'.$enc;
924 924
             }
925 925
 
926 926
             return $enc;
@@ -957,8 +957,8 @@  discard block
 block discarded – undo
957 957
         // Details:
958 958
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
959 959
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
960
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
961
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
960
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
961
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
962 962
             $xmlChunk)) {
963 963
             return true;
964 964
         }
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
                 break;
979 979
             default:
980 980
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
981
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
981
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
982 982
         }
983 983
     }
984 984
 
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
                 break;
1003 1003
             default:
1004 1004
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1005
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1005
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1006 1006
         }
1007 1007
     }
1008 1008
 }
Please login to merge, or discard this patch.
tests/11DebuggerTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for the bundled debugger.
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
         $this->args = argParser::getArgs();
13 13
 
14 14
         // assumes HTTPURI to be in the form /tests/index.php?etc...
15
-        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
16
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
15
+        $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']);
16
+        $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
17 17
     }
18 18
 
19 19
     public function testIndex()
Please login to merge, or discard this patch.
tests/WebTestCase.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/parse_args.php';
3
+include_once __DIR__.'/parse_args.php';
4 4
 
5
-include_once __DIR__ . '/PolyfillTestCase.php';
5
+include_once __DIR__.'/PolyfillTestCase.php';
6 6
 
7 7
 use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
8 8
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function _run($result = NULL)
27 27
     {
28
-        $this->testId = get_class($this) . '__' . $this->getName();
28
+        $this->testId = get_class($this).'__'.$this->getName();
29 29
 
30 30
         if ($result === NULL) {
31 31
             $result = $this->createResult();
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected function request($path, $method = 'GET', $payload = '', $emptyPageOk = false)
62 62
     {
63
-        $url = $this->baseUrl . $path;
63
+        $url = $this->baseUrl.$path;
64 64
 
65 65
         $ch = curl_init($url);
66 66
         curl_setopt_array($ch, array(
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         {
79 79
             curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID='.$this->testId);
80 80
         }
81
-        if ($this->args['DEBUG'] > 0) {
81
+        if ($this->args['DEBUG']>0) {
82 82
             curl_setopt($ch, CURLOPT_VERBOSE, 1);
83 83
         }
84 84
         $page = curl_exec($ch);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
     protected function getClient($path)
98 98
     {
99
-        $client = new xmlrpc_client($this->baseUrl . $path);
99
+        $client = new xmlrpc_client($this->baseUrl.$path);
100 100
         if ($this->collectCodeCoverageInformation) {
101 101
             $client->setCookie('PHPUNIT_SELENIUM_TEST_ID', $this->testId);
102 102
         }
Please login to merge, or discard this patch.
tests/10DemofilesTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for php files in the 'demo' directory.
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
         $this->args = argParser::getArgs();
15 15
 
16 16
         // assumes HTTPURI to be in the form /tests/index.php?etc...
17
-        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
18
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
17
+        $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']);
18
+        $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
19 19
     }
20 20
 
21 21
     public function testVardemo()
Please login to merge, or discard this patch.
demo/vardemo.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/client/_prepend.php";
2
+require_once __DIR__."/client/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc</title></head>
@@ -10,25 +10,25 @@  discard block
 block discarded – undo
10 10
 output("<p>Please note that in most cases you are better off using `new PhpXmlRpc\Encoder()->encode()` to create nested Value objects</p>\n");
11 11
 
12 12
 $v = new PhpXmlRpc\Value(1234, 'int');
13
-output("Int: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
13
+output("Int: <PRE>".htmlentities($v->serialize())."</PRE>");
14 14
 
15 15
 $v = new PhpXmlRpc\Value('Are the following characters escaped? < & >');
16
-output("String <PRE>" . htmlentities($v->serialize()) . "</PRE>");
16
+output("String <PRE>".htmlentities($v->serialize())."</PRE>");
17 17
 
18 18
 $v = new PhpXmlRpc\Value(true, 'boolean');
19
-output("Boolean: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
19
+output("Boolean: <PRE>".htmlentities($v->serialize())."</PRE>");
20 20
 
21 21
 $v = new PhpXmlRpc\Value(1234.5678, 'double');
22
-output("Double: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
22
+output("Double: <PRE>".htmlentities($v->serialize())."</PRE>");
23 23
 
24 24
 $v = new PhpXmlRpc\Value(time(), 'dateTime.iso8601');
25
-output("Datetime (from timestamp): <PRE>" . htmlentities($v->serialize()) . "</PRE>");
25
+output("Datetime (from timestamp): <PRE>".htmlentities($v->serialize())."</PRE>");
26 26
 $v = new PhpXmlRpc\Value(new DateTime(), 'dateTime.iso8601');
27
-output("Datetime (from php DateTime): <PRE>" . htmlentities($v->serialize()) . "</PRE>");
27
+output("Datetime (from php DateTime): <PRE>".htmlentities($v->serialize())."</PRE>");
28 28
 
29 29
 $v = new PhpXmlRpc\Value('hello world', 'base64');
30
-output("Base64: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
31
-output("(value of base64 string is: '" . $v->scalarval() . "')<BR><BR>");
30
+output("Base64: <PRE>".htmlentities($v->serialize())."</PRE>");
31
+output("(value of base64 string is: '".$v->scalarval()."')<BR><BR>");
32 32
 
33 33
 $v = new PhpXmlRpc\Value(
34 34
     array(
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     ),
42 42
     "array"
43 43
 );
44
-output("Array: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
44
+output("Array: <PRE>".htmlentities($v->serialize())."</PRE>");
45 45
 
46 46
 $v = new PhpXmlRpc\Value(
47 47
     array(
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
     ),
62 62
     "struct"
63 63
 );
64
-output("Struct: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
64
+output("Struct: <PRE>".htmlentities($v->serialize())."</PRE>");
65 65
 
66 66
 $w = new PhpXmlRpc\Value(array($v), 'array');
67
-output("Array containing a struct: <PRE>" . htmlentities($w->serialize()) . "</PRE>");
67
+output("Array containing a struct: <PRE>".htmlentities($w->serialize())."</PRE>");
68 68
 
69 69
 class MyClass
70 70
 {
@@ -76,49 +76,49 @@  discard block
 block discarded – undo
76 76
 // the public property is the only one which will be serialized. As such, it has to be of type Value
77 77
 $myObject->public = new \PhpXmlRpc\Value('a public property, wrapped');
78 78
 $w = new PhpXmlRpc\Value($myObject, 'struct');
79
-output("Struct encoding a php object: <PRE>" . htmlentities($w->serialize()) . "</PRE>");
79
+output("Struct encoding a php object: <PRE>".htmlentities($w->serialize())."</PRE>");
80 80
 
81 81
 output("<h3>Testing value serialization - xml-rpc extensions</h3>\n");
82 82
 $v = new PhpXmlRpc\Value(1234, 'i8');
83
-output("I8: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
83
+output("I8: <PRE>".htmlentities($v->serialize())."</PRE>");
84 84
 $v = new PhpXmlRpc\Value(null, 'null');
85
-output("Null: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
85
+output("Null: <PRE>".htmlentities($v->serialize())."</PRE>");
86 86
 \PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_apache_encoding = true;
87
-output("Null, alternative: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
87
+output("Null, alternative: <PRE>".htmlentities($v->serialize())."</PRE>");
88 88
 
89 89
 output("<h3>Testing value serialization - character encoding</h3>\n");
90 90
 // The greek word 'kosme'
91 91
 $v = new PhpXmlRpc\Value('κόσμε');
92
-output("Greek (default encoding): <PRE>" . htmlentities($v->serialize()) . "</PRE>");
93
-output("Greek (utf8 encoding): <PRE>" . htmlentities($v->serialize('UTF-8')) . "</PRE>");
92
+output("Greek (default encoding): <PRE>".htmlentities($v->serialize())."</PRE>");
93
+output("Greek (utf8 encoding): <PRE>".htmlentities($v->serialize('UTF-8'))."</PRE>");
94 94
 if (function_exists('mb_convert_encoding')) {
95
-    output("Greek (ISO-8859-7 encoding): <PRE>" . htmlentities($v->serialize('ISO-8859-7')) . "</PRE>");
95
+    output("Greek (ISO-8859-7 encoding): <PRE>".htmlentities($v->serialize('ISO-8859-7'))."</PRE>");
96 96
 }
97 97
 
98 98
 output("<h3>Testing request serialization</h3>\n");
99 99
 $req = new PhpXmlRpc\Request('examples.getStateName');
100 100
 $req->method('examples.getStateName');
101 101
 $req->addParam(new PhpXmlRpc\Value(42, 'int'));
102
-output("<PRE>" . htmlentities($req->serialize()) . "</PRE>");
102
+output("<PRE>".htmlentities($req->serialize())."</PRE>");
103 103
 
104 104
 output("<h3>Testing response serialization</h3>\n");
105 105
 $resp = new PhpXmlRpc\Response(new PhpXmlRpc\Value('The meaning of life'));
106
-output("<PRE>" . htmlentities($resp->serialize()) . "</PRE>");
106
+output("<PRE>".htmlentities($resp->serialize())."</PRE>");
107 107
 
108 108
 output("<h3>Testing ISO date formatting</h3><pre>\n");
109 109
 $t = time();
110 110
 $date = PhpXmlRpc\Helper\Date::iso8601Encode($t);
111 111
 output("Now is $t --> $date\n");
112
-output("Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n");
112
+output("Or in UTC, that is ".PhpXmlRpc\Helper\Date::iso8601Encode($t, 1)."\n");
113 113
 $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date);
114 114
 output("That is to say $date --> $tb\n");
115
-output("Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n");
116
-output("Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1) . "\n");
115
+output("Which comes out at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb)."\n");
116
+output("Which was the time in UTC at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1)."\n");
117 117
 output("</pre>\n");
118 118
 
119 119
 output("<h3>Testing reduced-precision formatting for doubles</h3><pre>\n");
120 120
 $v = new PhpXmlRpc\Value(1234.56789, 'double');
121 121
 \PhpXmlRpc\PhpXmlRpc::$xmlpc_double_precision = 2;
122
-output("Double, limited precision: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
122
+output("Double, limited precision: <PRE>".htmlentities($v->serialize())."</PRE>");
123 123
 
124 124
 output('</body></html>');
Please login to merge, or discard this patch.
demo/server/methodProviders/wrapper.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function plain_findstate($stateNo)
28 28
 {
29
-     if (isset(exampleMethods::$stateNames[$stateNo - 1])) {
30
-        return exampleMethods::$stateNames[$stateNo - 1];
29
+     if (isset(exampleMethods::$stateNames[$stateNo-1])) {
30
+        return exampleMethods::$stateNames[$stateNo-1];
31 31
     } else {
32 32
         // not, there so complain
33
-        throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
33
+        throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
34 34
     }
35 35
 }
36 36
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if ($req->getNumParams()) {
70 70
             $p1 = $req->getParam(0);
71 71
             if ($p1->kindOf() === 'scalar') {
72
-                $errNum = (int)$p1->scalarval();
72
+                $errNum = (int) $p1->scalarval();
73 73
             }
74 74
         }
75 75
         throw new Exception("it's just a test", $errNum);
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 
142 142
 $findstate10_sig = array(
143 143
     /// @todo add a demo and test with closure usage
144
-    "function" => function ($req) { return exampleMethods::findState($req); },
144
+    "function" => function($req) { return exampleMethods::findState($req); },
145 145
     "signature" => array(array(Value::$xmlrpcString, Value::$xmlrpcInt)),
146
-    "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the ' .
146
+    "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the '.
147 147
         'index of that state name in an alphabetic order.',
148 148
 );
149 149
 
150
-$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return plain_findstate($stateNo); });
150
+$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return plain_findstate($stateNo); });
151 151
 
152 152
 /// @todo do we really need a new instance ?
153 153
 $c = new handlersContainer();
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 $namespaceSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'namespacetest.', 'replace_class_name' => true, 'method_filter' => '/^findState$/', 'method_type' => 'static'));
158 158
 
159
-$returnObj_sig =  $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
159
+$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
160 160
 
161 161
 return array_merge(
162 162
     array(
Please login to merge, or discard this patch.