Completed
Push — developer ( 31cfdf...98a6c9 )
by Błażej
70:35 queued 28:41
created
libraries/nusoap/class.soap_transport_http.php 2 patches
Doc Comments   +1 added lines, -5 removed lines patch added patch discarded remove patch
@@ -169,10 +169,6 @@  discard block
 block discarded – undo
169 169
 	/**
170 170
 	* establish an HTTP connection
171 171
 	*
172
-	* @param    integer $timeout set connection timeout in seconds
173
-	* @param	integer $response_timeout set response timeout in seconds
174
-	* @return	boolean true if connected, false if not
175
-	* @access   private
176 172
 	*/
177 173
 	public function connect($connection_timeout=0,$response_timeout=30){
178 174
 	  $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
@@ -717,7 +713,7 @@  discard block
 block discarded – undo
717 713
 	*
718 714
 	* @param    string $data message data
719 715
 	* @param	array $cookies cookies to send
720
-	* @return	boolean	true if OK, false if problem
716
+	* @return	boolean|null	true if OK, false if problem
721 717
 	* @access   private
722 718
 	*/
723 719
 	public function sendRequest($data, $cookies = NULL) {
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	var $incoming_cookies = array();
30 30
 	var $outgoing_payload = '';
31 31
 	var $incoming_payload = '';
32
-	var $response_status_line;	// HTTP response status line
32
+	var $response_status_line; // HTTP response status line
33 33
 	var $useSOAPAction = true;
34 34
 	var $persistentConnection = false;
35
-	var $ch = false;	// cURL handle
36
-	var $ch_options = array();	// cURL custom options
37
-	var $use_curl = false;		// force cURL use
38
-	var $proxy = null;			// proxy information (associative array)
35
+	var $ch = false; // cURL handle
36
+	var $ch_options = array(); // cURL custom options
37
+	var $use_curl = false; // force cURL use
38
+	var $proxy = null; // proxy information (associative array)
39 39
 	var $username = '';
40 40
 	var $password = '';
41 41
 	var $authtype = '';
42 42
 	var $digestRequest = array();
43
-	var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
43
+	var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
44 44
 								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
45 45
 								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
46 46
 								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	* @param boolean $use_curl Whether to try to force cURL use
58 58
 	* @access public
59 59
 	*/
60
-	public function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
60
+	public function soap_transport_http($url, $curl_options = NULL, $use_curl = false) {
61 61
 		parent::nusoap_base();
62 62
 		$this->debug("ctor url=$url use_curl=$use_curl curl_options:");
63 63
 		$this->appendDebug($this->varDump($curl_options));
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 		$this->use_curl = $use_curl;
69 69
 		preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
70
-		$this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
70
+		$this->setHeader('User-Agent', $this->title . '/' . $this->version . ' (' . $rev[1] . ')');
71 71
 	}
72 72
 
73 73
 	/**
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 		$this->url = $url;
119 119
 
120 120
 		$u = parse_url($url);
121
-		foreach($u as $k => $v){
121
+		foreach ($u as $k => $v) {
122 122
 			$this->debug("parsed URL $k = $v");
123 123
 			$this->$k = $v;
124 124
 		}
125 125
 		
126 126
 		// add any GET params to path
127
-		if(isset($u['query']) && $u['query'] != ''){
127
+		if (isset($u['query']) && $u['query'] != '') {
128 128
             $this->path .= '?' . $u['query'];
129 129
 		}
130 130
 		
131 131
 		// set default port
132
-		if(!isset($u['port'])){
133
-			if($u['scheme'] == 'https'){
132
+		if (!isset($u['port'])) {
133
+			if ($u['scheme'] == 'https') {
134 134
 				$this->port = 443;
135 135
 			} else {
136 136
 				$this->port = 80;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		if (!isset($u['port'])) {
145 145
 			$this->setHeader('Host', $this->host);
146 146
 		} else {
147
-			$this->setHeader('Host', $this->host.':'.$this->port);
147
+			$this->setHeader('Host', $this->host . ':' . $this->port);
148 148
 		}
149 149
 
150 150
 		if (isset($u['user']) && $u['user'] != '') {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	* @return	boolean true if connected, false if not
175 175
 	* @access   private
176 176
 	*/
177
-	public function connect($connection_timeout=0,$response_timeout=30){
177
+	public function connect($connection_timeout = 0, $response_timeout = 30) {
178 178
 	  $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
179 179
 	  if ($this->io_method() == 'socket') {
180 180
 		if (!is_array($this->proxy)) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		}
187 187
 
188 188
 		// use persistent connection
189
-		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
189
+		if ($this->persistentConnection && isset($this->fp) && is_resource($this->fp)) {
190 190
 			if (!feof($this->fp)) {
191 191
 				$this->debug('Re-use persistent connection');
192 192
 				return true;
@@ -202,17 +202,17 @@  discard block
 block discarded – undo
202 202
 		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
203 203
 
204 204
 		// open socket
205
-		if($connection_timeout > 0){
206
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
205
+		if ($connection_timeout > 0) {
206
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str, $connection_timeout);
207 207
 		} else {
208
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
208
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str);
209 209
 		}
210 210
 		
211 211
 		// test pointer
212
-		if(!$this->fp) {
212
+		if (!$this->fp) {
213 213
 			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
214 214
 			if ($this->errno) {
215
-				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
215
+				$msg .= ', Error (' . $this->errno . '): ' . $this->error_str;
216 216
 			} else {
217 217
 				$msg .= ' prior to connect().  This is often a problem looking up the host name.';
218 218
 			}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		
224 224
 		// set response timeout
225 225
 		$this->debug('set response timeout to ' . $response_timeout);
226
-		socket_set_timeout( $this->fp, $response_timeout);
226
+		socket_set_timeout($this->fp, $response_timeout);
227 227
 
228 228
 		$this->debug('socket connected');
229 229
 		return true;
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
 		if (is_array($this->proxy)) {
363 363
 			$this->debug('set cURL proxy options');
364 364
 			if ($this->proxy['port'] != '') {
365
-				$this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']);
365
+				$this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'] . ':' . $this->proxy['port']);
366 366
 			} else {
367 367
 				$this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']);
368 368
 			}
369 369
 			if ($this->proxy['username'] || $this->proxy['password']) {
370 370
 				$this->debug('set cURL proxy authentication options');
371
-				$this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']);
371
+				$this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'] . ':' . $this->proxy['password']);
372 372
 				if ($this->proxy['authtype'] == 'basic') {
373 373
 					$this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC);
374 374
 				}
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	* @return	string data
397 397
 	* @access   public
398 398
 	*/
399
-	public function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
399
+	public function send($data, $timeout = 0, $response_timeout = 30, $cookies = NULL) {
400 400
 		
401
-		$this->debug('entered send() with data of length: '.strlen($data));
401
+		$this->debug('entered send() with data of length: ' . strlen($data));
402 402
 
403 403
 		$this->tryagain = true;
404 404
 		$tries = 0;
@@ -406,12 +406,12 @@  discard block
 block discarded – undo
406 406
 			$this->tryagain = false;
407 407
 			if ($tries++ < 2) {
408 408
 				// make connnection
409
-				if (!$this->connect($timeout, $response_timeout)){
409
+				if (!$this->connect($timeout, $response_timeout)) {
410 410
 					return false;
411 411
 				}
412 412
 				
413 413
 				// send request
414
-				if (!$this->sendRequest($data, $cookies)){
414
+				if (!$this->sendRequest($data, $cookies)) {
415 415
 					return false;
416 416
 				}
417 417
 				
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	* @access   public
438 438
 	* @deprecated
439 439
 	*/
440
-	public function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
440
+	public function sendHTTPS($data, $timeout = 0, $response_timeout = 30, $cookies) {
441 441
 		return $this->send($data, $timeout, $response_timeout, $cookies);
442 442
 	}
443 443
 	
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		$this->appendDebug($this->varDump($certRequest));
459 459
 		// cf. RFC 2617
460 460
 		if ($authtype == 'basic') {
461
-			$this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password));
461
+			$this->setHeader('Authorization', 'Basic ' . base64_encode(str_replace(':', '', $username) . ':' . $password));
462 462
 		} elseif ($authtype == 'digest') {
463 463
 			if (isset($digestRequest['nonce'])) {
464 464
 				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
467 467
 	
468 468
 				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
469
-				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
469
+				$A1 = $username . ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
470 470
 	
471 471
 				// H(A1) = MD5(A1)
472 472
 				$HA1 = md5($A1);
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 				$A2 = $this->request_method . ':' . $this->digest_uri;
476 476
 	
477 477
 				// H(A2)
478
-				$HA2 =  md5($A2);
478
+				$HA2 = md5($A2);
479 479
 	
480 480
 				// KD(secret, data) = H(concat(secret, ":", data))
481 481
 				// if qop == auth:
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	* @param    string $enc encoding style. supported values: gzip, deflate, or both
536 536
 	* @access   public
537 537
 	*/
538
-	public function setEncoding($enc='gzip, deflate') {
538
+	public function setEncoding($enc = 'gzip, deflate') {
539 539
 		if (function_exists('gzdeflate')) {
540 540
 			$this->protocol_version = '1.1';
541 541
 			$this->setHeader('Accept-Encoding', $enc);
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 				'authtype' => $proxyauthtype
570 570
 			);
571 571
 			if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') {
572
-				$this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword));
572
+				$this->setHeader('Proxy-Authorization', ' Basic ' . base64_encode($proxyusername . ':' . $proxypassword));
573 573
 			}
574 574
 		} else {
575 575
 			$this->debug('remove proxy');
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 	 * @access	private
589 589
 	 */
590 590
 	public function isSkippableCurlHeader(&$data) {
591
-		$skipHeaders = array(	'HTTP/1.1 100',
591
+		$skipHeaders = array('HTTP/1.1 100',
592 592
 								'HTTP/1.0 301',
593 593
 								'HTTP/1.1 301',
594 594
 								'HTTP/1.0 302',
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 	* @access   public
615 615
 	* @deprecated
616 616
 	*/
617
-	public function decodeChunked($buffer, $lb){
617
+	public function decodeChunked($buffer, $lb) {
618 618
 		// length := 0
619 619
 		$length = 0;
620 620
 		$new = '';
@@ -626,17 +626,17 @@  discard block
 block discarded – undo
626 626
 			$this->debug('no linebreak found in decodeChunked');
627 627
 			return $new;
628 628
 		}
629
-		$temp = substr($buffer,0,$chunkend);
630
-		$chunk_size = hexdec( trim($temp) );
629
+		$temp = substr($buffer, 0, $chunkend);
630
+		$chunk_size = hexdec(trim($temp));
631 631
 		$chunkstart = $chunkend + strlen($lb);
632 632
 		// while (chunk-size > 0) {
633 633
 		while ($chunk_size > 0) {
634 634
 			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
635
-			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
635
+			$chunkend = strpos($buffer, $lb, $chunkstart + $chunk_size);
636 636
 		  	
637 637
 			// Just in case we got a broken connection
638 638
 		  	if ($chunkend == FALSE) {
639
-		  	    $chunk = substr($buffer,$chunkstart);
639
+		  	    $chunk = substr($buffer, $chunkstart);
640 640
 				// append chunk-data to entity-body
641 641
 		    	$new .= $chunk;
642 642
 		  	    $length += strlen($chunk);
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			}
645 645
 			
646 646
 		  	// read chunk-data and CRLF
647
-		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
647
+		  	$chunk = substr($buffer, $chunkstart, $chunkend - $chunkstart);
648 648
 		  	// append chunk-data to entity-body
649 649
 		  	$new .= $chunk;
650 650
 		  	// length := length + chunk-size
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 			if ($chunkend == FALSE) {
657 657
 				break; //Just in case we got a broken connection
658 658
 			}
659
-			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
660
-			$chunk_size = hexdec( trim($temp) );
659
+			$temp = substr($buffer, $chunkstart, $chunkend - $chunkstart);
660
+			$chunk_size = hexdec(trim($temp));
661 661
 			$chunkstart = $chunkend;
662 662
 		}
663 663
 		return $new;
@@ -692,15 +692,15 @@  discard block
 block discarded – undo
692 692
 		$this->outgoing_payload = "$req\r\n";
693 693
 
694 694
 		// loop thru headers, serializing
695
-		foreach($this->outgoing_headers as $k => $v){
696
-			$hdr = $k.': '.$v;
695
+		foreach ($this->outgoing_headers as $k => $v) {
696
+			$hdr = $k . ': ' . $v;
697 697
 			$this->debug("HTTP header: $hdr");
698 698
 			$this->outgoing_payload .= "$hdr\r\n";
699 699
 		}
700 700
 
701 701
 		// add any cookies
702 702
 		if ($cookie_str != '') {
703
-			$hdr = 'Cookie: '.$cookie_str;
703
+			$hdr = 'Cookie: ' . $cookie_str;
704 704
 			$this->debug("HTTP header: $hdr");
705 705
 			$this->outgoing_payload .= "$hdr\r\n";
706 706
 		}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 
730 730
 	  if ($this->io_method() == 'socket') {
731 731
 		// send payload
732
-		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
732
+		if (!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
733 733
 			$this->setError('couldn\'t write message data to socket');
734 734
 			$this->debug('couldn\'t write message data to socket');
735 735
 			return false;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 		// turns out that the URI and HTTP version are appended to this, which
743 743
 		// some servers refuse to work with (so we no longer use this method!)
744 744
 		$curl_headers = array();
745
-		foreach($this->outgoing_headers as $k => $v){
745
+		foreach ($this->outgoing_headers as $k => $v) {
746 746
 			if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') {
747 747
 				$this->debug("Skip cURL header $k: $v");
748 748
 			} else {
@@ -776,16 +776,16 @@  discard block
 block discarded – undo
776 776
 	* @return	string the response (also sets member variables like incoming_payload)
777 777
 	* @access   private
778 778
 	*/
779
-	public function getResponse(){
779
+	public function getResponse() {
780 780
 		$this->incoming_payload = '';
781 781
 	    
782 782
 	  if ($this->io_method() == 'socket') {
783 783
 	    // loop until headers have been retrieved
784 784
 	    $data = '';
785
-	    while (!isset($lb)){
785
+	    while (!isset($lb)) {
786 786
 
787 787
 			// We might EOF during header read.
788
-			if(feof($this->fp)) {
788
+			if (feof($this->fp)) {
789 789
 				$this->incoming_payload = $data;
790 790
 				$this->debug('found no headers before EOF after length ' . strlen($data));
791 791
 				$this->debug("received before EOF:\n" . $data);
@@ -806,17 +806,17 @@  discard block
 block discarded – undo
806 806
 			}
807 807
 
808 808
 			$data .= $tmp;
809
-			$pos = strpos($data,"\r\n\r\n");
810
-			if($pos > 1){
809
+			$pos = strpos($data, "\r\n\r\n");
810
+			if ($pos > 1) {
811 811
 				$lb = "\r\n";
812 812
 			} else {
813
-				$pos = strpos($data,"\n\n");
814
-				if($pos > 1){
813
+				$pos = strpos($data, "\n\n");
814
+				if ($pos > 1) {
815 815
 					$lb = "\n";
816 816
 				}
817 817
 			}
818 818
 			// remove 100 headers
819
-			if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) {
819
+			if (isset($lb) && preg_match('/^HTTP\/1.1 100/', $data)) {
820 820
 				unset($lb);
821 821
 				$data = '';
822 822
 			}//
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
 		$this->incoming_payload .= $data;
826 826
 		$this->debug('found end of headers after length ' . strlen($data));
827 827
 		// process headers
828
-		$header_data = trim(substr($data,0,$pos));
829
-		$header_array = explode($lb,$header_data);
828
+		$header_data = trim(substr($data, 0, $pos));
829
+		$header_array = explode($lb, $header_data);
830 830
 		$this->incoming_headers = array();
831 831
 		$this->incoming_cookies = array();
832
-		foreach($header_array as $header_line){
833
-			$arr = explode(':',$header_line, 2);
834
-			if(count($arr) > 1){
832
+		foreach ($header_array as $header_line) {
833
+			$arr = explode(':', $header_line, 2);
834
+			if (count($arr) > 1) {
835 835
 				$header_name = strtolower(trim($arr[0]));
836 836
 				$this->incoming_headers[$header_name] = trim($arr[1]);
837 837
 				if ($header_name == 'set-cookie') {
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 		
852 852
 		// loop until msg has been received
853 853
 		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
854
-			$content_length =  2147483647;	// ignore any content-length header
854
+			$content_length = 2147483647; // ignore any content-length header
855 855
 			$chunked = true;
856 856
 			$this->debug("want to read chunked content");
857 857
 		} elseif (isset($this->incoming_headers['content-length'])) {
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 			$chunked = false;
860 860
 			$this->debug("want to read content of length $content_length");
861 861
 		} else {
862
-			$content_length =  2147483647;
862
+			$content_length = 2147483647;
863 863
 			$chunked = false;
864 864
 			$this->debug("want to read content to EOF");
865 865
 		}
@@ -913,19 +913,19 @@  discard block
 block discarded – undo
913 913
 		}
914 914
 		$this->debug('read body of length ' . strlen($data));
915 915
 		$this->incoming_payload .= $data;
916
-		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
916
+		$this->debug('received a total of ' . strlen($this->incoming_payload) . ' bytes of data from server');
917 917
 		
918 918
 		// close filepointer
919
-		if(
919
+		if (
920 920
 			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 
921
-			(! $this->persistentConnection) || feof($this->fp)){
921
+			(!$this->persistentConnection) || feof($this->fp)) {
922 922
 			fclose($this->fp);
923 923
 			$this->fp = false;
924 924
 			$this->debug('closed socket');
925 925
 		}
926 926
 		
927 927
 		// connection was closed unexpectedly
928
-		if($this->incoming_payload == ''){
928
+		if ($this->incoming_payload == '') {
929 929
 			$this->setError('no response from server');
930 930
 			return false;
931 931
 		}
@@ -949,8 +949,8 @@  discard block
 block discarded – undo
949 949
 
950 950
         $cErr = curl_error($this->ch);
951 951
 		if ($cErr != '') {
952
-        	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
953
-			foreach(curl_getinfo($this->ch) as $k => $v){
952
+        	$err = 'cURL ERROR: ' . curl_errno($this->ch) . ': ' . $cErr . '<br>';
953
+			foreach (curl_getinfo($this->ch) as $k => $v) {
954 954
 				$err .= "$k: $v<br>";
955 955
 			}
956 956
 			$this->debug($err);
@@ -970,44 +970,44 @@  discard block
 block discarded – undo
970 970
 		$savedata = $data;
971 971
 		while ($this->isSkippableCurlHeader($data)) {
972 972
 			$this->debug("Found HTTP header to skip");
973
-			if ($pos = strpos($data,"\r\n\r\n")) {
974
-				$data = ltrim(substr($data,$pos));
975
-			} elseif($pos = strpos($data,"\n\n") ) {
976
-				$data = ltrim(substr($data,$pos));
973
+			if ($pos = strpos($data, "\r\n\r\n")) {
974
+				$data = ltrim(substr($data, $pos));
975
+			} elseif ($pos = strpos($data, "\n\n")) {
976
+				$data = ltrim(substr($data, $pos));
977 977
 			}
978 978
 		}
979 979
 
980 980
 		if ($data == '') {
981 981
 			// have nothing left; just remove 100 header(s)
982 982
 			$data = $savedata;
983
-			while (preg_match('/^HTTP\/1.1 100/',$data)) {
984
-				if ($pos = strpos($data,"\r\n\r\n")) {
985
-					$data = ltrim(substr($data,$pos));
986
-				} elseif($pos = strpos($data,"\n\n") ) {
987
-					$data = ltrim(substr($data,$pos));
983
+			while (preg_match('/^HTTP\/1.1 100/', $data)) {
984
+				if ($pos = strpos($data, "\r\n\r\n")) {
985
+					$data = ltrim(substr($data, $pos));
986
+				} elseif ($pos = strpos($data, "\n\n")) {
987
+					$data = ltrim(substr($data, $pos));
988 988
 				}
989 989
 			}
990 990
 		}
991 991
 		
992 992
 		// separate content from HTTP headers
993
-		if ($pos = strpos($data,"\r\n\r\n")) {
993
+		if ($pos = strpos($data, "\r\n\r\n")) {
994 994
 			$lb = "\r\n";
995
-		} elseif( $pos = strpos($data,"\n\n")) {
995
+		} elseif ($pos = strpos($data, "\n\n")) {
996 996
 			$lb = "\n";
997 997
 		} else {
998 998
 			$this->debug('no proper separation of headers and document');
999 999
 			$this->setError('no proper separation of headers and document');
1000 1000
 			return false;
1001 1001
 		}
1002
-		$header_data = trim(substr($data,0,$pos));
1003
-		$header_array = explode($lb,$header_data);
1004
-		$data = ltrim(substr($data,$pos));
1002
+		$header_data = trim(substr($data, 0, $pos));
1003
+		$header_array = explode($lb, $header_data);
1004
+		$data = ltrim(substr($data, $pos));
1005 1005
 		$this->debug('found proper separation of headers and document');
1006
-		$this->debug('cleaned data, stringlen: '.strlen($data));
1006
+		$this->debug('cleaned data, stringlen: ' . strlen($data));
1007 1007
 		// clean headers
1008 1008
 		foreach ($header_array as $header_line) {
1009
-			$arr = explode(':',$header_line,2);
1010
-			if(count($arr) > 1){
1009
+			$arr = explode(':', $header_line, 2);
1010
+			if (count($arr) > 1) {
1011 1011
 				$header_name = strtolower(trim($arr[0]));
1012 1012
 				$this->incoming_headers[$header_name] = trim($arr[1]);
1013 1013
 				if ($header_name == 'set-cookie') {
@@ -1077,10 +1077,10 @@  discard block
 block discarded – undo
1077 1077
 		}
1078 1078
 
1079 1079
 		// decode content-encoding
1080
-		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
1081
-			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
1080
+		if (isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != '') {
1081
+			if (strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip') {
1082 1082
     			// if decoding works, use it. else assume data wasn't gzencoded
1083
-    			if(function_exists('gzinflate')){
1083
+    			if (function_exists('gzinflate')) {
1084 1084
 					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
1085 1085
 					// this means there are no Zlib headers, although there should be
1086 1086
 					$this->debug('The gzinflate function exists');
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 					}
1121 1121
 					//print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
1122 1122
 					// set decoded payload
1123
-					$this->incoming_payload = $header_data.$lb.$lb.$data;
1123
+					$this->incoming_payload = $header_data . $lb . $lb . $data;
1124 1124
     			} else {
1125 1125
 					$this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
1126 1126
 					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 			$this->debug('No Content-Encoding header');
1134 1134
 		}
1135 1135
 		
1136
-		if(strlen($data) == 0){
1136
+		if (strlen($data) == 0) {
1137 1137
 			$this->debug('no data after headers!');
1138 1138
 			$this->setError('no data present after HTTP headers');
1139 1139
 			return false;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @return	boolean whether the request was honored by this method.
1160 1160
 	 * @access	public
1161 1161
 	 */
1162
-	public function usePersistentConnection(){
1162
+	public function usePersistentConnection() {
1163 1163
 		if (isset($this->outgoing_headers['Accept-Encoding'])) {
1164 1164
 			return false;
1165 1165
 		}
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
 		$cookie_param = 'path=';
1204 1204
 		$start = strpos($cookie_str, $cookie_param);
1205
-		if ( $start > 0 ) {
1205
+		if ($start > 0) {
1206 1206
 			$path = substr($cookie_str, $start + strlen($cookie_param));
1207 1207
 			$path = substr($path, 0, strpos($path, ';'));
1208 1208
 		} else {
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 		if ($sep_pos) {
1222 1222
 			$name = substr($value_str, 0, $sep_pos);
1223 1223
 			$value = substr($value_str, $sep_pos + 1);
1224
-			$cookie= array(	'name' => $name,
1224
+			$cookie = array('name' => $name,
1225 1225
 			                'value' => $value,
1226 1226
 							'domain' => $domain,
1227 1227
 							'path' => $path,
@@ -1241,35 +1241,35 @@  discard block
 block discarded – undo
1241 1241
 	 * @return	string for Cookie-HTTP-Header
1242 1242
 	 * @access	private
1243 1243
 	 */
1244
-	public function getCookiesForRequest($cookies, $secure=false) {
1244
+	public function getCookiesForRequest($cookies, $secure = false) {
1245 1245
 		$cookie_str = '';
1246
-		if ((! is_null($cookies)) && (is_array($cookies))) {
1246
+		if ((!is_null($cookies)) && (is_array($cookies))) {
1247 1247
 			foreach ($cookies as $cookie) {
1248
-				if (! is_array($cookie)) {
1248
+				if (!is_array($cookie)) {
1249 1249
 					continue;
1250 1250
 				}
1251
-	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
1252
-				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
1251
+	    		$this->debug("check cookie for validity: " . $cookie['name'] . '=' . $cookie['value']);
1252
+				if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) {
1253 1253
 					if (strtotime($cookie['expires']) <= time()) {
1254 1254
 						$this->debug('cookie has expired');
1255 1255
 						continue;
1256 1256
 					}
1257 1257
 				}
1258
-				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
1258
+				if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) {
1259 1259
 					$domain = preg_quote($cookie['domain']);
1260
-					if (! preg_match("'.*$domain$'i", $this->host)) {
1260
+					if (!preg_match("'.*$domain$'i", $this->host)) {
1261 1261
 						$this->debug('cookie has different domain');
1262 1262
 						continue;
1263 1263
 					}
1264 1264
 				}
1265
-				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
1265
+				if ((isset($cookie['path'])) && (!empty($cookie['path']))) {
1266 1266
 					$path = preg_quote($cookie['path']);
1267
-					if (! preg_match("'^$path.*'i", $this->path)) {
1267
+					if (!preg_match("'^$path.*'i", $this->path)) {
1268 1268
 						$this->debug('cookie is for a different path');
1269 1269
 						continue;
1270 1270
 					}
1271 1271
 				}
1272
-				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1272
+				if ((!$secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1273 1273
 					$this->debug('cookie is secure, transport is not');
1274 1274
 					continue;
1275 1275
 				}
Please login to merge, or discard this patch.
vtlib/Vtiger/PackageExport.php 1 patch
Doc Comments   +12 added lines, -1 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 	/**
207 207
 	 * Function copies language files to zip
208
-	 * @param <vtlib\Zip> $zip
208
+	 * @param Zip $zip
209 209
 	 * @param <String> $module
210 210
 	 */
211 211
 	public function __copyLanguageFiles($zip, $module)
@@ -240,6 +240,7 @@  discard block
 block discarded – undo
240 240
 	/**
241 241
 	 * Export vtiger dependencies
242 242
 	 * @access private
243
+	 * @param boolean $moduleInstance
243 244
 	 */
244 245
 	public function export_Dependencies($moduleInstance)
245 246
 	{
@@ -376,6 +377,7 @@  discard block
 block discarded – undo
376 377
 	/**
377 378
 	 * Export module blocks with its related fields
378 379
 	 * @access private
380
+	 * @param boolean $moduleInstance
379 381
 	 */
380 382
 	public function export_Blocks($moduleInstance)
381 383
 	{
@@ -539,6 +541,7 @@  discard block
 block discarded – undo
539 541
 	/**
540 542
 	 * Export Custom views of the module
541 543
 	 * @access private
544
+	 * @param boolean $moduleInstance
542 545
 	 */
543 546
 	public function export_CustomViews($moduleInstance)
544 547
 	{
@@ -598,6 +601,7 @@  discard block
 block discarded – undo
598 601
 	/**
599 602
 	 * Export Sharing Access of the module
600 603
 	 * @access private
604
+	 * @param boolean $moduleInstance
601 605
 	 */
602 606
 	public function export_SharingAccess($moduleInstance)
603 607
 	{
@@ -632,6 +636,7 @@  discard block
 block discarded – undo
632 636
 	/**
633 637
 	 * Export Events of the module
634 638
 	 * @access private
639
+	 * @param boolean $moduleInstance
635 640
 	 */
636 641
 	public function export_Events($moduleInstance)
637 642
 	{
@@ -651,6 +656,9 @@  discard block
 block discarded – undo
651 656
 		$this->closeNode('events');
652 657
 	}
653 658
 
659
+	/**
660
+	 * @param boolean $moduleInstance
661
+	 */
654 662
 	public function export_Actions($moduleInstance)
655 663
 	{
656 664
 
@@ -676,6 +684,7 @@  discard block
 block discarded – undo
676 684
 	/**
677 685
 	 * Export related lists associated with module.
678 686
 	 * @access private
687
+	 * @param boolean $moduleInstance
679 688
 	 */
680 689
 	public function export_RelatedLists($moduleInstance)
681 690
 	{
@@ -748,6 +757,7 @@  discard block
 block discarded – undo
748 757
 	/**
749 758
 	 * Export custom links of the module.
750 759
 	 * @access private
760
+	 * @param boolean $moduleInstance
751 761
 	 */
752 762
 	public function export_CustomLinks($moduleInstance)
753 763
 	{
@@ -773,6 +783,7 @@  discard block
 block discarded – undo
773 783
 	/**
774 784
 	 * Export cron tasks for the module.
775 785
 	 * @access private
786
+	 * @param boolean $moduleInstance
776 787
 	 */
777 788
 	public function export_CronTasks($moduleInstance)
778 789
 	{
Please login to merge, or discard this patch.
libraries/nusoap/class.soap_parser.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	var $root_struct_name = '';
22 22
 	var $root_struct_namespace = '';
23 23
 	var $root_header = '';
24
-    var $document = '';			// incoming SOAP body (text)
24
+    var $document = ''; // incoming SOAP body (text)
25 25
 	// determines where in the message we are (envelope,header,body,method)
26 26
 	var $status = '';
27 27
 	var $position = 0;
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	var $fault_detail = '';
37 37
 	var $depth_array = array();
38 38
 	var $debug_flag = true;
39
-	var $soapresponse = NULL;	// parsed SOAP Body
40
-	var $soapheader = NULL;		// parsed SOAP Header
41
-	var $responseHeaders = '';	// incoming SOAP headers (text)
39
+	var $soapresponse = NULL; // parsed SOAP Body
40
+	var $soapheader = NULL; // parsed SOAP Header
41
+	var $responseHeaders = ''; // incoming SOAP headers (text)
42 42
 	var $body_position = 0;
43 43
 	// for multiref parsing:
44 44
 	// array of id => pos
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	* @param    string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
58 58
 	* @access   public
59 59
 	*/
60
-	public function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
60
+	public function nusoap_parser($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = true) {
61 61
 		parent::nusoap_base();
62 62
 		$this->xml = $xml;
63 63
 		$this->xml_encoding = $encoding;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$this->decode_utf8 = $decode_utf8;
66 66
 
67 67
 		// Check whether content has been read.
68
-		if(!empty($xml)){
68
+		if (!empty($xml)) {
69 69
 			// Check XML encoding
70 70
 			$pos_xml = strpos($xml, '<?xml');
71 71
 			if ($pos_xml !== FALSE) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			} else {
90 90
 				$this->debug('No XML declaration');
91 91
 			}
92
-			$this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
92
+			$this->debug('Entering nusoap_parser(), length=' . strlen($xml) . ', encoding=' . $encoding);
93 93
 			// Create an XML parser - why not xml_parser_create_ns?
94 94
 			$this->parser = xml_parser_create($this->xml_encoding);
95 95
 			// Set the options for parsing the XML data.
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 			// Set the object for the parser.
100 100
 			xml_set_object($this->parser, $this);
101 101
 			// Set the element handlers for the parser.
102
-			xml_set_element_handler($this->parser, 'start_element','end_element');
103
-			xml_set_character_data_handler($this->parser,'character_data');
102
+			xml_set_element_handler($this->parser, 'start_element', 'end_element');
103
+			xml_set_character_data_handler($this->parser, 'character_data');
104 104
 
105 105
 			// Parse the XML file.
106
-			if(!xml_parse($this->parser,$xml,true)){
106
+			if (!xml_parse($this->parser, $xml, true)) {
107 107
 			    // Display an error message.
108 108
 			    $err = sprintf('XML error parsing SOAP payload on line %d: %s',
109 109
 			    xml_get_current_line_number($this->parser),
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
 			} else {
115 115
 				$this->debug('in nusoap_parser ctor, message:');
116 116
 				$this->appendDebug($this->varDump($this->message));
117
-				$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
117
+				$this->debug('parsed successfully, found root struct: ' . $this->root_struct . ' of name ' . $this->root_struct_name);
118 118
 				// get final value
119 119
 				$this->soapresponse = $this->message[$this->root_struct]['result'];
120 120
 				// get header value
121
-				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
121
+				if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) {
122 122
 					$this->soapheader = $this->message[$this->root_header]['result'];
123 123
 				}
124 124
 				// resolve hrefs/ids
125
-				if(sizeof($this->multirefs) > 0){
126
-					foreach($this->multirefs as $id => $hrefs){
127
-						$this->debug('resolving multirefs for id: '.$id);
125
+				if (sizeof($this->multirefs) > 0) {
126
+					foreach ($this->multirefs as $id => $hrefs) {
127
+						$this->debug('resolving multirefs for id: ' . $id);
128 128
 						$idVal = $this->buildVal($this->ids[$id]);
129 129
 						if (is_array($idVal) && isset($idVal['!id'])) {
130 130
 							unset($idVal['!id']);
131 131
 						}
132
-						foreach($hrefs as $refPos => $ref){
133
-							$this->debug('resolving href at pos '.$refPos);
132
+						foreach ($hrefs as $refPos => $ref) {
133
+							$this->debug('resolving href at pos ' . $refPos);
134 134
 							$this->multirefs[$id][$refPos] = $idVal;
135 135
 						}
136 136
 					}
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
 		// update class level pos
157 157
 		$pos = $this->position++;
158 158
 		// and set mine
159
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
159
+		$this->message[$pos] = array('pos' => $pos, 'children'=>'', 'cdata'=>'');
160 160
 		// depth = how many levels removed from root?
161 161
 		// set mine as current global depth and increment global depth value
162 162
 		$this->message[$pos]['depth'] = $this->depth++;
163 163
 
164 164
 		// else add self as child to whoever the current parent is
165
-		if($pos != 0){
166
-			$this->message[$this->parent]['children'] .= '|'.$pos;
165
+		if ($pos != 0) {
166
+			$this->message[$this->parent]['children'] .= '|' . $pos;
167 167
 		}
168 168
 		// set my parent
169 169
 		$this->message[$pos]['parent'] = $this->parent;
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 		// set self as current value for this depth
173 173
 		$this->depth_array[$this->depth] = $pos;
174 174
 		// get element prefix
175
-		if(strpos($name,':')){
175
+		if (strpos($name, ':')) {
176 176
 			// get ns prefix
177
-			$prefix = substr($name,0,strpos($name,':'));
177
+			$prefix = substr($name, 0, strpos($name, ':'));
178 178
 			// get unqualified name
179
-			$name = substr(strstr($name,':'),1);
179
+			$name = substr(strstr($name, ':'), 1);
180 180
 		}
181 181
 		// set status
182 182
 		if ($name == 'Envelope' && $this->status == '') {
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 		} elseif ($name == 'Header' && $this->status == 'envelope') {
185 185
 			$this->root_header = $pos;
186 186
 			$this->status = 'header';
187
-		} elseif ($name == 'Body' && $this->status == 'envelope'){
187
+		} elseif ($name == 'Body' && $this->status == 'envelope') {
188 188
 			$this->status = 'body';
189 189
 			$this->body_position = $pos;
190 190
 		// set method
191
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
191
+		} elseif ($this->status == 'body' && $pos == ($this->body_position + 1)) {
192 192
 			$this->status = 'method';
193 193
 			$this->root_struct_name = $name;
194 194
 			$this->root_struct = $pos;
@@ -204,23 +204,23 @@  discard block
 block discarded – undo
204 204
 
205 205
 		// loop through atts, logging ns and type declarations
206 206
         $attstr = '';
207
-		foreach($attrs as $key => $value){
207
+		foreach ($attrs as $key => $value) {
208 208
         	$key_prefix = $this->getPrefix($key);
209 209
 			$key_localpart = $this->getLocalPart($key);
210 210
 			// if ns declarations, add to class level array of valid namespaces
211
-            if($key_prefix == 'xmlns'){
212
-				if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
211
+            if ($key_prefix == 'xmlns') {
212
+				if (preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/', $value)) {
213 213
 					$this->XMLSchemaVersion = $value;
214 214
 					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
215
-					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
215
+					$this->namespaces['xsi'] = $this->XMLSchemaVersion . '-instance';
216 216
 				}
217 217
                 $this->namespaces[$key_localpart] = $value;
218 218
 				// set method namespace
219
-				if($name == $this->root_struct_name){
219
+				if ($name == $this->root_struct_name) {
220 220
 					$this->methodNamespace = $value;
221 221
 				}
222 222
 			// if it's a type declaration, set type
223
-        } elseif($key_localpart == 'type'){
223
+        } elseif ($key_localpart == 'type') {
224 224
         		if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
225 225
         			// do nothing: already processed arrayType
226 226
         		} else {
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 	                $value_localpart = $this->getLocalPart($value);
229 229
 					$this->message[$pos]['type'] = $value_localpart;
230 230
 					$this->message[$pos]['typePrefix'] = $value_prefix;
231
-	                if(isset($this->namespaces[$value_prefix])){
231
+	                if (isset($this->namespaces[$value_prefix])) {
232 232
 	                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
233
-	                } else if(isset($attrs['xmlns:'.$value_prefix])) {
234
-						$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
233
+	                } else if (isset($attrs['xmlns:' . $value_prefix])) {
234
+						$this->message[$pos]['type_namespace'] = $attrs['xmlns:' . $value_prefix];
235 235
 	                }
236 236
 					// should do something here with the namespace of specified type?
237 237
 				}
238
-			} elseif($key_localpart == 'arrayType'){
238
+			} elseif ($key_localpart == 'arrayType') {
239 239
 				$this->message[$pos]['type'] = 'array';
240 240
 				/* do arrayType ereg here
241 241
 				[1]    arrayTypeValue    ::=    atype asize
@@ -246,20 +246,20 @@  discard block
 block discarded – undo
246 246
 				[6]    nextDimension    ::=    Digit+ ','
247 247
 				*/
248 248
 				$expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
249
-				if(preg_match($expr,$value,$regs)){
249
+				if (preg_match($expr, $value, $regs)) {
250 250
 					$this->message[$pos]['typePrefix'] = $regs[1];
251 251
 					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
252 252
 	                if (isset($this->namespaces[$regs[1]])) {
253 253
 	                	$this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
254
-	                } else if (isset($attrs['xmlns:'.$regs[1]])) {
255
-						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
254
+	                } else if (isset($attrs['xmlns:' . $regs[1]])) {
255
+						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:' . $regs[1]];
256 256
 	                }
257 257
 					$this->message[$pos]['arrayType'] = $regs[2];
258 258
 					$this->message[$pos]['arraySize'] = $regs[3];
259 259
 					$this->message[$pos]['arrayCols'] = $regs[4];
260 260
 				}
261 261
 			// specifies nil value (or not)
262
-			} elseif ($key_localpart == 'nil'){
262
+			} elseif ($key_localpart == 'nil') {
263 263
 				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
264 264
 			// some other attribute
265 265
 			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 				$this->default_namespace = $value;
271 271
 			}
272 272
 			// log id
273
-			if($key == 'id'){
273
+			if ($key == 'id') {
274 274
 				$this->ids[$value] = $pos;
275 275
 			}
276 276
 			// root
277
-			if($key_localpart == 'root' && $value == 1){
277
+			if ($key_localpart == 'root' && $value == 1) {
278 278
 				$this->status = 'method';
279 279
 				$this->root_struct_name = $name;
280 280
 				$this->root_struct = $pos;
@@ -284,17 +284,17 @@  discard block
 block discarded – undo
284 284
             $attstr .= " $key=\"$value\"";
285 285
 		}
286 286
         // get namespace - must be done after namespace atts are processed
287
-		if(isset($prefix)){
287
+		if (isset($prefix)) {
288 288
 			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
289 289
 			$this->default_namespace = $this->namespaces[$prefix];
290 290
 		} else {
291 291
 			$this->message[$pos]['namespace'] = $this->default_namespace;
292 292
 		}
293
-        if($this->status == 'header'){
293
+        if ($this->status == 'header') {
294 294
         	if ($this->root_header != $pos) {
295 295
 	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
296 296
 	        }
297
-        } elseif($this->root_struct_name != ''){
297
+        } elseif ($this->root_struct_name != '') {
298 298
         	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
299 299
         }
300 300
 	}
@@ -311,27 +311,27 @@  discard block
 block discarded – undo
311 311
 		$pos = $this->depth_array[$this->depth--];
312 312
 
313 313
         // get element prefix
314
-		if(strpos($name,':')){
314
+		if (strpos($name, ':')) {
315 315
 			// get ns prefix
316
-			$prefix = substr($name,0,strpos($name,':'));
316
+			$prefix = substr($name, 0, strpos($name, ':'));
317 317
 			// get unqualified name
318
-			$name = substr(strstr($name,':'),1);
318
+			$name = substr(strstr($name, ':'), 1);
319 319
 		}
320 320
 		
321 321
 		// build to native type
322
-		if(isset($this->body_position) && $pos > $this->body_position){
322
+		if (isset($this->body_position) && $pos > $this->body_position) {
323 323
 			// deal w/ multirefs
324
-			if(isset($this->message[$pos]['attrs']['href'])){
324
+			if (isset($this->message[$pos]['attrs']['href'])) {
325 325
 				// get id
326
-				$id = substr($this->message[$pos]['attrs']['href'],1);
326
+				$id = substr($this->message[$pos]['attrs']['href'], 1);
327 327
 				// add placeholder to href array
328 328
 				$this->multirefs[$id][$pos] = 'placeholder';
329 329
 				// add set a reference to it as the result value
330
-				$this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
330
+				$this->message[$pos]['result'] = & $this->multirefs[$id][$pos];
331 331
             // build complexType values
332
-			} elseif($this->message[$pos]['children'] != ''){
332
+			} elseif ($this->message[$pos]['children'] != '') {
333 333
 				// if result has already been generated (struct/array)
334
-				if(!isset($this->message[$pos]['result'])){
334
+				if (!isset($this->message[$pos]['result'])) {
335 335
 					$this->message[$pos]['result'] = $this->buildVal($pos);
336 336
 				}
337 337
 			// build complexType values of attributes and possibly simpleContent
@@ -380,15 +380,15 @@  discard block
 block discarded – undo
380 380
 		}
381 381
 		
382 382
         // for doclit
383
-        if($this->status == 'header'){
383
+        if ($this->status == 'header') {
384 384
         	if ($this->root_header != $pos) {
385 385
 	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
386 386
 	        }
387
-        } elseif($pos >= $this->root_struct){
387
+        } elseif ($pos >= $this->root_struct) {
388 388
         	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
389 389
         }
390 390
 		// switch status
391
-		if ($pos == $this->root_struct){
391
+		if ($pos == $this->root_struct) {
392 392
 			$this->status = 'body';
393 393
 			$this->root_struct_namespace = $this->message[$pos]['namespace'];
394 394
 		} elseif ($pos == $this->root_header) {
@@ -411,16 +411,16 @@  discard block
 block discarded – undo
411 411
 	* @param    string $data element content
412 412
 	* @access   private
413 413
 	*/
414
-	public function character_data($parser, $data){
414
+	public function character_data($parser, $data) {
415 415
 		$pos = $this->depth_array[$this->depth];
416
-		if ($this->xml_encoding=='UTF-8'){
417
-			if($this->decode_utf8){
416
+		if ($this->xml_encoding == 'UTF-8') {
417
+			if ($this->decode_utf8) {
418 418
 				$data = utf8_decode($data);
419 419
 			}
420 420
 		}
421 421
         $this->message[$pos]['cdata'] .= $data;
422 422
         // for doclit
423
-        if($this->status == 'header'){
423
+        if ($this->status == 'header') {
424 424
         	$this->responseHeaders .= $data;
425 425
         } else {
426 426
         	$this->document .= $data;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	* @access   public
435 435
 	* @deprecated	use get_soapbody instead
436 436
 	*/
437
-	public function get_response(){
437
+	public function get_response() {
438 438
 		return $this->soapresponse;
439 439
 	}
440 440
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	* @return	mixed
445 445
 	* @access   public
446 446
 	*/
447
-	public function get_soapbody(){
447
+	public function get_soapbody() {
448 448
 		return $this->soapresponse;
449 449
 	}
450 450
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	* @return	mixed
455 455
 	* @access   public
456 456
 	*/
457
-	public function get_soapheader(){
457
+	public function get_soapheader() {
458 458
 		return $this->soapheader;
459 459
 	}
460 460
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	* @return	string XML or empty if no Header
465 465
 	* @access   public
466 466
 	*/
467
-	public function getHeaders(){
467
+	public function getHeaders() {
468 468
 	    return $this->responseHeaders;
469 469
 	}
470 470
 
@@ -520,55 +520,55 @@  discard block
 block discarded – undo
520 520
 	* @return	mixed	PHP value
521 521
 	* @access   private
522 522
 	*/
523
-	public function buildVal($pos){
524
-		if(!isset($this->message[$pos]['type'])){
523
+	public function buildVal($pos) {
524
+		if (!isset($this->message[$pos]['type'])) {
525 525
 			$this->message[$pos]['type'] = '';
526 526
 		}
527
-		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
527
+		$this->debug('in buildVal() for ' . $this->message[$pos]['name'] . "(pos $pos) of type " . $this->message[$pos]['type']);
528 528
 		// if there are children...
529
-		if($this->message[$pos]['children'] != ''){
529
+		if ($this->message[$pos]['children'] != '') {
530 530
 			$this->debug('in buildVal, there are children');
531
-			$children = explode('|',$this->message[$pos]['children']);
531
+			$children = explode('|', $this->message[$pos]['children']);
532 532
 			array_shift($children); // knock off empty
533 533
 			// md array
534
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
535
-            	$r=0; // rowcount
536
-            	$c=0; // colcount
537
-            	foreach($children as $child_pos){
534
+			if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') {
535
+            	$r = 0; // rowcount
536
+            	$c = 0; // colcount
537
+            	foreach ($children as $child_pos) {
538 538
 					$this->debug("in buildVal, got an MD array element: $r, $c");
539 539
 					$params[$r][] = $this->message[$child_pos]['result'];
540 540
 				    $c++;
541
-				    if($c == $this->message[$pos]['arrayCols']){
541
+				    if ($c == $this->message[$pos]['arrayCols']) {
542 542
 				    	$c = 0;
543 543
 						$r++;
544 544
 				    }
545 545
                 }
546 546
             // array
547
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
548
-                $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
549
-                foreach($children as $child_pos){
547
+			} elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') {
548
+                $this->debug('in buildVal, adding array ' . $this->message[$pos]['name']);
549
+                foreach ($children as $child_pos) {
550 550
                 	$params[] = &$this->message[$child_pos]['result'];
551 551
                 }
552 552
             // apache Map type: java hashtable
553
-            } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
554
-                $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
555
-                foreach($children as $child_pos){
556
-                	$kv = explode("|",$this->message[$child_pos]['children']);
553
+            } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
554
+                $this->debug('in buildVal, Java Map ' . $this->message[$pos]['name']);
555
+                foreach ($children as $child_pos) {
556
+                	$kv = explode("|", $this->message[$child_pos]['children']);
557 557
                    	$params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
558 558
                 }
559 559
             // generic compound type
560 560
             //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
561 561
 		    } else {
562 562
 	    		// Apache Vector type: treat as an array
563
-                $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']);
563
+                $this->debug('in buildVal, adding Java Vector or generic compound type ' . $this->message[$pos]['name']);
564 564
 				if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
565 565
 					$notstruct = 1;
566 566
 				} else {
567 567
 					$notstruct = 0;
568 568
 	            }
569 569
             	//
570
-            	foreach($children as $child_pos){
571
-            		if($notstruct){
570
+            	foreach ($children as $child_pos) {
571
+            		if ($notstruct) {
572 572
             			$params[] = &$this->message[$child_pos]['result'];
573 573
             		} else {
574 574
             			if (isset($params[$this->message[$child_pos]['name']])) {
Please login to merge, or discard this patch.