@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | 'scalar' => $val, |
77 | 77 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
78 | 78 | ); |
79 | - return (object)$xmlrpcVal; |
|
79 | + return (object) $xmlrpcVal; |
|
80 | 80 | case 'base64': |
81 | 81 | $xmlrpcVal = array( |
82 | 82 | 'xmlrpc_type' => 'base64', |
83 | 83 | 'scalar' => $val |
84 | 84 | ); |
85 | - return (object)$xmlrpcVal; |
|
85 | + return (object) $xmlrpcVal; |
|
86 | 86 | case 'string': |
87 | 87 | if (isset($options['extension_api_encoding'])) { |
88 | 88 | $dval = @iconv('UTF-8', $options['extension_api_encoding'], $val); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | case 'array': |
118 | 118 | $arr = array(); |
119 | - foreach($xmlrpcVal as $value) { |
|
119 | + foreach ($xmlrpcVal as $value) { |
|
120 | 120 | $arr[] = $this->decode($value, $options); |
121 | 121 | } |
122 | 122 | return $arr; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | case 'msg': |
146 | 146 | $paramCount = $xmlrpcVal->getNumParams(); |
147 | 147 | $arr = array(); |
148 | - for ($i = 0; $i < $paramCount; $i++) { |
|
148 | + for ($i = 0; $i<$paramCount; $i++) { |
|
149 | 149 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
150 | 150 | } |
151 | 151 | return $arr; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | } else { |
241 | 241 | $arr = array(); |
242 | - foreach($phpVal as $k => $v) { |
|
242 | + foreach ($phpVal as $k => $v) { |
|
243 | 243 | $arr[$k] = $this->encode($v, $options); |
244 | 244 | } |
245 | 245 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | break; |
262 | 262 | case 'resource': |
263 | 263 | if (in_array('extension_api', $options)) { |
264 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
264 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
265 | 265 | } else { |
266 | 266 | $xmlrpcVal = new Value(); |
267 | 267 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | if (extension_loaded('mbstring')) { |
310 | 310 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
311 | 311 | } else { |
312 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
312 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $parserOptions |
332 | 332 | ); |
333 | 333 | |
334 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
334 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
335 | 335 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
336 | 336 | |
337 | 337 | $this->getLogger()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | case 'methodcall': |
357 | 357 | $req = new Request($xmlRpcParser->_xh['method']); |
358 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
358 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
359 | 359 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
360 | 360 | } |
361 | 361 | return $req; |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function buildConversionTable($tableName) |
65 | 65 | { |
66 | - switch($tableName) { |
|
66 | + switch ($tableName) { |
|
67 | 67 | case 'xml_iso88591_Entities': |
68 | 68 | if (count($this->xml_iso88591_Entities['in'])) { |
69 | 69 | return; |
70 | 70 | } |
71 | - for ($i = 0; $i < 32; $i++) { |
|
71 | + for ($i = 0; $i<32; $i++) { |
|
72 | 72 | $this->xml_iso88591_Entities["in"][] = chr($i); |
73 | 73 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
74 | 74 | } |
75 | 75 | |
76 | 76 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
77 | 77 | |
78 | - for ($i = 160; $i < 256; $i++) { |
|
78 | + for ($i = 160; $i<256; $i++) { |
|
79 | 79 | $this->xml_iso88591_Entities["in"][] = chr($i); |
80 | 80 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
81 | 81 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | break;*/ |
104 | 104 | |
105 | 105 | default: |
106 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
106 | + throw new \Exception('Unsupported table: '.$tableName); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $destEncoding = 'US-ASCII'; |
147 | 147 | } |
148 | 148 | |
149 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
149 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
150 | 150 | |
151 | 151 | // list ordered with (expected) most common scenarios first |
152 | 152 | switch ($conversion) { |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
165 | 165 | $escapedData = ''; |
166 | 166 | // be kind to users creating string xmlrpc values out of different php types |
167 | - $data = (string)$data; |
|
167 | + $data = (string) $data; |
|
168 | 168 | $ns = strlen($data); |
169 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
169 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
170 | 170 | $ch = $data[$nn]; |
171 | 171 | $ii = ord($ch); |
172 | 172 | // 7 bits in 1 byte: 0bbbbbbb (127) |
173 | - if ($ii < 32) { |
|
173 | + if ($ii<32) { |
|
174 | 174 | if ($conversion == 'UTF-8_US-ASCII') { |
175 | 175 | $escapedData .= sprintf('&#%d;', $ii); |
176 | 176 | } else { |
177 | 177 | $escapedData .= $ch; |
178 | 178 | } |
179 | 179 | } |
180 | - else if ($ii < 128) { |
|
180 | + else if ($ii<128) { |
|
181 | 181 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
182 | 182 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
183 | 183 | switch ($ii) { |
@@ -202,25 +202,25 @@ discard block |
||
202 | 202 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
203 | 203 | elseif ($ii >> 5 == 6) { |
204 | 204 | $b1 = ($ii & 31); |
205 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
206 | - $ii = ($b1 * 64) + $b2; |
|
205 | + $b2 = (ord($data[$nn+1]) & 63); |
|
206 | + $ii = ($b1 * 64)+$b2; |
|
207 | 207 | $escapedData .= sprintf('&#%d;', $ii); |
208 | 208 | $nn += 1; |
209 | 209 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
210 | 210 | elseif ($ii >> 4 == 14) { |
211 | 211 | $b1 = ($ii & 15); |
212 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
213 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
214 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
212 | + $b2 = (ord($data[$nn+1]) & 63); |
|
213 | + $b3 = (ord($data[$nn+2]) & 63); |
|
214 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
215 | 215 | $escapedData .= sprintf('&#%d;', $ii); |
216 | 216 | $nn += 2; |
217 | 217 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
218 | 218 | elseif ($ii >> 3 == 30) { |
219 | 219 | $b1 = ($ii & 7); |
220 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
221 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
222 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
223 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
220 | + $b2 = (ord($data[$nn+1]) & 63); |
|
221 | + $b3 = (ord($data[$nn+2]) & 63); |
|
222 | + $b4 = (ord($data[$nn+3]) & 63); |
|
223 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
224 | 224 | $escapedData .= sprintf('&#%d;', $ii); |
225 | 225 | $nn += 3; |
226 | 226 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | default: |
270 | 270 | $escapedData = ''; |
271 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
271 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | return $escapedData; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | case 'iso88591': |
323 | 323 | return $this->xml_iso88591_Entities; |
324 | 324 | default: |
325 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
325 | + throw new \Exception('Unsupported charset: '.$charset); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
@@ -176,8 +176,7 @@ |
||
176 | 176 | } else { |
177 | 177 | $escapedData .= $ch; |
178 | 178 | } |
179 | - } |
|
180 | - else if ($ii < 128) { |
|
179 | + } else if ($ii < 128) { |
|
181 | 180 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
182 | 181 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
183 | 182 | switch ($ii) { |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | $server = $parts['host']; |
152 | 152 | $path = isset($parts['path']) ? $parts['path'] : ''; |
153 | 153 | if (isset($parts['query'])) { |
154 | - $path .= '?' . $parts['query']; |
|
154 | + $path .= '?'.$parts['query']; |
|
155 | 155 | } |
156 | 156 | if (isset($parts['fragment'])) { |
157 | - $path .= '#' . $parts['fragment']; |
|
157 | + $path .= '#'.$parts['fragment']; |
|
158 | 158 | } |
159 | 159 | if (isset($parts['port'])) { |
160 | 160 | $port = $parts['port']; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | if ($path == '' || $path[0] != '/') { |
173 | - $this->path = '/' . $path; |
|
173 | + $this->path = '/'.$path; |
|
174 | 174 | } else { |
175 | 175 | $this->path = $path; |
176 | 176 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | }*/ |
209 | 209 | |
210 | 210 | // initialize user_agent string |
211 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
211 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | */ |
582 | 582 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
583 | 583 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
584 | - $method='http') |
|
584 | + $method = 'http') |
|
585 | 585 | { |
586 | 586 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
587 | 587 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param int $sslVersion |
614 | 614 | * @return Response |
615 | 615 | */ |
616 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
616 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
617 | 617 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
618 | 618 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
619 | 619 | $sslVersion = 0) |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | */ |
651 | 651 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
652 | 652 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
653 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
653 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
654 | 654 | $sslVersion = 0) |
655 | 655 | { |
656 | 656 | if ($port == 0) { |
657 | - $port = ( $method === 'https' ) ? 443 : 80; |
|
657 | + $port = ($method === 'https') ? 443 : 80; |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | // Only create the payload if it was not created previously |
@@ -684,15 +684,15 @@ discard block |
||
684 | 684 | // thanks to Grant Rauscher <[email protected]> for this |
685 | 685 | $credentials = ''; |
686 | 686 | if ($username != '') { |
687 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
687 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
688 | 688 | if ($authType != 1) { |
689 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
689 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | |
693 | 693 | $acceptedEncoding = ''; |
694 | 694 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
695 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
695 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | $proxyCredentials = ''; |
@@ -703,17 +703,17 @@ discard block |
||
703 | 703 | $connectServer = $proxyHost; |
704 | 704 | $connectPort = $proxyPort; |
705 | 705 | $transport = 'tcp'; |
706 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
706 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
707 | 707 | if ($proxyUsername != '') { |
708 | 708 | if ($proxyAuthType != 1) { |
709 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
709 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
710 | 710 | } |
711 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
711 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
712 | 712 | } |
713 | 713 | } else { |
714 | 714 | $connectServer = $server; |
715 | 715 | $connectPort = $port; |
716 | - $transport = ( $method === 'https' ) ? 'tls' : 'tcp'; |
|
716 | + $transport = ($method === 'https') ? 'tls' : 'tcp'; |
|
717 | 717 | $uri = $this->path; |
718 | 718 | } |
719 | 719 | |
@@ -723,45 +723,45 @@ discard block |
||
723 | 723 | $version = ''; |
724 | 724 | foreach ($this->cookies as $name => $cookie) { |
725 | 725 | if ($cookie['version']) { |
726 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
727 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
726 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
727 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
728 | 728 | if ($cookie['path']) { |
729 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
729 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
730 | 730 | } |
731 | 731 | if ($cookie['domain']) { |
732 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
732 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
733 | 733 | } |
734 | 734 | if ($cookie['port']) { |
735 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
735 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
736 | 736 | } |
737 | 737 | } else { |
738 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
738 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
739 | 739 | } |
740 | 740 | } |
741 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
741 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | // omit port if default |
745 | 745 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
746 | - $port = ''; |
|
746 | + $port = ''; |
|
747 | 747 | } else { |
748 | - $port = ':' . $port; |
|
748 | + $port = ':'.$port; |
|
749 | 749 | } |
750 | 750 | |
751 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
752 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
753 | - 'Host: ' . $server . $port . "\r\n" . |
|
754 | - $credentials . |
|
755 | - $proxyCredentials . |
|
756 | - $acceptedEncoding . |
|
757 | - $encodingHdr . |
|
758 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
759 | - $cookieHeader . |
|
760 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
761 | - strlen($payload) . "\r\n\r\n" . |
|
751 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
752 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
753 | + 'Host: '.$server.$port."\r\n". |
|
754 | + $credentials. |
|
755 | + $proxyCredentials. |
|
756 | + $acceptedEncoding. |
|
757 | + $encodingHdr. |
|
758 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
759 | + $cookieHeader. |
|
760 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
761 | + strlen($payload)."\r\n\r\n". |
|
762 | 762 | $payload; |
763 | 763 | |
764 | - if ($this->debug > 1) { |
|
764 | + if ($this->debug>1) { |
|
765 | 765 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
766 | 766 | } |
767 | 767 | |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | } |
788 | 788 | $context = stream_context_create($contextOptions); |
789 | 789 | |
790 | - if ($timeout <= 0) { |
|
790 | + if ($timeout<=0) { |
|
791 | 791 | $connectTimeout = ini_get('default_socket_timeout'); |
792 | 792 | } else { |
793 | 793 | $connectTimeout = $timeout; |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
800 | 800 | STREAM_CLIENT_CONNECT, $context); |
801 | 801 | if ($fp) { |
802 | - if ($timeout > 0) { |
|
802 | + if ($timeout>0) { |
|
803 | 803 | stream_set_timeout($fp, $timeout); |
804 | 804 | } |
805 | 805 | } else { |
@@ -807,8 +807,8 @@ discard block |
||
807 | 807 | $err = error_get_last(); |
808 | 808 | $this->errstr = $err['message']; |
809 | 809 | } |
810 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
811 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
810 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
811 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
812 | 812 | |
813 | 813 | return $r; |
814 | 814 | } |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | $encodingHdr = ''; |
916 | 916 | } |
917 | 917 | |
918 | - if ($this->debug > 1) { |
|
918 | + if ($this->debug>1) { |
|
919 | 919 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
920 | 920 | } |
921 | 921 | |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | } else { |
926 | 926 | $protocol = $method; |
927 | 927 | } |
928 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
928 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
929 | 929 | if ($keepAlive) { |
930 | 930 | $this->xmlrpc_curl_handle = $curl; |
931 | 931 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | // results into variable |
937 | 937 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
938 | 938 | |
939 | - if ($this->debug > 1) { |
|
939 | + if ($this->debug>1) { |
|
940 | 940 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
941 | 941 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
942 | 942 | } |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | } |
962 | 962 | } |
963 | 963 | // extra headers |
964 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
964 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
965 | 965 | // if no keepalive is wanted, let the server know it in advance |
966 | 966 | if (!$keepAlive) { |
967 | 967 | $headers[] = 'Connection: close'; |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
979 | 979 | // timeout is borked |
980 | 980 | if ($timeout) { |
981 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
981 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | if ($method == 'http10') { |
@@ -988,11 +988,11 @@ discard block |
||
988 | 988 | } |
989 | 989 | |
990 | 990 | if ($username && $password) { |
991 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
991 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
992 | 992 | if (defined('CURLOPT_HTTPAUTH')) { |
993 | 993 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
994 | 994 | } elseif ($authType != 1) { |
995 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
995 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
996 | 996 | } |
997 | 997 | } |
998 | 998 | |
@@ -1034,13 +1034,13 @@ discard block |
||
1034 | 1034 | if ($proxyPort == 0) { |
1035 | 1035 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1036 | 1036 | } |
1037 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1037 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1038 | 1038 | if ($proxyUsername) { |
1039 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1039 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1040 | 1040 | if (defined('CURLOPT_PROXYAUTH')) { |
1041 | 1041 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1042 | 1042 | } elseif ($proxyAuthType != 1) { |
1043 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1043 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | if (count($this->cookies)) { |
1051 | 1051 | $cookieHeader = ''; |
1052 | 1052 | foreach ($this->cookies as $name => $cookie) { |
1053 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1053 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1054 | 1054 | } |
1055 | 1055 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1056 | 1056 | } |
@@ -1061,13 +1061,13 @@ discard block |
||
1061 | 1061 | |
1062 | 1062 | $result = curl_exec($curl); |
1063 | 1063 | |
1064 | - if ($this->debug > 1) { |
|
1064 | + if ($this->debug>1) { |
|
1065 | 1065 | $message = "---CURL INFO---\n"; |
1066 | 1066 | foreach (curl_getinfo($curl) as $name => $val) { |
1067 | 1067 | if (is_array($val)) { |
1068 | 1068 | $val = implode("\n", $val); |
1069 | 1069 | } |
1070 | - $message .= $name . ': ' . $val . "\n"; |
|
1070 | + $message .= $name.': '.$val."\n"; |
|
1071 | 1071 | } |
1072 | 1072 | $message .= '---END---'; |
1073 | 1073 | $this->getLogger()->debugMessage($message); |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1078 | 1078 | |
1079 | 1079 | $this->errstr = 'no response'; |
1080 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1080 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1081 | 1081 | curl_close($curl); |
1082 | 1082 | if ($keepAlive) { |
1083 | 1083 | $this->xmlrpc_curl_handle = null; |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | $call['methodName'] = new Value($req->method(), 'string'); |
1188 | 1188 | $numParams = $req->getNumParams(); |
1189 | 1189 | $params = array(); |
1190 | - for ($i = 0; $i < $numParams; $i++) { |
|
1190 | + for ($i = 0; $i<$numParams; $i++) { |
|
1191 | 1191 | $params[$i] = $req->getParam($i); |
1192 | 1192 | } |
1193 | 1193 | $call['params'] = new Value($params, 'array'); |
@@ -1213,15 +1213,15 @@ discard block |
||
1213 | 1213 | /// @todo test this code branch... |
1214 | 1214 | $rets = $result->value(); |
1215 | 1215 | if (!is_array($rets)) { |
1216 | - return false; // bad return type from system.multicall |
|
1216 | + return false; // bad return type from system.multicall |
|
1217 | 1217 | } |
1218 | 1218 | $numRets = count($rets); |
1219 | 1219 | if ($numRets != count($reqs)) { |
1220 | - return false; // wrong number of return values. |
|
1220 | + return false; // wrong number of return values. |
|
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | $response = array(); |
1224 | - for ($i = 0; $i < $numRets; $i++) { |
|
1224 | + for ($i = 0; $i<$numRets; $i++) { |
|
1225 | 1225 | $val = $rets[$i]; |
1226 | 1226 | if (!is_array($val)) { |
1227 | 1227 | return false; |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | switch (count($val)) { |
1230 | 1230 | case 1: |
1231 | 1231 | if (!isset($val[0])) { |
1232 | - return false; // Bad value |
|
1232 | + return false; // Bad value |
|
1233 | 1233 | } |
1234 | 1234 | // Normal return value |
1235 | 1235 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1257,19 +1257,19 @@ discard block |
||
1257 | 1257 | |
1258 | 1258 | $rets = $result->value(); |
1259 | 1259 | if ($rets->kindOf() != 'array') { |
1260 | - return false; // bad return type from system.multicall |
|
1260 | + return false; // bad return type from system.multicall |
|
1261 | 1261 | } |
1262 | 1262 | $numRets = $rets->count(); |
1263 | 1263 | if ($numRets != count($reqs)) { |
1264 | - return false; // wrong number of return values. |
|
1264 | + return false; // wrong number of return values. |
|
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | $response = array(); |
1268 | - foreach($rets as $val) { |
|
1268 | + foreach ($rets as $val) { |
|
1269 | 1269 | switch ($val->kindOf()) { |
1270 | 1270 | case 'array': |
1271 | 1271 | if ($val->count() != 1) { |
1272 | - return false; // Bad value |
|
1272 | + return false; // Bad value |
|
1273 | 1273 | } |
1274 | 1274 | // Normal return value |
1275 | 1275 | $response[] = new Response($val[0]); |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | public function xml_header($charsetEncoding = '') |
89 | 89 | { |
90 | 90 | if ($charsetEncoding != '') { |
91 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
91 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
92 | 92 | } else { |
93 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
93 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | public function createPayload($charsetEncoding = '') |
111 | 111 | { |
112 | 112 | if ($charsetEncoding != '') { |
113 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
113 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
114 | 114 | } else { |
115 | 115 | $this->content_type = 'text/xml'; |
116 | 116 | } |
117 | 117 | $this->payload = $this->xml_header($charsetEncoding); |
118 | - $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
119 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
118 | + $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
119 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
120 | 120 | $this->payload .= "<params>\n"; |
121 | 121 | foreach ($this->params as $p) { |
122 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
122 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
123 | 123 | "</param>\n"; |
124 | 124 | } |
125 | 125 | $this->payload .= "</params>\n"; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
247 | 247 | |
248 | 248 | if ($data == '') { |
249 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
249 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
250 | 250 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
251 | 251 | } |
252 | 252 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $httpParser = new Http(); |
256 | 256 | try { |
257 | 257 | $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug); |
258 | - } catch(\Exception $e) { |
|
258 | + } catch (\Exception $e) { |
|
259 | 259 | $r = new Response(0, $e->getCode(), $e->getMessage()); |
260 | 260 | // failed processing of HTTP response headers |
261 | 261 | // save into response obj the full payload received, for debugging |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
275 | 275 | $pos = strrpos($data, '</methodResponse>'); |
276 | 276 | if ($pos !== false) { |
277 | - $data = substr($data, 0, $pos + 17); |
|
277 | + $data = substr($data, 0, $pos+17); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // try to 'guestimate' the character encoding of the received response |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | if ($start) { |
286 | 286 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
287 | 287 | $end = strpos($data, '-->', $start); |
288 | - $comments = substr($data, $start, $end - $start); |
|
289 | - $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
290 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
288 | + $comments = substr($data, $start, $end-$start); |
|
289 | + $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
290 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (extension_loaded('mbstring')) { |
316 | 316 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
317 | 317 | } else { |
318 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
318 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | } |
@@ -336,12 +336,12 @@ discard block |
||
336 | 336 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE, $options); |
337 | 337 | |
338 | 338 | // first error check: xml not well formed |
339 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
339 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
340 | 340 | |
341 | 341 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
342 | 342 | |
343 | 343 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
344 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
344 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
345 | 345 | |
346 | 346 | if ($this->debug) { |
347 | 347 | print $xmlRpcParser->_xh['isf_reason']; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | // second error check: xml well formed but not xml-rpc compliant |
351 | 351 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
352 | 352 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
353 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
353 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
354 | 354 | |
355 | 355 | if ($this->debug) { |
356 | 356 | /// @todo echo something for user? |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
366 | 366 | PhpXmlRpc::$xmlrpcstr['invalid_return']); |
367 | 367 | } else { |
368 | - if ($this->debug > 1) { |
|
368 | + if ($this->debug>1) { |
|
369 | 369 | $this->getLogger()->debugMessage( |
370 | 370 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
371 | 371 | ); |
@@ -182,20 +182,20 @@ discard block |
||
182 | 182 | $callable = explode('::', $callable); |
183 | 183 | } |
184 | 184 | if (is_array($callable)) { |
185 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
185 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | if (is_string($callable[0])) { |
190 | 190 | $plainFuncName = implode('::', $callable); |
191 | 191 | } elseif (is_object($callable[0])) { |
192 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
192 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
193 | 193 | } |
194 | 194 | $exists = method_exists($callable[0], $callable[1]); |
195 | 195 | } else if ($callable instanceof \Closure) { |
196 | 196 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
197 | 197 | if (!$buildIt) { |
198 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
198 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | if (!$exists) { |
210 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
210 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | |
@@ -251,23 +251,23 @@ discard block |
||
251 | 251 | if (is_array($callable)) { |
252 | 252 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
253 | 253 | if ($func->isPrivate()) { |
254 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
254 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | if ($func->isProtected()) { |
258 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
258 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | if ($func->isConstructor()) { |
262 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
262 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | if ($func->isDestructor()) { |
266 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
266 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | if ($func->isAbstract()) { |
270 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
270 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | /// @todo add more checks for static vs. nonstatic? |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | if ($func->isInternal()) { |
278 | 278 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
279 | 279 | // instead of getparameters to fully reflect internal php functions ? |
280 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
280 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $i = 0; |
330 | 330 | foreach ($func->getParameters() as $paramObj) { |
331 | 331 | $params[$i] = array(); |
332 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
332 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
333 | 333 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
334 | 334 | $i++; |
335 | 335 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // build a signature |
395 | 395 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
396 | 396 | $pSig = array($funcDesc['returnsDocs']); |
397 | - for ($i = 0; $i < count($pars); $i++) { |
|
397 | + for ($i = 0; $i<count($pars); $i++) { |
|
398 | 398 | $name = strtolower($funcDesc['params'][$i]['name']); |
399 | 399 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
400 | 400 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | } |
450 | 450 | } |
451 | 451 | $numPars = $req->getNumParams(); |
452 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
452 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
453 | 453 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
454 | 454 | } |
455 | 455 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | $result = call_user_func_array($callable, $params); |
464 | 464 | |
465 | - if (! is_a($result, $responseClass)) { |
|
465 | + if (!is_a($result, $responseClass)) { |
|
466 | 466 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
467 | 467 | $result = new $valueClass($result, $funcDesc['returns']); |
468 | 468 | } else { |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | if ($newFuncName == '') { |
498 | 498 | if (is_array($callable)) { |
499 | 499 | if (is_string($callable[0])) { |
500 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
500 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
501 | 501 | } else { |
502 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
502 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
503 | 503 | } |
504 | 504 | } else { |
505 | 505 | if ($callable instanceof \Closure) { |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | { |
536 | 536 | $namespace = '\\PhpXmlRpc\\'; |
537 | 537 | |
538 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
539 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
538 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
539 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
540 | 540 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
541 | 541 | |
542 | 542 | $i = 0; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | // build body of new function |
572 | 572 | |
573 | 573 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
574 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
574 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
575 | 575 | |
576 | 576 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
577 | 577 | if ($decodePhpObjects) { |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | if (is_array($callable) && is_object($callable[0])) { |
586 | 586 | self::$objHolder[$newFuncName] = $callable[0]; |
587 | 587 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
588 | - $realFuncName = '$obj->' . $callable[1]; |
|
588 | + $realFuncName = '$obj->'.$callable[1]; |
|
589 | 589 | } else { |
590 | 590 | $realFuncName = $plainFuncName; |
591 | 591 | } |
592 | 592 | foreach ($parsVariations as $i => $pars) { |
593 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
594 | - if ($i < (count($parsVariations) - 1)) |
|
593 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
594 | + if ($i<(count($parsVariations)-1)) |
|
595 | 595 | $innerCode .= "else\n"; |
596 | 596 | } |
597 | 597 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | // if($func->returnsReference()) |
609 | 609 | // return false; |
610 | 610 | |
611 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
611 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
612 | 612 | |
613 | 613 | return $code; |
614 | 614 | } |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | if ($methodWrap) { |
646 | 646 | if (is_object($className)) { |
647 | 647 | $realClassName = get_class($className); |
648 | - }else { |
|
648 | + } else { |
|
649 | 649 | $realClassName = $className; |
650 | 650 | } |
651 | 651 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -746,21 +746,21 @@ discard block |
||
746 | 746 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
747 | 747 | { |
748 | 748 | $namespace = '\\PhpXmlRpc\\'; |
749 | - $reqClass = $namespace . 'Request'; |
|
750 | - $valClass = $namespace . 'Value'; |
|
751 | - $decoderClass = $namespace . 'Encoder'; |
|
749 | + $reqClass = $namespace.'Request'; |
|
750 | + $valClass = $namespace.'Value'; |
|
751 | + $decoderClass = $namespace.'Encoder'; |
|
752 | 752 | |
753 | 753 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
754 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
754 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
755 | 755 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
756 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
756 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
757 | 757 | |
758 | 758 | $req = new $reqClass('system.methodSignature'); |
759 | 759 | $req->addparam(new $valClass($methodName)); |
760 | 760 | $client->setDebug($debug); |
761 | 761 | $response = $client->send($req, $timeout, $protocol); |
762 | 762 | if ($response->faultCode()) { |
763 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
763 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
764 | 764 | return false; |
765 | 765 | } |
766 | 766 | |
@@ -770,8 +770,8 @@ discard block |
||
770 | 770 | $mSig = $decoder->decode($mSig); |
771 | 771 | } |
772 | 772 | |
773 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
774 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
773 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
774 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
775 | 775 | return false; |
776 | 776 | } |
777 | 777 | |
@@ -787,11 +787,11 @@ discard block |
||
787 | 787 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
788 | 788 | { |
789 | 789 | $namespace = '\\PhpXmlRpc\\'; |
790 | - $reqClass = $namespace . 'Request'; |
|
791 | - $valClass = $namespace . 'Value'; |
|
790 | + $reqClass = $namespace.'Request'; |
|
791 | + $valClass = $namespace.'Value'; |
|
792 | 792 | |
793 | 793 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
794 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
794 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
795 | 795 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
796 | 796 | |
797 | 797 | $mDesc = ''; |
@@ -825,10 +825,10 @@ discard block |
||
825 | 825 | $clientClone = clone $client; |
826 | 826 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
827 | 827 | { |
828 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
828 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
829 | 829 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
830 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
831 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
830 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
831 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
832 | 832 | if (isset($extraOptions['return_on_fault'])) { |
833 | 833 | $decodeFault = true; |
834 | 834 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -837,9 +837,9 @@ discard block |
||
837 | 837 | } |
838 | 838 | |
839 | 839 | $namespace = '\\PhpXmlRpc\\'; |
840 | - $reqClass = $namespace . 'Request'; |
|
841 | - $encoderClass = $namespace . 'Encoder'; |
|
842 | - $valueClass = $namespace . 'Value'; |
|
840 | + $reqClass = $namespace.'Request'; |
|
841 | + $encoderClass = $namespace.'Encoder'; |
|
842 | + $valueClass = $namespace.'Value'; |
|
843 | 843 | |
844 | 844 | $encoder = new $encoderClass(); |
845 | 845 | $encodeOptions = array(); |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | } |
863 | 863 | |
864 | 864 | $xmlrpcArgs = array(); |
865 | - foreach($currentArgs as $i => $arg) { |
|
865 | + foreach ($currentArgs as $i => $arg) { |
|
866 | 866 | if ($i == $maxArgs) { |
867 | 867 | break; |
868 | 868 | } |
@@ -910,13 +910,13 @@ discard block |
||
910 | 910 | * @param string $mDesc |
911 | 911 | * @return string[] keys: source, docstring |
912 | 912 | */ |
913 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
913 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
914 | 914 | { |
915 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
915 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
916 | 916 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
917 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
918 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
919 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
917 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
918 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
919 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
920 | 920 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
921 | 921 | if (isset($extraOptions['return_on_fault'])) { |
922 | 922 | $decodeFault = true; |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | $namespace = '\\PhpXmlRpc\\'; |
930 | 930 | |
931 | 931 | $code = "function $newFuncName ("; |
932 | - if ($clientCopyMode < 2) { |
|
932 | + if ($clientCopyMode<2) { |
|
933 | 933 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
934 | 934 | $verbatimClientCopy = !$clientCopyMode; |
935 | 935 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | |
945 | 945 | if ($mDesc != '') { |
946 | 946 | // take care that PHP comment is not terminated unwillingly by method description |
947 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
947 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
948 | 948 | } else { |
949 | 949 | $mDesc = "/**\nFunction $newFuncName\n"; |
950 | 950 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
954 | 954 | $plist = array(); |
955 | 955 | $pCount = count($mSig); |
956 | - for ($i = 1; $i < $pCount; $i++) { |
|
956 | + for ($i = 1; $i<$pCount; $i++) { |
|
957 | 957 | $plist[] = "\$p$i"; |
958 | 958 | $pType = $mSig[$i]; |
959 | 959 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -969,19 +969,19 @@ discard block |
||
969 | 969 | } |
970 | 970 | } |
971 | 971 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
972 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
972 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
973 | 973 | } |
974 | - if ($clientCopyMode < 2) { |
|
974 | + if ($clientCopyMode<2) { |
|
975 | 975 | $plist[] = '$debug=0'; |
976 | 976 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
977 | 977 | } |
978 | 978 | $plist = implode(', ', $plist); |
979 | - $mDesc .= '* @return {$namespace}Response|' . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
979 | + $mDesc .= '* @return {$namespace}Response|'.$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
980 | 980 | |
981 | 981 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
982 | 982 | if ($decodeFault) { |
983 | 983 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
984 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
984 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
985 | 985 | } else { |
986 | 986 | $respCode = var_export($faultResponse, true); |
987 | 987 | } |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
995 | 995 | } |
996 | 996 | |
997 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
997 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
998 | 998 | |
999 | 999 | return array('source' => $code, 'docstring' => $mDesc); |
1000 | 1000 | } |
@@ -1020,23 +1020,23 @@ discard block |
||
1020 | 1020 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
1021 | 1021 | { |
1022 | 1022 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
1023 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
1023 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
1024 | 1024 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1025 | 1025 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1026 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1027 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1026 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1027 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1028 | 1028 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1029 | 1029 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1030 | 1030 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1031 | 1031 | $namespace = '\\PhpXmlRpc\\'; |
1032 | 1032 | |
1033 | - $reqClass = $namespace . 'Request'; |
|
1034 | - $decoderClass = $namespace . 'Encoder'; |
|
1033 | + $reqClass = $namespace.'Request'; |
|
1034 | + $decoderClass = $namespace.'Encoder'; |
|
1035 | 1035 | |
1036 | 1036 | $req = new $reqClass('system.listMethods'); |
1037 | 1037 | $response = $client->send($req, $timeout, $protocol); |
1038 | 1038 | if ($response->faultCode()) { |
1039 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1039 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1040 | 1040 | |
1041 | 1041 | return false; |
1042 | 1042 | } else { |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | $mList = $decoder->decode($mList); |
1047 | 1047 | } |
1048 | 1048 | if (!is_array($mList) || !count($mList)) { |
1049 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1049 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1050 | 1050 | |
1051 | 1051 | return false; |
1052 | 1052 | } else { |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | if ($newClassName != '') { |
1055 | 1055 | $xmlrpcClassName = $newClassName; |
1056 | 1056 | } else { |
1057 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1058 | - array('_', ''), $client->server) . '_client'; |
|
1057 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1058 | + array('_', ''), $client->server).'_client'; |
|
1059 | 1059 | } |
1060 | 1060 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1061 | 1061 | $xmlrpcClassName .= 'x'; |
@@ -1086,20 +1086,20 @@ discard block |
||
1086 | 1086 | if (!$buildIt) { |
1087 | 1087 | $source .= $methodWrap['docstring']; |
1088 | 1088 | } |
1089 | - $source .= $methodWrap['source'] . "\n"; |
|
1089 | + $source .= $methodWrap['source']."\n"; |
|
1090 | 1090 | } else { |
1091 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1091 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | } |
1095 | 1095 | $source .= "}\n"; |
1096 | 1096 | if ($buildIt) { |
1097 | 1097 | $allOK = 0; |
1098 | - eval($source . '$allOK=1;'); |
|
1098 | + eval($source.'$allOK=1;'); |
|
1099 | 1099 | if ($allOK) { |
1100 | 1100 | return $xmlrpcClassName; |
1101 | 1101 | } else { |
1102 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1102 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1103 | 1103 | return false; |
1104 | 1104 | } |
1105 | 1105 | } else { |
@@ -1120,10 +1120,10 @@ discard block |
||
1120 | 1120 | * |
1121 | 1121 | * @return string |
1122 | 1122 | */ |
1123 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
1123 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
1124 | 1124 | { |
1125 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
1126 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
1125 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
1126 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
1127 | 1127 | |
1128 | 1128 | // copy all client fields to the client that will be generated runtime |
1129 | 1129 | // (this provides for future expansion or subclassing of client obj) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->me['struct'] = $val; |
120 | 120 | break; |
121 | 121 | default: |
122 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
122 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | if ($typeOf !== 1) { |
147 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
147 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
148 | 148 | return 0; |
149 | 149 | } |
150 | 150 | |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | |
162 | 162 | switch ($this->mytype) { |
163 | 163 | case 1: |
164 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
164 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
165 | 165 | return 0; |
166 | 166 | case 3: |
167 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
167 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
168 | 168 | return 0; |
169 | 169 | case 2: |
170 | 170 | // we're adding a scalar value to an array here |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | return 1; |
208 | 208 | } else { |
209 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
209 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
210 | 210 | return 0; |
211 | 211 | } |
212 | 212 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | return 1; |
239 | 239 | } else { |
240 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
240 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
241 | 241 | return 0; |
242 | 242 | } |
243 | 243 | } |
@@ -279,19 +279,19 @@ discard block |
||
279 | 279 | case 1: |
280 | 280 | switch ($typ) { |
281 | 281 | case static::$xmlrpcBase64: |
282 | - $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>"; |
|
282 | + $rs .= "<${typ}>".base64_encode($val)."</${typ}>"; |
|
283 | 283 | break; |
284 | 284 | case static::$xmlrpcBoolean: |
285 | - $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>"; |
|
285 | + $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>"; |
|
286 | 286 | break; |
287 | 287 | case static::$xmlrpcString: |
288 | 288 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
289 | - $rs .= "<${typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>"; |
|
289 | + $rs .= "<${typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>"; |
|
290 | 290 | break; |
291 | 291 | case static::$xmlrpcInt: |
292 | 292 | case static::$xmlrpcI4: |
293 | 293 | case static::$xmlrpcI8: |
294 | - $rs .= "<${typ}>" . (int)$val . "</${typ}>"; |
|
294 | + $rs .= "<${typ}>".(int) $val."</${typ}>"; |
|
295 | 295 | break; |
296 | 296 | case static::$xmlrpcDouble: |
297 | 297 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | // sprintf('%F') could be most likely ok but it fails eg. on 2e-14. |
300 | 300 | // The code below tries its best at keeping max precision while avoiding exp notation, |
301 | 301 | // but there is of course no limit in the number of decimal places to be used... |
302 | - $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</${typ}>"; |
|
302 | + $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</${typ}>"; |
|
303 | 303 | break; |
304 | 304 | case static::$xmlrpcDateTime: |
305 | 305 | if (is_string($val)) { |
306 | 306 | $rs .= "<${typ}>${val}</${typ}>"; |
307 | 307 | } elseif (is_a($val, 'DateTime')) { |
308 | - $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>"; |
|
308 | + $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>"; |
|
309 | 309 | } elseif (is_int($val)) { |
310 | - $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>"; |
|
310 | + $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>"; |
|
311 | 311 | } else { |
312 | 312 | // not really a good idea here: but what shall we output anyway? left for backward compat... |
313 | 313 | $rs .= "<${typ}>${val}</${typ}>"; |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | case 3: |
330 | 330 | // struct |
331 | 331 | if ($this->_php_class) { |
332 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
332 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
333 | 333 | } else { |
334 | 334 | $rs .= "<struct>\n"; |
335 | 335 | } |
336 | 336 | $charsetEncoder = $this->getCharsetEncoder(); |
337 | 337 | /** @var Value $val2 */ |
338 | 338 | foreach ($val as $key2 => $val2) { |
339 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
339 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
340 | 340 | //$rs.=$this->serializeval($val2); |
341 | 341 | $rs .= $val2->serialize($charsetEncoding); |
342 | 342 | $rs .= "</member>\n"; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $val = reset($this->me); |
373 | 373 | $typ = key($this->me); |
374 | 374 | |
375 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
375 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function xmlrpc_debugmsg($msg) |
205 | 205 | { |
206 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
206 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public static function error_occurred($msg) |
217 | 217 | { |
218 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
218 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
235 | 235 | $out = ''; |
236 | 236 | if ($this->debug_info != '') { |
237 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
237 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
238 | 238 | } |
239 | 239 | if (static::$_xmlrpc_debuginfo != '') { |
240 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
240 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
241 | 241 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
242 | 242 | // into return payload AFTER the beginning tag |
243 | 243 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | $this->debug_info = ''; |
268 | 268 | |
269 | 269 | // Save what we received, before parsing it |
270 | - if ($this->debug > 1) { |
|
271 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
270 | + if ($this->debug>1) { |
|
271 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -280,21 +280,21 @@ discard block |
||
280 | 280 | // save full body of request into response, for more debugging usages |
281 | 281 | $r->raw_data = $rawData; |
282 | 282 | |
283 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
284 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
285 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
283 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
284 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
285 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | $payload = $this->xml_header($respCharset); |
289 | - if ($this->debug > 0) { |
|
290 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
289 | + if ($this->debug>0) { |
|
290 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // Do not create response serialization if it has already happened. Helps building json magic |
294 | 294 | if (empty($r->payload)) { |
295 | 295 | $r->serialize($respCharset); |
296 | 296 | } |
297 | - $payload = $payload . $r->payload; |
|
297 | + $payload = $payload.$r->payload; |
|
298 | 298 | |
299 | 299 | if ($returnPayload) { |
300 | 300 | return $payload; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // if we get a warning/error that has output some text before here, then we cannot |
304 | 304 | // add a new header. We cannot say we are sending xml, either... |
305 | 305 | if (!headers_sent()) { |
306 | - header('Content-Type: ' . $r->content_type); |
|
306 | + header('Content-Type: '.$r->content_type); |
|
307 | 307 | // we do not know if client actually told us an accepted charset, but if he did |
308 | 308 | // we have to tell him what we did |
309 | 309 | header("Vary: Accept-Charset"); |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
333 | 333 | // responses up to 8000 bytes |
334 | 334 | if ($phpNoSelfCompress) { |
335 | - header('Content-Length: ' . (int)strlen($payload)); |
|
335 | + header('Content-Length: '.(int) strlen($payload)); |
|
336 | 336 | } |
337 | 337 | } else { |
338 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
338 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | print $payload; |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | $numParams = count($in); |
391 | 391 | } |
392 | 392 | foreach ($sigs as $curSig) { |
393 | - if (count($curSig) == $numParams + 1) { |
|
393 | + if (count($curSig) == $numParams+1) { |
|
394 | 394 | $itsOK = 1; |
395 | - for ($n = 0; $n < $numParams; $n++) { |
|
395 | + for ($n = 0; $n<$numParams; $n++) { |
|
396 | 396 | if (is_object($in)) { |
397 | 397 | $p = $in->getParam($n); |
398 | 398 | if ($p->kindOf() == 'scalar') { |
@@ -405,10 +405,10 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | // param index is $n+1, as first member of sig is return type |
408 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
408 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
409 | 409 | $itsOK = 0; |
410 | - $pno = $n + 1; |
|
411 | - $wanted = $curSig[$n + 1]; |
|
410 | + $pno = $n+1; |
|
411 | + $wanted = $curSig[$n+1]; |
|
412 | 412 | $got = $pt; |
413 | 413 | break; |
414 | 414 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | // check if $_SERVER is populated: it might have been disabled via ini file |
436 | 436 | // (this is true even when in CLI mode) |
437 | 437 | if (count($_SERVER) == 0) { |
438 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
438 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
439 | 439 | } |
440 | 440 | |
441 | - if ($this->debug > 1) { |
|
441 | + if ($this->debug>1) { |
|
442 | 442 | if (function_exists('getallheaders')) { |
443 | 443 | $this->debugmsg(''); // empty line |
444 | 444 | foreach (getallheaders() as $name => $val) { |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
461 | 461 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
462 | 462 | $data = $degzdata; |
463 | - if ($this->debug > 1) { |
|
464 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
463 | + if ($this->debug>1) { |
|
464 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
465 | 465 | } |
466 | 466 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
467 | 467 | $data = $degzdata; |
468 | - if ($this->debug > 1) { |
|
469 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
468 | + if ($this->debug>1) { |
|
469 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
470 | 470 | } |
471 | 471 | } else { |
472 | 472 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (extension_loaded('mbstring')) { |
557 | 557 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
558 | 558 | } else { |
559 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
559 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | } |
@@ -575,16 +575,16 @@ discard block |
||
575 | 575 | |
576 | 576 | $xmlRpcParser = $this->getParser(); |
577 | 577 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST, $options); |
578 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
578 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
579 | 579 | // (BC) we return XML error as a faultCode |
580 | 580 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
581 | 581 | $r = new Response(0, |
582 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
582 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
583 | 583 | $xmlRpcParser->_xh['isf_reason']); |
584 | 584 | } elseif ($xmlRpcParser->_xh['isf']) { |
585 | 585 | $r = new Response(0, |
586 | 586 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
587 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
587 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
588 | 588 | } else { |
589 | 589 | // small layering violation in favor of speed and memory usage: |
590 | 590 | // we should allow the 'execute' method handle this, but in the |
@@ -595,20 +595,20 @@ discard block |
||
595 | 595 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
596 | 596 | ) |
597 | 597 | ) { |
598 | - if ($this->debug > 1) { |
|
599 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
598 | + if ($this->debug>1) { |
|
599 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
600 | 600 | } |
601 | 601 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
602 | 602 | } else { |
603 | 603 | // build a Request object with data parsed from xml |
604 | 604 | $req = new Request($xmlRpcParser->_xh['method']); |
605 | 605 | // now add parameters in |
606 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
606 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
607 | 607 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
608 | 608 | } |
609 | 609 | |
610 | - if ($this->debug > 1) { |
|
611 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
610 | + if ($this->debug>1) { |
|
611 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
612 | 612 | } |
613 | 613 | $r = $this->execute($req); |
614 | 614 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | return new Response( |
662 | 662 | 0, |
663 | 663 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
664 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
664 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
665 | 665 | ); |
666 | 666 | } |
667 | 667 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | |
675 | 675 | if (is_array($func)) { |
676 | 676 | if (is_object($func[0])) { |
677 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
677 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
678 | 678 | } else { |
679 | 679 | $funcName = implode('::', $func); |
680 | 680 | } |
@@ -686,17 +686,17 @@ discard block |
||
686 | 686 | |
687 | 687 | // verify that function to be invoked is in fact callable |
688 | 688 | if (!is_callable($func)) { |
689 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
689 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
690 | 690 | return new Response( |
691 | 691 | 0, |
692 | 692 | PhpXmlRpc::$xmlrpcerr['server_error'], |
693 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
693 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
694 | 694 | ); |
695 | 695 | } |
696 | 696 | |
697 | 697 | // If debug level is 3, we should catch all errors generated during |
698 | 698 | // processing of user function, and log them as part of response |
699 | - if ($this->debug > 2) { |
|
699 | + if ($this->debug>2) { |
|
700 | 700 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
701 | 701 | } |
702 | 702 | |
@@ -709,14 +709,14 @@ discard block |
||
709 | 709 | $r = call_user_func($func, $req); |
710 | 710 | } |
711 | 711 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
712 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
712 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
713 | 713 | if (is_a($r, 'PhpXmlRpc\Value')) { |
714 | 714 | $r = new Response($r); |
715 | 715 | } else { |
716 | 716 | $r = new Response( |
717 | 717 | 0, |
718 | 718 | PhpXmlRpc::$xmlrpcerr['server_error'], |
719 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
719 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
720 | 720 | ); |
721 | 721 | } |
722 | 722 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
733 | 733 | // an error response |
734 | 734 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
735 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
735 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
736 | 736 | } else { |
737 | 737 | // functions using EPI api should NOT return resp objects, |
738 | 738 | // so make sure we encode the return type correctly |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | // in the called function, we wrap it in a proper error-response |
757 | 757 | switch ($this->exception_handling) { |
758 | 758 | case 2: |
759 | - if ($this->debug > 2) { |
|
759 | + if ($this->debug>2) { |
|
760 | 760 | if (self::$_xmlrpcs_prev_ehandler) { |
761 | 761 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
762 | 762 | } else { |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
772 | 772 | } |
773 | 773 | } |
774 | - if ($this->debug > 2) { |
|
774 | + if ($this->debug>2) { |
|
775 | 775 | // note: restore the error handler we found before calling the |
776 | 776 | // user func, even if it has been changed inside the func itself |
777 | 777 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | */ |
792 | 792 | protected function debugmsg($string) |
793 | 793 | { |
794 | - $this->debug_info .= $string . "\n"; |
|
794 | + $this->debug_info .= $string."\n"; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -801,9 +801,9 @@ discard block |
||
801 | 801 | protected function xml_header($charsetEncoding = '') |
802 | 802 | { |
803 | 803 | if ($charsetEncoding != '') { |
804 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
804 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
805 | 805 | } else { |
806 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
806 | + return "<?xml version=\"1.0\"?".">\n"; |
|
807 | 807 | } |
808 | 808 | } |
809 | 809 | |
@@ -1055,12 +1055,12 @@ discard block |
||
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | $req = new Request($methName->scalarval()); |
1058 | - foreach($params as $i => $param) { |
|
1058 | + foreach ($params as $i => $param) { |
|
1059 | 1059 | if (!$req->addParam($param)) { |
1060 | 1060 | $i++; // for error message, we count params from 1 |
1061 | 1061 | return static::_xmlrpcs_multicall_error(new Response(0, |
1062 | 1062 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1063 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1063 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1132,12 +1132,12 @@ discard block |
||
1132 | 1132 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
1133 | 1133 | if (is_object($req)) { |
1134 | 1134 | $calls = $req->getParam(0); |
1135 | - foreach($calls as $call) { |
|
1135 | + foreach ($calls as $call) { |
|
1136 | 1136 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
1137 | 1137 | } |
1138 | 1138 | } else { |
1139 | 1139 | $numCalls = count($req); |
1140 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1140 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1141 | 1141 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1142 | 1142 | } |
1143 | 1143 | } |