Completed
Push — master ( a9ff63...64b192 )
by Gaetano
06:26 queued 01:55
created
demo/client/introspect.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@  discard block
 block discarded – undo
6 6
 <h3>The code demonstrates usage of multicall and introspection methods</h3>
7 7
 <?php
8 8
 
9
-include_once __DIR__ . "/../../src/Autoloader.php";
9
+include_once __DIR__."/../../src/Autoloader.php";
10 10
 PhpXmlRpc\Autoloader::register();
11 11
 
12 12
 function display_error($r)
13 13
 {
14 14
     print "An error occurred: ";
15
-    print "Code: " . $r->faultCode()
16
-        . " Reason: '" . $r->faultString() . "'<br/>";
15
+    print "Code: ".$r->faultCode()
16
+        . " Reason: '".$r->faultString()."'<br/>";
17 17
 }
18 18
 
19 19
 $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
20 20
 
21 21
 // First off, let's retrieve the list of methods available on the remote server
22
-print "<h3>methods available at http://" . $client->server . $client->path . "</h3>\n";
22
+print "<h3>methods available at http://".$client->server.$client->path."</h3>\n";
23 23
 $req = new PhpXmlRpc\Request('system.listMethods');
24 24
 $resp = $client->send($req);
25 25
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     // Then, retrieve the signature and help text of each available method
32 32
     foreach ($v as $methodName) {
33
-        print "<h4>" . $methodName->scalarval() . "</h4>\n";
33
+        print "<h4>".$methodName->scalarval()."</h4>\n";
34 34
         // build messages first, add params later
35 35
         $m1 = new PhpXmlRpc\Request('system.methodHelp');
36 36
         $m2 = new PhpXmlRpc\Request('system.methodSignature');
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
             if ($val->kindOf() == "array") {
62 62
                 foreach ($val as $x) {
63 63
                     $ret = $x[0];
64
-                    print "<code>" . $ret->scalarval() . " "
65
-                        . $methodName->scalarval() . "(";
66
-                    if ($x->count() > 1) {
67
-                        for ($k = 1; $k < $x->count(); $k++) {
64
+                    print "<code>".$ret->scalarval()." "
65
+                        . $methodName->scalarval()."(";
66
+                    if ($x->count()>1) {
67
+                        for ($k = 1; $k<$x->count(); $k++) {
68 68
                             $y = $x[$k];
69 69
                             print $y->scalarval();
70
-                            if ($k < $x->count() - 1) {
70
+                            if ($k<$x->count()-1) {
71 71
                                 print ", ";
72 72
                             }
73 73
                         }
Please login to merge, or discard this patch.
demo/client/wrap.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 </h3>
13 13
 <?php
14 14
 
15
-include_once __DIR__ . "/../../src/Autoloader.php";
15
+include_once __DIR__."/../../src/Autoloader.php";
16 16
 PhpXmlRpc\Autoloader::register();
17 17
 
18 18
 $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
19 19
 $client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
20 20
 $resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
21 21
 if ($resp->faultCode()) {
22
-    echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n";
22
+    echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n";
23 23
 } else {
24 24
     echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n";
25 25
     flush();
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
         if ($methodName == 'examples.getStateName') {
32 32
             $callable = $wrapper->wrapXmlrpcMethod($client, $methodName);
33 33
             if ($callable) {
34
-                echo "<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n";
34
+                echo "<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n";
35 35
             } else {
36
-                echo "<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n";
36
+                echo "<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n";
37 37
             }
38 38
             break;
39 39
         }
Please login to merge, or discard this patch.
demo/client/agesort.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 <p></p>
11 11
 <?php
12 12
 
13
-include_once __DIR__ . "/../../src/Autoloader.php";
13
+include_once __DIR__."/../../src/Autoloader.php";
14 14
 PhpXmlRpc\Autoloader::register();
15 15
 
16 16
 $inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);
17 17
 print "This is the input data:<br/><pre>";
18
-foreach($inAr as $key => $val) {
19
-    print $key . ", " . $val . "\n";
18
+foreach ($inAr as $key => $val) {
19
+    print $key.", ".$val."\n";
20 20
 }
21 21
 print "</pre>";
22 22
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     );
33 33
 }
34 34
 $v = new PhpXmlRpc\Value($p, "array");
35
-print "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n";
35
+print "Encoded into xmlrpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n";
36 36
 
37 37
 // create client and message objects
38 38
 $req = new PhpXmlRpc\Request('examples.sortByAge', array($v));
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
     foreach ($value as $struct) {
53 53
         $name = $struct["name"];
54 54
         $age = $struct["age"];
55
-        print htmlspecialchars($name->scalarval()) . ", " . htmlspecialchars($age->scalarval()) . "\n";
55
+        print htmlspecialchars($name->scalarval()).", ".htmlspecialchars($age->scalarval())."\n";
56 56
     }
57 57
 
58
-    print "<hr/>For nerds: I got this value back<br/><pre>" .
59
-        htmlentities($resp->serialize()) . "</pre><hr/>\n";
58
+    print "<hr/>For nerds: I got this value back<br/><pre>".
59
+        htmlentities($resp->serialize())."</pre><hr/>\n";
60 60
 } else {
61 61
     print "An error occurred:<pre>";
62
-    print "Code: " . htmlspecialchars($resp->faultCode()) .
63
-        "\nReason: '" . htmlspecialchars($resp->faultString()) . '\'</pre><hr/>';
62
+    print "Code: ".htmlspecialchars($resp->faultCode()).
63
+        "\nReason: '".htmlspecialchars($resp->faultString()).'\'</pre><hr/>';
64 64
 }
65 65
 
66 66
 ?>
Please login to merge, or discard this patch.
demo/client/proxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 <h3>The code demonstrates usage for the terminally lazy. For a more complete proxy, look at at the Wrapper class</h3>
7 7
 <?php
8 8
 
9
-include_once __DIR__ . "/../../src/Autoloader.php";
9
+include_once __DIR__."/../../src/Autoloader.php";
10 10
 PhpXmlRpc\Autoloader::register();
11 11
 
12 12
 class PhpXmlRpcProxy
Please login to merge, or discard this patch.
demo/client/which.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 <h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3>
7 7
 <?php
8 8
 
9
-include_once __DIR__ . "/../../src/Autoloader.php";
9
+include_once __DIR__."/../../src/Autoloader.php";
10 10
 PhpXmlRpc\Autoloader::register();
11 11
 
12 12
 $req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array());
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
     $encoder = new PhpXmlRpc\Encoder();
17 17
     $value = $encoder->decode($resp->value());
18 18
     print "<pre>";
19
-    print "name: " . htmlspecialchars($value["toolkitName"]) . "\n";
20
-    print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n";
21
-    print "docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n";
22
-    print "os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n";
19
+    print "name: ".htmlspecialchars($value["toolkitName"])."\n";
20
+    print "version: ".htmlspecialchars($value["toolkitVersion"])."\n";
21
+    print "docs: ".htmlspecialchars($value["toolkitDocsUrl"])."\n";
22
+    print "os: ".htmlspecialchars($value["toolkitOperatingSystem"])."\n";
23 23
     print "</pre>";
24 24
 } else {
25 25
     print "An error occurred: ";
26
-    print "Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n";
26
+    print "Code: ".htmlspecialchars($resp->faultCode())." Reason: '".htmlspecialchars($resp->faultString())."'\n";
27 27
 }
28 28
 ?>
29 29
 </body>
Please login to merge, or discard this patch.
demo/client/mail.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     method)</p>
21 21
 <?php
22 22
 
23
-include_once __DIR__ . "/../../src/Autoloader.php";
23
+include_once __DIR__."/../../src/Autoloader.php";
24 24
 PhpXmlRpc\Autoloader::register();
25 25
 
26 26
 if (isset($_POST["mailto"]) && $_POST["mailto"]) {
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         print "<fonr color=\"red\">";
45 45
         print "Mail send failed<br/>\n";
46 46
         print "Fault: ";
47
-        print "Code: " . htmlspecialchars($resp->faultCode()) .
48
-            " Reason: '" . htmlspecialchars($resp->faultString()) . "'<br/>";
47
+        print "Code: ".htmlspecialchars($resp->faultCode()).
48
+            " Reason: '".htmlspecialchars($resp->faultString())."'<br/>";
49 49
         print "</font><br/>";
50 50
     }
51 51
 }
Please login to merge, or discard this patch.
demo/client/getstatename.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,34 +8,34 @@
 block discarded – undo
8 8
 <h3>The code demonstrates usage of automatic encoding/decoding of php variables into xmlrpc values</h3>
9 9
 <?php
10 10
 
11
-include_once __DIR__ . "/../../src/Autoloader.php";
11
+include_once __DIR__."/../../src/Autoloader.php";
12 12
 PhpXmlRpc\Autoloader::register();
13 13
 
14 14
 if (isset($_POST["stateno"]) && $_POST["stateno"] != "") {
15
-    $stateNo = (integer)$_POST["stateno"];
15
+    $stateNo = (integer) $_POST["stateno"];
16 16
     $encoder = new PhpXmlRpc\Encoder();
17 17
     $req = new PhpXmlRpc\Request('examples.getStateName',
18 18
         array($encoder->encode($stateNo))
19 19
     );
20
-    print "Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . "\n\n</pre>Debug info of server data follows...\n\n";
20
+    print "Sending the following request:<pre>\n\n".htmlentities($req->serialize())."\n\n</pre>Debug info of server data follows...\n\n";
21 21
     $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
22 22
     $client->setDebug(1);
23 23
     $r = $client->send($req);
24 24
     if (!$r->faultCode()) {
25 25
         $v = $r->value();
26
-        print "<br/>State number <b>" . $stateNo . "</b> is <b>"
27
-            . htmlspecialchars($encoder->decode($v)) . "</b><br/>";
26
+        print "<br/>State number <b>".$stateNo."</b> is <b>"
27
+            . htmlspecialchars($encoder->decode($v))."</b><br/>";
28 28
     } else {
29 29
         print "An error occurred: ";
30
-        print "Code: " . htmlspecialchars($r->faultCode())
31
-            . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
30
+        print "Code: ".htmlspecialchars($r->faultCode())
31
+            . " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>";
32 32
     }
33 33
 } else {
34 34
     $stateNo = "";
35 35
 }
36 36
 
37 37
 print "<form action=\"getstatename.php\" method=\"POST\">
38
-<input name=\"stateno\" value=\"" . $stateNo . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
38
+<input name=\"stateno\" value=\"" . $stateNo."\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
39 39
 <p>Enter a state number to query its name</p>";
40 40
 
41 41
 ?>
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
             $server = $parts['host'];
92 92
             $path = isset($parts['path']) ? $parts['path'] : '';
93 93
             if (isset($parts['query'])) {
94
-                $path .= '?' . $parts['query'];
94
+                $path .= '?'.$parts['query'];
95 95
             }
96 96
             if (isset($parts['fragment'])) {
97
-                $path .= '#' . $parts['fragment'];
97
+                $path .= '#'.$parts['fragment'];
98 98
             }
99 99
             if (isset($parts['port'])) {
100 100
                 $port = $parts['port'];
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
         }
112 112
         if ($path == '' || $path[0] != '/') {
113
-            $this->path = '/' . $path;
113
+            $this->path = '/'.$path;
114 114
         } else {
115 115
             $this->path = $path;
116 116
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         }*/
149 149
 
150 150
         // initialize user_agent string
151
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
151
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
152 152
     }
