@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // user declares the type of resp value: we "almost" trust it... but log errors just in case |
| 74 | 74 | if (($this->valtyp == 'xmlrpcvals' && (!is_a($this->val, 'PhpXmlRpc\Value'))) || |
| 75 | 75 | ($this->valtyp == 'xml' && (!is_string($this->val)))) { |
| 76 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in does not match type ' . $valType); |
|
| 76 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in does not match type '.$valType); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -152,34 +152,34 @@ discard block |
||
| 152 | 152 | public function serialize($charsetEncoding = '') |
| 153 | 153 | { |
| 154 | 154 | if ($charsetEncoding != '') { |
| 155 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 155 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 156 | 156 | } else { |
| 157 | 157 | $this->content_type = 'text/xml'; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
| 161 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
| 161 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
| 162 | 162 | } else { |
| 163 | 163 | $result = "<methodResponse>\n"; |
| 164 | 164 | } |
| 165 | 165 | if ($this->errno) { |
| 166 | 166 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
| 167 | - $result .= "<fault>\n" . |
|
| 168 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
| 169 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
| 170 | - $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . |
|
| 167 | + $result .= "<fault>\n". |
|
| 168 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
| 169 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
| 170 | + $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding). |
|
| 171 | 171 | "</string></value>\n</member>\n</struct>\n</value>\n</fault>"; |
| 172 | 172 | } else { |
| 173 | 173 | if (is_object($this->val) && is_a($this->val, 'PhpXmlRpc\Value')) { |
| 174 | - $result .= "<params>\n<param>\n" . $this->val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
| 174 | + $result .= "<params>\n<param>\n".$this->val->serialize($charsetEncoding)."</param>\n</params>"; |
|
| 175 | 175 | } else if (is_string($this->val) && $this->valtyp == 'xml') { |
| 176 | - $result .= "<params>\n<param>\n" . |
|
| 177 | - $this->val . |
|
| 176 | + $result .= "<params>\n<param>\n". |
|
| 177 | + $this->val. |
|
| 178 | 178 | "</param>\n</params>"; |
| 179 | 179 | } else if ($this->valtyp == 'phpvals') { |
| 180 | 180 | $encoder = new Encoder(); |
| 181 | 181 | $val = $encoder->encode($this->val); |
| 182 | - $result .= "<params>\n<param>\n" . $val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
| 182 | + $result .= "<params>\n<param>\n".$val->serialize($charsetEncoding)."</param>\n</params>"; |
|
| 183 | 183 | } else { |
| 184 | 184 | throw new StateErrorException('cannot serialize xmlrpc response objects whose content is native php values'); |
| 185 | 185 | } |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | public function xml_header($charsetEncoding = '') |
| 199 | 199 | { |
| 200 | 200 | if ($charsetEncoding != '') { |
| 201 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 201 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 202 | 202 | } else { |
| 203 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 203 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -211,18 +211,18 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | switch ($name) { |
| 213 | 213 | case 'hdrs': |
| 214 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 214 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 215 | 215 | return $this->httpResponse['headers']; |
| 216 | 216 | case '_cookies': |
| 217 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 217 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 218 | 218 | return $this->httpResponse['cookies']; |
| 219 | 219 | case 'raw_data': |
| 220 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 220 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 221 | 221 | return $this->httpResponse['raw_data']; |
| 222 | 222 | default: |
| 223 | 223 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 224 | 224 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 225 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 225 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 226 | 226 | $result = null; |
| 227 | 227 | return $result; |
| 228 | 228 | } |
@@ -232,21 +232,21 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | switch ($name) { |
| 234 | 234 | case 'hdrs': |
| 235 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 235 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 236 | 236 | $this->httpResponse['headers'] = $value; |
| 237 | 237 | break; |
| 238 | 238 | case '_cookies': |
| 239 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 239 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 240 | 240 | $this->httpResponse['cookies'] = $value; |
| 241 | 241 | break; |
| 242 | 242 | case 'raw_data': |
| 243 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 243 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 244 | 244 | $this->httpResponse['raw_data'] = $value; |
| 245 | 245 | break; |
| 246 | 246 | default: |
| 247 | 247 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 248 | 248 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 249 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 249 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
@@ -254,13 +254,13 @@ discard block |
||
| 254 | 254 | { |
| 255 | 255 | switch ($name) { |
| 256 | 256 | case 'hdrs': |
| 257 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 257 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 258 | 258 | return isset($this->httpResponse['headers']); |
| 259 | 259 | case '_cookies': |
| 260 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 260 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 261 | 261 | return isset($this->httpResponse['cookies']); |
| 262 | 262 | case 'raw_data': |
| 263 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 263 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 264 | 264 | return isset($this->httpResponse['raw_data']); |
| 265 | 265 | default: |
| 266 | 266 | return false; |
@@ -271,21 +271,21 @@ discard block |
||
| 271 | 271 | { |
| 272 | 272 | switch ($name) { |
| 273 | 273 | case 'hdrs': |
| 274 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 274 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 275 | 275 | unset($this->httpResponse['headers']); |
| 276 | 276 | break; |
| 277 | 277 | case '_cookies': |
| 278 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 278 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 279 | 279 | unset($this->httpResponse['cookies']); |
| 280 | 280 | break; |
| 281 | 281 | case 'raw_data': |
| 282 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 282 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 283 | 283 | unset($this->httpResponse['raw_data']); |
| 284 | 284 | break; |
| 285 | 285 | default: |
| 286 | 286 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 287 | 287 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 288 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 288 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->me['struct'] = $val; |
| 97 | 97 | break; |
| 98 | 98 | default: |
| 99 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
| 99 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if ($typeOf !== 1) { |
| 129 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
| 129 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
| 130 | 130 | return 0; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | switch ($this->mytype) { |
| 145 | 145 | case 1: |
| 146 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
| 146 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
| 147 | 147 | return 0; |
| 148 | 148 | case 3: |
| 149 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
| 149 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
| 150 | 150 | return 0; |
| 151 | 151 | case 2: |
| 152 | 152 | // we're adding a scalar value to an array here |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | return 1; |
| 192 | 192 | } else { |
| 193 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 193 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
| 194 | 194 | return 0; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | return 1; |
| 223 | 223 | } else { |
| 224 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 224 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
| 225 | 225 | return 0; |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $val = reset($this->me); |
| 287 | 287 | $typ = key($this->me); |
| 288 | 288 | |
| 289 | - return '<value>' . $this->serializeData($typ, $val, $charsetEncoding) . "</value>\n"; |
|
| 289 | + return '<value>'.$this->serializeData($typ, $val, $charsetEncoding)."</value>\n"; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -309,19 +309,19 @@ discard block |
||
| 309 | 309 | case 1: |
| 310 | 310 | switch ($typ) { |
| 311 | 311 | case static::$xmlrpcBase64: |
| 312 | - $rs = "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
| 312 | + $rs = "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
| 313 | 313 | break; |
| 314 | 314 | case static::$xmlrpcBoolean: |
| 315 | - $rs = "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
| 315 | + $rs = "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
| 316 | 316 | break; |
| 317 | 317 | case static::$xmlrpcString: |
| 318 | 318 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
| 319 | - $rs = "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
| 319 | + $rs = "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
| 320 | 320 | break; |
| 321 | 321 | case static::$xmlrpcInt: |
| 322 | 322 | case static::$xmlrpcI4: |
| 323 | 323 | case static::$xmlrpcI8: |
| 324 | - $rs = "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
| 324 | + $rs = "<{$typ}>".(int) $val."</{$typ}>"; |
|
| 325 | 325 | break; |
| 326 | 326 | case static::$xmlrpcDouble: |
| 327 | 327 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -329,16 +329,16 @@ discard block |
||
| 329 | 329 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
| 330 | 330 | // The code below tries its best at keeping max precision while avoiding exp notation, |
| 331 | 331 | // but there is of course no limit in the number of decimal places to be used... |
| 332 | - $rs = "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
| 332 | + $rs = "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
| 333 | 333 | break; |
| 334 | 334 | case static::$xmlrpcDateTime: |
| 335 | 335 | if (is_string($val)) { |
| 336 | 336 | $rs = "<{$typ}>{$val}</{$typ}>"; |
| 337 | 337 | // DateTimeInterface is not present in php 5.4... |
| 338 | 338 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
| 339 | - $rs = "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
| 339 | + $rs = "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
| 340 | 340 | } elseif (is_int($val)) { |
| 341 | - $rs = "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
| 341 | + $rs = "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
| 342 | 342 | } else { |
| 343 | 343 | // not really a good idea here: but what should we output anyway? left for backward compat... |
| 344 | 344 | $rs = "<{$typ}>{$val}</{$typ}>"; |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | case 3: |
| 361 | 361 | // struct |
| 362 | 362 | if ($this->_php_class) { |
| 363 | - $rs = '<struct php_class="' . $this->_php_class . "\">\n"; |
|
| 363 | + $rs = '<struct php_class="'.$this->_php_class."\">\n"; |
|
| 364 | 364 | } else { |
| 365 | 365 | $rs = "<struct>\n"; |
| 366 | 366 | } |
| 367 | 367 | $charsetEncoder = $this->getCharsetEncoder(); |
| 368 | 368 | /** @var Value $val2 */ |
| 369 | 369 | foreach ($val as $key2 => $val2) { |
| 370 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
| 370 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
| 371 | 371 | $rs .= $val2->serialize($charsetEncoding); |
| 372 | 372 | $rs .= "</member>\n"; |
| 373 | 373 | } |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | */ |
| 582 | 582 | public function structMemExists($key) |
| 583 | 583 | { |
| 584 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 584 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 585 | 585 | |
| 586 | 586 | return array_key_exists($key, $this->me['struct']); |
| 587 | 587 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | */ |
| 598 | 598 | public function structMem($key) |
| 599 | 599 | { |
| 600 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 600 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 601 | 601 | |
| 602 | 602 | return $this->me['struct'][$key]; |
| 603 | 603 | } |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | */ |
| 611 | 611 | public function structReset() |
| 612 | 612 | { |
| 613 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 613 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 614 | 614 | |
| 615 | 615 | reset($this->me['struct']); |
| 616 | 616 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | public function structEach() |
| 626 | 626 | { |
| 627 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 627 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 628 | 628 | |
| 629 | 629 | $key = key($this->me['struct']); |
| 630 | 630 | $value = current($this->me['struct']); |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | */ |
| 644 | 644 | public function arrayMem($key) |
| 645 | 645 | { |
| 646 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 646 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 647 | 647 | |
| 648 | 648 | return $this->me['array'][$key]; |
| 649 | 649 | } |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | */ |
| 658 | 658 | public function arraySize() |
| 659 | 659 | { |
| 660 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 660 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 661 | 661 | |
| 662 | 662 | return count($this->me['array']); |
| 663 | 663 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | */ |
| 672 | 672 | public function structSize() |
| 673 | 673 | { |
| 674 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 674 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 675 | 675 | |
| 676 | 676 | return count($this->me['struct']); |
| 677 | 677 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | return true; |
| 79 | 79 | } else { |
| 80 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value'); |
|
| 80 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value'); |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | $this->logDeprecationUnlessCalledBy('serialize'); |
| 128 | 128 | |
| 129 | 129 | if ($charsetEncoding != '') { |
| 130 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 130 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 131 | 131 | } else { |
| 132 | 132 | $this->content_type = 'text/xml'; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $result = $this->xml_header($charsetEncoding); |
| 136 | - $result .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
| 137 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 136 | + $result .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
| 137 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 138 | 138 | $result .= "<params>\n"; |
| 139 | 139 | foreach ($this->params as $p) { |
| 140 | - $result .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 140 | + $result .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 141 | 141 | "</param>\n"; |
| 142 | 142 | } |
| 143 | 143 | $result .= "</params>\n"; |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | $this->logDeprecationUnlessCalledBy('createPayload'); |
| 158 | 158 | |
| 159 | 159 | if ($charsetEncoding != '') { |
| 160 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 160 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 161 | 161 | } else { |
| 162 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 162 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -221,14 +221,14 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS) |
| 223 | 223 | { |
| 224 | - if ($this->debug > 0) { |
|
| 224 | + if ($this->debug>0) { |
|
| 225 | 225 | $this->getLogger()->debug("---GOT---\n$data\n---END---"); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 229 | 229 | |
| 230 | 230 | if ($data == '') { |
| 231 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 231 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 232 | 232 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | if (substr($data, 0, 4) == 'HTTP') { |
| 237 | 237 | $httpParser = new Http(); |
| 238 | 238 | try { |
| 239 | - $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0); |
|
| 239 | + $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0); |
|
| 240 | 240 | } catch (HttpException $e) { |
| 241 | 241 | // failed processing of HTTP response headers |
| 242 | 242 | // save into response obj the full payload received, for debugging |
| 243 | 243 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
| 244 | - } catch(\Exception $e) { |
|
| 244 | + } catch (\Exception $e) { |
|
| 245 | 245 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
| 246 | 246 | } |
| 247 | 247 | } else { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
| 258 | 258 | $pos = strrpos($data, '</methodResponse>'); |
| 259 | 259 | if ($pos !== false) { |
| 260 | - $data = substr($data, 0, $pos + 17); |
|
| 260 | + $data = substr($data, 0, $pos+17); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // try to 'guestimate' the character encoding of the received response |
@@ -266,21 +266,21 @@ discard block |
||
| 266 | 266 | $data |
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | - if ($this->debug >= 0) { |
|
| 269 | + if ($this->debug>=0) { |
|
| 270 | 270 | $this->httpResponse = $httpResponse; |
| 271 | 271 | } else { |
| 272 | 272 | $httpResponse = null; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if ($this->debug > 0) { |
|
| 275 | + if ($this->debug>0) { |
|
| 276 | 276 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 277 | 277 | if ($start) { |
| 278 | 278 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 279 | 279 | /// @todo what if there is no end tag? |
| 280 | 280 | $end = strpos($data, '-->', $start); |
| 281 | - $comments = substr($data, $start, $end - $start); |
|
| 282 | - $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t" . |
|
| 283 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding)); |
|
| 281 | + $comments = substr($data, $start, $end-$start); |
|
| 282 | + $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t". |
|
| 283 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding)); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | if ($respEncoding == 'ISO-8859-1') { |
| 303 | 303 | $data = utf8_encode($data); |
| 304 | 304 | } else { |
| 305 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding); |
|
| 305 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | } |
@@ -329,16 +329,16 @@ discard block |
||
| 329 | 329 | // there could be proxies meddling with the request, or network data corruption... |
| 330 | 330 | |
| 331 | 331 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
| 332 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 332 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 333 | 333 | |
| 334 | - if ($this->debug > 0) { |
|
| 334 | + if ($this->debug>0) { |
|
| 335 | 335 | $this->getLogger()->debug($_xh['isf_reason']); |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | // second error check: xml well-formed but not xml-rpc compliant |
| 339 | 339 | elseif ($_xh['isf'] == 2) { |
| 340 | 340 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
| 341 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 341 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 342 | 342 | |
| 343 | 343 | /// @todo echo something for the user? check if it was already done by the parser... |
| 344 | 344 | //if ($this->debug > 0) { |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | // third error check: parsing of the response has somehow gone boink. |
| 349 | 349 | /// @todo shall we omit this check, since we trust the parsing code? |
| 350 | - elseif ($_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value'])) { |
|
| 350 | + elseif ($_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value'])) { |
|
| 351 | 351 | // something odd has happened and it's time to generate a client side error indicating something odd went on |
| 352 | 352 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'], |
| 353 | 353 | '', $httpResponse |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | /// @todo echo something for the user? |
| 357 | 357 | } else { |
| 358 | - if ($this->debug > 1) { |
|
| 358 | + if ($this->debug>1) { |
|
| 359 | 359 | $this->getLogger()->debug( |
| 360 | 360 | "---PARSED---\n".var_export($_xh['value'], true)."\n---END---" |
| 361 | 361 | ); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | if ($errNo == 0) { |
| 380 | 380 | // FAULT returned, errno needs to reflect that |
| 381 | 381 | /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr |
| 382 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 382 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 383 | 383 | $errNo = -1; |
| 384 | 384 | } |
| 385 | 385 | |