153 153
 
154 154
     /**
@@ -459,10 +459,10 @@  discard block
 block discarded – undo
459 459
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0,
460 460
                                        $username = '', $password = '', $authType = 1, $proxyHost = '',
461 461
                                        $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
462
-                                       $method='http')
462
+                                       $method = 'http')
463 463
     {
464 464
         if ($port == 0) {
465
-            $port = ( $method === "https" ) ? 443 : 80;
465
+            $port = ($method === "https") ? 443 : 80;
466 466
         }
467 467
 
468 468
         // Only create the payload if it was not created previously
@@ -493,15 +493,15 @@  discard block
 block discarded – undo
493 493
         // thanks to Grant Rauscher <[email protected]> for this
494 494
         $credentials = '';
495 495
         if ($username != '') {
496
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
496
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
497 497
             if ($authType != 1) {
498
-                error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
498
+                error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
499 499
             }
500 500
         }
501 501
 
502 502
         $acceptedEncoding = '';
503 503
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
504
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
504
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
505 505
         }
506 506
 
507 507
         $proxyCredentials = '';
@@ -512,18 +512,18 @@  discard block
 block discarded – undo
512 512
             $connectServer = $proxyHost;
513 513
             $connectPort = $proxyPort;
514 514
             $transport = "tcp";
515
-            $uri = 'http://' . $server . ':' . $port . $this->path;
515
+            $uri = 'http://'.$server.':'.$port.$this->path;
516 516
             if ($proxyUsername != '') {
517 517
                 if ($proxyAuthType != 1) {
518
-                    error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
518
+                    error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
519 519
                 }
520
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
520
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
521 521
             }
522 522
         } else {
523 523
             $connectServer = $server;
524 524
             $connectPort = $port;
525 525
             /// @todo if supporting https, we should support all its current options as well: peer name verification etc...
526
-            $transport = ( $method === "https" ) ? "tls" : "tcp";
526
+            $transport = ($method === "https") ? "tls" : "tcp";
527 527
             $uri = $this->path;
528 528
         }
529 529
 
@@ -534,56 +534,56 @@  discard block
 block discarded – undo
534 534
             $version = '';
535 535
             foreach ($this->cookies as $name => $cookie) {
536 536
                 if ($cookie['version']) {
537
-                    $version = ' $Version="' . $cookie['version'] . '";';
538
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
537
+                    $version = ' $Version="'.$cookie['version'].'";';
538
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
539 539
                     if ($cookie['path']) {
540
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
540
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
541 541
                     }
542 542
                     if ($cookie['domain']) {
543
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
543
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
544 544
                     }
545 545
                     if ($cookie['port']) {
546
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
546
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
547 547
                     }
548 548
                 } else {
549
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
549
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
550 550
                 }
551 551
             }
552
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
552
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
553 553
         }
554 554
 
555 555
         // omit port if 80
556
-        $port = ($port == 80) ? '' : (':' . $port);
557
-
558
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
559
-            'User-Agent: ' . $this->user_agent . "\r\n" .
560
-            'Host: ' . $server . $port . "\r\n" .
561
-            $credentials .
562
-            $proxyCredentials .
563
-            $acceptedEncoding .
564
-            $encodingHdr .
565
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
566
-            $cookieHeader .
567
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
568
-            strlen($payload) . "\r\n\r\n" .
556
+        $port = ($port == 80) ? '' : (':'.$port);
557
+
558
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
559
+            'User-Agent: '.$this->user_agent."\r\n".
560
+            'Host: '.$server.$port."\r\n".
561
+            $credentials.
562
+            $proxyCredentials.
563
+            $acceptedEncoding.
564
+            $encodingHdr.
565
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
566
+            $cookieHeader.
567
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
568
+            strlen($payload)."\r\n\r\n".
569 569
             $payload;
570 570
 
571
-        if ($this->debug > 1) {
571
+        if ($this->debug>1) {
572 572
             Logger::instance()->debugMessage("---SENDING---\n$op\n---END---");
573 573
         }
574 574
 
575
-        if ($timeout > 0) {
575
+        if ($timeout>0) {
576 576
             $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $timeout);
577 577
         } else {
578 578
             $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr);
579 579
         }
580 580
         if ($fp) {
581
-            if ($timeout > 0) {
581
+            if ($timeout>0) {
582 582
                 stream_set_timeout($fp, $timeout);
583 583
             }
584 584
         } else {
585
-            $this->errstr = 'Connect error: ' . $this->errstr;
586
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
585
+            $this->errstr = 'Connect error: '.$this->errstr;
586
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
587 587
 
588 588
             return $r;
589 589
         }
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
             $encodingHdr = '';
725 725
         }
726 726
 
727
-        if ($this->debug > 1) {
727
+        if ($this->debug>1) {
728 728
             Logger::instance()->debugMessage("---SENDING---\n$payload\n---END---");
729 729
         }
730 730
 
731 731
         if (!$keepAlive || !$this->xmlrpc_curl_handle) {
732
-            $curl = curl_init($method . '://' . $server . ':' . $port . $this->path);
732
+            $curl = curl_init($method.'://'.$server.':'.$port.$this->path);
733 733
             if ($keepAlive) {
734 734
                 $this->xmlrpc_curl_handle = $curl;
735 735
             }
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
         // results into variable
741 741
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
742 742
 
743
-        if ($this->debug > 1) {
743
+        if ($this->debug>1) {
744 744
             curl_setopt($curl, CURLOPT_VERBOSE, true);
745 745
             /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
746 746
         }
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
             }
767 767
         }
768 768
         // extra headers
769
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
769
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
770 770
         // if no keepalive is wanted, let the server know it in advance
771 771
         if (!$keepAlive) {
772 772
             $headers[] = 'Connection: close';
@@ -779,15 +779,15 @@  discard block
 block discarded – undo
779 779
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
780 780
         // timeout is borked
781 781
         if ($timeout) {
782
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
782
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
783 783
         }
784 784
 
785 785
         if ($username && $password) {
786
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
786
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
787 787
             if (defined('CURLOPT_HTTPAUTH')) {
788 788
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
789 789
             } elseif ($authType != 1) {
790
-                error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
790
+                error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
791 791
             }
792 792
         }
793 793
 
@@ -828,13 +828,13 @@  discard block
 block discarded – undo
828 828
             if ($proxyPort == 0) {
829 829
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
830 830
             }
831
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
831
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
832 832
             if ($proxyUsername) {
833
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
833
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
834 834
                 if (defined('CURLOPT_PROXYAUTH')) {
835 835
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
836 836
                 } elseif ($proxyAuthType != 1) {
837
-                    error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
837
+                    error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
838 838
                 }
839 839
             }
840 840
         }
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
         if (count($this->cookies)) {
846 846
             $cookieHeader = '';
847 847
             foreach ($this->cookies as $name => $cookie) {
848
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
848
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
849 849
             }
850 850
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
851 851
         }
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 
857 857
         $result = curl_exec($curl);
858 858
 
859
-        if ($this->debug > 1) {
859
+        if ($this->debug>1) {
860 860
             $message = "---CURL INFO---\n";
861 861
             foreach (curl_getinfo($curl) as $name => $val) {
862 862
                 if (is_array($val)) {
863 863
                     $val = implode("\n", $val);
864 864
                 }
865
-                $message .= $name . ': ' . $val . "\n";
865
+                $message .= $name.': '.$val."\n";
866 866
             }
867 867
             $message .= "---END---";
868 868
             Logger::instance()->debugMessage($message);
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
             /// @todo we should use a better check here - what if we get back '' or '0'?
873 873
 
874 874
             $this->errstr = 'no response';
875
-            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
875
+            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
876 876
             curl_close($curl);
877 877
             if ($keepAlive) {
878 878
                 $this->xmlrpc_curl_handle = null;
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
             $call['methodName'] = new Value($req->method(), 'string');
982 982
             $numParams = $req->getNumParams();
983 983
             $params = array();
984
-            for ($i = 0; $i < $numParams; $i++) {
984
+            for ($i = 0; $i<$numParams; $i++) {
985 985
                 $params[$i] = $req->getParam($i);
986 986
             }
987 987
             $call['params'] = new Value($params, 'array');
@@ -1007,15 +1007,15 @@  discard block
 block discarded – undo
1007 1007
             /// @todo test this code branch...
1008 1008
             $rets = $result->value();
1009 1009
             if (!is_array($rets)) {
1010
-                return false;       // bad return type from system.multicall
1010
+                return false; // bad return type from system.multicall
1011 1011
             }
1012 1012
             $numRets = count($rets);
1013 1013
             if ($numRets != count($reqs)) {
1014
-                return false;       // wrong number of return values.
1014
+                return false; // wrong number of return values.
1015 1015
             }
1016 1016
 
1017 1017
             $response = array();
1018
-            for ($i = 0; $i < $numRets; $i++) {
1018
+            for ($i = 0; $i<$numRets; $i++) {
1019 1019
                 $val = $rets[$i];
1020 1020
                 if (!is_array($val)) {
1021 1021
                     return false;
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
                 switch (count($val)) {
1024 1024
                     case 1:
1025 1025
                         if (!isset($val[0])) {
1026
-                            return false;       // Bad value
1026
+                            return false; // Bad value
1027 1027
                         }
1028 1028
                         // Normal return value
1029 1029
                         $response[$i] = new Response($val[0], 0, '', 'phpvals');
@@ -1051,19 +1051,19 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
             $rets = $result->value();
1053 1053
             if ($rets->kindOf() != 'array') {
1054
-                return false;       // bad return type from system.multicall
1054
+                return false; // bad return type from system.multicall
1055 1055
             }
1056 1056
             $numRets = $rets->count();
1057 1057
             if ($numRets != count($reqs)) {
1058
-                return false;       // wrong number of return values.
1058
+                return false; // wrong number of return values.
1059 1059
             }
1060 1060
 
1061 1061
             $response = array();
1062
-            foreach($rets as $val) {
1062
+            foreach ($rets as $val) {
1063 1063
                 switch ($val->kindOf()) {
1064 1064
                     case 'array':
1065 1065
                         if ($val->count() != 1) {
1066
-                            return false;       // Bad value
1066
+                            return false; // Bad value
1067 1067
                         }
1068 1068
                         // Normal return value
1069 1069
                         $response[] = new Response($val[0]);
Please login to merge, or discard this patch.
src/Encoder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 return $xmlrpcVal->scalarval();
73 73
             case 'array':
74 74
                 $arr = array();
75
-                foreach($xmlrpcVal as $value) {
75
+                foreach ($xmlrpcVal as $value) {
76 76
                     $arr[] = $this->decode($value, $options);
77 77
                 }
78 78
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             case 'msg':
103 103
                 $paramCount = $xmlrpcVal->getNumParams();
104 104
                 $arr = array();
105
-                for ($i = 0; $i < $paramCount; $i++) {
105
+                for ($i = 0; $i<$paramCount; $i++) {
106 106
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
107 107
                 }
108 108
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                 break;
204 204
             case 'resource':
205 205
                 if (in_array('extension_api', $options)) {
206
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
206
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
207 207
                 } else {
208 208
                     $xmlrpcVal = new Value();
209 209
                 }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     if (extension_loaded('mbstring')) {
247 247
                         $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding);
248 248
                     } else {
249
-                        error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
249
+                        error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
250 250
                     }
251 251
                 }
252 252
             }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             return false;
279 279
         }
280 280
         xml_parser_free($parser);
281
-        if ($xmlRpcParser->_xh['isf'] > 1) {
281
+        if ($xmlRpcParser->_xh['isf']>1) {
282 282
             // test that $xmlrpc->_xh['value'] is an obj, too???
283 283
 
284 284
             error_log($xmlRpcParser->_xh['isf_reason']);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                 return $r;
300 300
             case 'methodcall':
301 301
                 $req = new Request($xmlRpcParser->_xh['method']);
302
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
302
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
303 303
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
304 304
                 }
305 305
 
Please login to merge, or discard this patch.