Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/inc/lib/nusoap/class.soap_val.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	* @param	mixed $attributes associative array of attributes to add to element serialization
68 68
 	* @access   public
69 69
 	*/
70
-  	function __construct($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
70
+  	function __construct($name = 'soapval', $type = false, $value = -1, $element_ns = false, $type_ns = false, $attributes = false) {
71 71
 		parent::__construct();
72 72
 		$this->name = $name;
73 73
 		$this->type = $type;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	* @return	string XML data
85 85
 	* @access   public
86 86
 	*/
87
-	function serialize($use='encoded') {
87
+	function serialize($use = 'encoded') {
88 88
 		return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true);
89 89
     }
90 90
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	* @return	mixed
95 95
 	* @access   public
96 96
 	*/
97
-	function decode(){
97
+	function decode() {
98 98
 		return $this->value;
99 99
 	}
100 100
 }
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_parser.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	var $root_struct_name = '';
19 19
 	var $root_struct_namespace = '';
20 20
 	var $root_header = '';
21
-    var $document = '';			// incoming SOAP body (text)
21
+    var $document = ''; // incoming SOAP body (text)
22 22
 	// determines where in the message we are (envelope,header,body,method)
23 23
 	var $status = '';
24 24
 	var $position = 0;
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	var $fault_detail = '';
34 34
 	var $depth_array = array();
35 35
 	var $debug_flag = true;
36
-	var $soapresponse = NULL;	// parsed SOAP Body
37
-	var $soapheader = NULL;		// parsed SOAP Header
38
-	var $responseHeaders = '';	// incoming SOAP headers (text)
36
+	var $soapresponse = NULL; // parsed SOAP Body
37
+	var $soapheader = NULL; // parsed SOAP Header
38
+	var $responseHeaders = ''; // incoming SOAP headers (text)
39 39
 	var $body_position = 0;
40 40
 	// for multiref parsing:
41 41
 	// array of id => pos
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	* @return void|bool
56 56
 	* @access   public
57 57
 	*/
58
-	function __construct($xml,$encoding='UTF-8',$method='',$decode_utf8=true)
58
+	function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = true)
59 59
     {
60 60
 		parent::__construct();
61 61
 		$this->xml = $xml;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		$this->decode_utf8 = $decode_utf8;
65 65
 
66 66
 		// Check whether content has been read.
67
-		if(!empty($this->xml)){
67
+		if (!empty($this->xml)) {
68 68
 			// Check XML encoding
69 69
 			$pos_xml = strpos($xml, '<?xml');
70 70
 			if ($pos_xml !== FALSE) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 				if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
73 73
 					$xml_encoding = $res[1];
74 74
 					if (strtoupper($xml_encoding) != $encoding) {
75
-						$err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
75
+						$err = "Charset from HTTP Content-Type '".$encoding."' does not match encoding from XML declaration '".$xml_encoding."'";
76 76
 						$this->debug($err);
77 77
 						if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
78 78
 							$this->setError($err);
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 			// Set the object for the parser.
99 99
 			xml_set_object($this->parser, $this);
100 100
 			// Set the element handlers for the parser.
101
-			xml_set_element_handler($this->parser, 'start_element','end_element');
102
-			xml_set_character_data_handler($this->parser,'character_data');
101
+			xml_set_element_handler($this->parser, 'start_element', 'end_element');
102
+			xml_set_character_data_handler($this->parser, 'character_data');
103 103
 
104 104
 			xml_parse($this->parser, $this->xml);
105 105
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			    xml_get_current_line_number($this->parser),
112 112
 			    xml_error_string(xml_get_error_code($this->parser)));
113 113
 				$this->debug($err);
114
-				$this->debug("XML payload:\n" . $xml);
114
+				$this->debug("XML payload:\n".$xml);
115 115
 				$this->setError($err);
116 116
 			} else {
117 117
 				$this->debug('in nusoap_parser ctor, message:');
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
 				// get final value
121 121
 				$this->soapresponse = $this->message[$this->root_struct]['result'];
122 122
 				// get header value
123
-				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
123
+				if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) {
124 124
 					$this->soapheader = $this->message[$this->root_header]['result'];
125 125
 				}
126 126
 				// resolve hrefs/ids
127
-				if(sizeof($this->multirefs) > 0){
128
-					foreach($this->multirefs as $id => $hrefs){
127
+				if (sizeof($this->multirefs) > 0) {
128
+					foreach ($this->multirefs as $id => $hrefs) {
129 129
 						$this->debug('resolving multirefs for id: '.$id);
130 130
 						$idVal = $this->buildVal($this->ids[$id]);
131 131
 						if (is_array($idVal) && isset($idVal['!id'])) {
132 132
 							unset($idVal['!id']);
133 133
 						}
134
-						foreach($hrefs as $refPos => $ref){
134
+						foreach ($hrefs as $refPos => $ref) {
135 135
 							$this->debug('resolving href at pos '.$refPos);
136 136
 							$this->multirefs[$id][$refPos] = $idVal;
137 137
 						}
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 		// update class level pos
160 160
 		$pos = $this->position++;
161 161
 		// and set mine
162
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
162
+		$this->message[$pos] = array('pos' => $pos, 'children'=>'', 'cdata'=>'');
163 163
 		// depth = how many levels removed from root?
164 164
 		// set mine as current global depth and increment global depth value
165 165
 		$this->message[$pos]['depth'] = $this->depth++;
166 166
 
167 167
 		// else add self as child to whoever the current parent is
168
-		if($pos != 0){
168
+		if ($pos != 0) {
169 169
 			$this->message[$this->parent]['children'] .= '|'.$pos;
170 170
 		}
171 171
 		// set my parent
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 		// set self as current value for this depth
176 176
 		$this->depth_array[$this->depth] = $pos;
177 177
 		// get element prefix
178
-		if(strpos($name,':')){
178
+		if (strpos($name, ':')) {
179 179
 			// get ns prefix
180
-			$prefix = substr($name,0,strpos($name,':'));
180
+			$prefix = substr($name, 0, strpos($name, ':'));
181 181
 			// get unqualified name
182
-			$name = substr(strstr($name,':'),1);
182
+			$name = substr(strstr($name, ':'), 1);
183 183
 		}
184 184
 		// set status
185 185
 		if ($name == 'Envelope' && $this->status == '') {
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 		} elseif ($name == 'Header' && $this->status == 'envelope') {
188 188
 			$this->root_header = $pos;
189 189
 			$this->status = 'header';
190
-		} elseif ($name == 'Body' && $this->status == 'envelope'){
190
+		} elseif ($name == 'Body' && $this->status == 'envelope') {
191 191
 			$this->status = 'body';
192 192
 			$this->body_position = $pos;
193 193
 		// set method
194
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
194
+		} elseif ($this->status == 'body' && $pos == ($this->body_position + 1)) {
195 195
 			$this->status = 'method';
196 196
 			$this->root_struct_name = $name;
197 197
 			$this->root_struct = $pos;
@@ -207,23 +207,23 @@  discard block
 block discarded – undo
207 207
 
208 208
 		// loop through atts, logging ns and type declarations
209 209
         $attstr = '';
210
-		foreach($attrs as $key => $value){
210
+		foreach ($attrs as $key => $value) {
211 211
         	$key_prefix = $this->getPrefix($key);
212 212
 			$key_localpart = $this->getLocalPart($key);
213 213
 			// if ns declarations, add to class level array of valid namespaces
214
-            if($key_prefix == 'xmlns'){
215
-				if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
214
+            if ($key_prefix == 'xmlns') {
215
+				if (preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/', $value)) {
216 216
 					$this->XMLSchemaVersion = $value;
217 217
 					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
218 218
 					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
219 219
 				}
220 220
                 $this->namespaces[$key_localpart] = $value;
221 221
 				// set method namespace
222
-				if($name == $this->root_struct_name){
222
+				if ($name == $this->root_struct_name) {
223 223
 					$this->methodNamespace = $value;
224 224
 				}
225 225
 			// if it's a type declaration, set type
226
-        } elseif($key_localpart == 'type'){
226
+        } elseif ($key_localpart == 'type') {
227 227
         		if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
228 228
         			// do nothing: already processed arrayType
229 229
         		} else {
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
 	                $value_localpart = $this->getLocalPart($value);
232 232
 					$this->message[$pos]['type'] = $value_localpart;
233 233
 					$this->message[$pos]['typePrefix'] = $value_prefix;
234
-	                if(isset($this->namespaces[$value_prefix])){
234
+	                if (isset($this->namespaces[$value_prefix])) {
235 235
 	                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
236
-	                } else if(isset($attrs['xmlns:'.$value_prefix])) {
236
+	                } else if (isset($attrs['xmlns:'.$value_prefix])) {
237 237
 						$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
238 238
 	                }
239 239
 					// should do something here with the namespace of specified type?
240 240
 				}
241
-			} elseif($key_localpart == 'arrayType'){
241
+			} elseif ($key_localpart == 'arrayType') {
242 242
 				$this->message[$pos]['type'] = 'array';
243 243
 				/* do arrayType ereg here
244 244
 				[1]    arrayTypeValue    ::=    atype asize
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 				[6]    nextDimension    ::=    Digit+ ','
250 250
 				*/
251 251
 				$expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
252
-				if(preg_match($expr,$value,$regs)){
252
+				if (preg_match($expr, $value, $regs)) {
253 253
 					$this->message[$pos]['typePrefix'] = $regs[1];
254 254
 					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
255 255
 	                if (isset($this->namespaces[$regs[1]])) {
@@ -262,22 +262,22 @@  discard block
 block discarded – undo
262 262
 					$this->message[$pos]['arrayCols'] = $regs[4];
263 263
 				}
264 264
 			// specifies nil value (or not)
265
-			} elseif ($key_localpart == 'nil'){
265
+			} elseif ($key_localpart == 'nil') {
266 266
 				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
267 267
 			// some other attribute
268 268
 			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
269
-				$this->message[$pos]['xattrs']['!' . $key] = $value;
269
+				$this->message[$pos]['xattrs']['!'.$key] = $value;
270 270
 			}
271 271
 
272 272
 			if ($key == 'xmlns') {
273 273
 				$this->default_namespace = $value;
274 274
 			}
275 275
 			// log id
276
-			if($key == 'id'){
276
+			if ($key == 'id') {
277 277
 				$this->ids[$value] = $pos;
278 278
 			}
279 279
 			// root
280
-			if($key_localpart == 'root' && $value == 1){
280
+			if ($key_localpart == 'root' && $value == 1) {
281 281
 				$this->status = 'method';
282 282
 				$this->root_struct_name = $name;
283 283
 				$this->root_struct = $pos;
@@ -287,18 +287,18 @@  discard block
 block discarded – undo
287 287
             $attstr .= " $key=\"$value\"";
288 288
 		}
289 289
         // get namespace - must be done after namespace atts are processed
290
-		if(isset($prefix)){
290
+		if (isset($prefix)) {
291 291
 			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
292 292
 			$this->default_namespace = $this->namespaces[$prefix];
293 293
 		} else {
294 294
 			$this->message[$pos]['namespace'] = $this->default_namespace;
295 295
 		}
296
-        if($this->status == 'header'){
296
+        if ($this->status == 'header') {
297 297
         	if ($this->root_header != $pos) {
298
-	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
298
+	        	$this->responseHeaders .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>";
299 299
 	        }
300
-        } elseif($this->root_struct_name != ''){
301
-        	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
300
+        } elseif ($this->root_struct_name != '') {
301
+        	$this->document .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>";
302 302
         }
303 303
 	}
304 304
 
@@ -314,27 +314,27 @@  discard block
 block discarded – undo
314 314
 		$pos = $this->depth_array[$this->depth--];
315 315
 
316 316
         // get element prefix
317
-		if(strpos($name,':')){
317
+		if (strpos($name, ':')) {
318 318
 			// get ns prefix
319
-			$prefix = substr($name,0,strpos($name,':'));
319
+			$prefix = substr($name, 0, strpos($name, ':'));
320 320
 			// get unqualified name
321
-			$name = substr(strstr($name,':'),1);
321
+			$name = substr(strstr($name, ':'), 1);
322 322
 		}
323 323
 
324 324
 		// build to native type
325
-		if(isset($this->body_position) && $pos > $this->body_position){
325
+		if (isset($this->body_position) && $pos > $this->body_position) {
326 326
 			// deal w/ multirefs
327
-			if(isset($this->message[$pos]['attrs']['href'])){
327
+			if (isset($this->message[$pos]['attrs']['href'])) {
328 328
 				// get id
329
-				$id = substr($this->message[$pos]['attrs']['href'],1);
329
+				$id = substr($this->message[$pos]['attrs']['href'], 1);
330 330
 				// add placeholder to href array
331 331
 				$this->multirefs[$id][$pos] = 'placeholder';
332 332
 				// add set a reference to it as the result value
333
-				$this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
333
+				$this->message[$pos]['result'] = & $this->multirefs[$id][$pos];
334 334
             // build complexType values
335
-			} elseif($this->message[$pos]['children'] != ''){
335
+			} elseif ($this->message[$pos]['children'] != '') {
336 336
 				// if result has already been generated (struct/array)
337
-				if(!isset($this->message[$pos]['result'])){
337
+				if (!isset($this->message[$pos]['result'])) {
338 338
 					$this->message[$pos]['result'] = $this->buildVal($pos);
339 339
 				}
340 340
 			// build complexType values of attributes and possibly simpleContent
@@ -384,15 +384,15 @@  discard block
 block discarded – undo
384 384
 		}
385 385
 
386 386
         // for doclit
387
-        if($this->status == 'header'){
387
+        if ($this->status == 'header') {
388 388
         	if ($this->root_header != $pos) {
389
-	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
389
+	        	$this->responseHeaders .= "</".(isset($prefix) ? $prefix.':' : '')."$name>";
390 390
 	        }
391
-        } elseif($pos >= $this->root_struct){
392
-        	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
391
+        } elseif ($pos >= $this->root_struct) {
392
+        	$this->document .= "</".(isset($prefix) ? $prefix.':' : '')."$name>";
393 393
         }
394 394
 		// switch status
395
-		if ($pos == $this->root_struct){
395
+		if ($pos == $this->root_struct) {
396 396
 			$this->status = 'body';
397 397
 			$this->root_struct_namespace = $this->message[$pos]['namespace'];
398 398
 		} elseif ($pos == $this->root_header) {
@@ -418,17 +418,17 @@  discard block
 block discarded – undo
418 418
 	function character_data($parser, $data)
419 419
     {
420 420
 		$pos = $this->depth_array[$this->depth];
421
-		if ($this->xml_encoding == 'UTF-8'){
421
+		if ($this->xml_encoding == 'UTF-8') {
422 422
 			// TODO: add an option to disable this for folks who want
423 423
 			// raw UTF-8 that, e.g., might not map to iso-8859-1
424 424
 			// TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
425
-			if($this->decode_utf8){
425
+			if ($this->decode_utf8) {
426 426
 				$data = utf8_decode($data);
427 427
 			}
428 428
 		}
429 429
         $this->message[$pos]['cdata'] .= $data;
430 430
         // for doclit
431
-        if($this->status == 'header'){
431
+        if ($this->status == 'header') {
432 432
         	$this->responseHeaders .= $data;
433 433
         } else {
434 434
         	$this->document .= $data;
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	* @access   public
443 443
 	* @deprecated	use get_soapbody instead
444 444
 	*/
445
-	function get_response(){
445
+	function get_response() {
446 446
 		return $this->soapresponse;
447 447
 	}
448 448
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	* @return	mixed
453 453
 	* @access   public
454 454
 	*/
455
-	function get_soapbody(){
455
+	function get_soapbody() {
456 456
 		return $this->soapresponse;
457 457
 	}
458 458
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	* @return	mixed
463 463
 	* @access   public
464 464
 	*/
465
-	function get_soapheader(){
465
+	function get_soapheader() {
466 466
 		return $this->soapheader;
467 467
 	}
468 468
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	* @return	string XML or empty if no Header
473 473
 	* @access   public
474 474
 	*/
475
-	function getHeaders(){
475
+	function getHeaders() {
476 476
 	    return $this->responseHeaders;
477 477
 	}
478 478
 
@@ -529,40 +529,40 @@  discard block
 block discarded – undo
529 529
 	* @return	mixed	PHP value
530 530
 	* @access   private
531 531
 	*/
532
-	function buildVal($pos){
533
-		if(!isset($this->message[$pos]['type'])){
532
+	function buildVal($pos) {
533
+		if (!isset($this->message[$pos]['type'])) {
534 534
 			$this->message[$pos]['type'] = '';
535 535
 		}
536 536
 		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
537 537
 		// if there are children...
538
-		if($this->message[$pos]['children'] != ''){
538
+		if ($this->message[$pos]['children'] != '') {
539 539
 			$this->debug('in buildVal, there are children');
540
-			$children = explode('|',$this->message[$pos]['children']);
540
+			$children = explode('|', $this->message[$pos]['children']);
541 541
 			array_shift($children); // knock off empty
542 542
 			// md array
543
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
544
-            	$r=0; // rowcount
545
-            	$c=0; // colcount
546
-            	foreach($children as $child_pos){
543
+			if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') {
544
+            	$r = 0; // rowcount
545
+            	$c = 0; // colcount
546
+            	foreach ($children as $child_pos) {
547 547
 					$this->debug("in buildVal, got an MD array element: $r, $c");
548 548
 					$params[$r][] = $this->message[$child_pos]['result'];
549 549
 				    $c++;
550
-				    if($c == $this->message[$pos]['arrayCols']){
550
+				    if ($c == $this->message[$pos]['arrayCols']) {
551 551
 				    	$c = 0;
552 552
 						$r++;
553 553
 				    }
554 554
                 }
555 555
             // array
556
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
556
+			} elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') {
557 557
                 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
558
-                foreach($children as $child_pos){
558
+                foreach ($children as $child_pos) {
559 559
                 	$params[] = &$this->message[$child_pos]['result'];
560 560
                 }
561 561
             // apache Map type: java hashtable
562
-            } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
562
+            } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
563 563
                 $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
564
-                foreach($children as $child_pos){
565
-                	$kv = explode("|",$this->message[$child_pos]['children']);
564
+                foreach ($children as $child_pos) {
565
+                	$kv = explode("|", $this->message[$child_pos]['children']);
566 566
                    	$params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
567 567
                 }
568 568
             // generic compound type
@@ -576,8 +576,8 @@  discard block
 block discarded – undo
576 576
 					$notstruct = 0;
577 577
 	            }
578 578
             	//
579
-            	foreach($children as $child_pos){
580
-            		if($notstruct){
579
+            	foreach ($children as $child_pos) {
580
+            		if ($notstruct) {
581 581
             			$params[] = &$this->message[$child_pos]['result'];
582 582
             		} else {
583 583
             			if (isset($params[$this->message[$child_pos]['name']])) {
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.wsdlcache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	* @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
46 46
 	* @access public
47 47
 	*/
48
-	function __construct($cache_dir='.', $cache_lifetime=0) {
48
+	function __construct($cache_dir = '.', $cache_lifetime = 0) {
49 49
 		$this->fplock = array();
50 50
 		$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
51 51
 		$this->cache_lifetime = $cache_lifetime;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	* @access private
60 60
 	*/
61 61
 	function createFilename($wsdl) {
62
-		return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
62
+		return $this->cache_dir.'/wsdlcache-'.md5($wsdl);
63 63
 	}
64 64
 
65 65
 	/**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	* @param    string $string debug data
69 69
 	* @access   private
70 70
 	*/
71
-	function debug($string){
71
+	function debug($string) {
72 72
 		$this->debug_str .= get_class($this).": $string\n";
73 73
 	}
74 74
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$s = serialize($wsdl_instance);
148 148
 		if ($this->obtainMutex($filename, "w")) {
149 149
 			$fp = fopen($filename, "w");
150
-			if (! $fp) {
150
+			if (!$fp) {
151 151
 				$this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
152 152
 				$this->releaseMutex($filename);
153 153
 				return false;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		$ret = flock($this->fplock[md5($filename)], LOCK_UN);
175 175
 		fclose($this->fplock[md5($filename)]);
176 176
 		unset($this->fplock[md5($filename)]);
177
-		if (! $ret) {
177
+		if (!$ret) {
178 178
 			$this->debug("Not able to release lock for $filename");
179 179
 		}
180 180
 		return $ret;
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_fault.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     * @param string $faultstring human readable error message
44 44
     * @param mixed $faultdetail detail, typically a string or array of string
45 45
 	*/
46
-	public function __construct($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
46
+	public function __construct($faultcode, $faultactor = '', $faultstring = '', $faultdetail = '') {
47 47
 		parent::__construct();
48 48
 		$this->faultcode = $faultcode;
49 49
 		$this->faultactor = $faultactor;
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	* @return	string	The serialization of the fault instance.
58 58
 	* @access   public
59 59
 	*/
60
-	function serialize(){
60
+	function serialize() {
61 61
 		$ns_string = '';
62
-		foreach($this->namespaces as $k => $v){
62
+		foreach ($this->namespaces as $k => $v) {
63 63
 			$ns_string .= "\n  xmlns:$k=\"$v\"";
64 64
 		}
65 65
 		$return_msg =
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_transport_http.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 	var $incoming_cookies = array();
27 27
 	var $outgoing_payload = '';
28 28
 	var $incoming_payload = '';
29
-	var $response_status_line;	// HTTP response status line
29
+	var $response_status_line; // HTTP response status line
30 30
 	var $useSOAPAction = true;
31 31
 	var $persistentConnection = false;
32
-	var $ch = false;	// cURL handle
33
-	var $ch_options = array();	// cURL custom options
34
-	var $use_curl = false;		// force cURL use
35
-	var $proxy = null;			// proxy information (associative array)
32
+	var $ch = false; // cURL handle
33
+	var $ch_options = array(); // cURL custom options
34
+	var $use_curl = false; // force cURL use
35
+	var $proxy = null; // proxy information (associative array)
36 36
 	var $username = '';
37 37
 	var $password = '';
38 38
 	var $authtype = '';
39 39
 	var $digestRequest = array();
40
-	var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
40
+	var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
41 41
 								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
42 42
 								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
43 43
 								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	* @param boolean $use_curl Whether to try to force cURL use
55 55
 	* @access public
56 56
 	*/
57
-	function __construct($url, $curl_options = NULL, $use_curl = false){
57
+	function __construct($url, $curl_options = NULL, $use_curl = false) {
58 58
 		parent::__construct();
59 59
 		$this->debug("ctor url=$url use_curl=$use_curl curl_options:");
60 60
 		$this->appendDebug($this->varDump($curl_options));
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			$this->ch_options = $curl_options;
64 64
 		}
65 65
 		$this->use_curl = $use_curl;
66
-		preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
66
+		preg_match('/\$Revisio'.'n: ([^ ]+)/', $this->revision, $rev);
67 67
 		$this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
68 68
 	}
69 69
 
@@ -115,19 +115,19 @@  discard block
 block discarded – undo
115 115
 		$this->url = $url;
116 116
 
117 117
 		$u = parse_url($url);
118
-		foreach($u as $k => $v){
118
+		foreach ($u as $k => $v) {
119 119
 			$this->debug("parsed URL $k = $v");
120 120
 			$this->$k = $v;
121 121
 		}
122 122
 
123 123
 		// add any GET params to path
124
-		if(isset($u['query']) && $u['query'] != ''){
125
-            $this->path .= '?' . $u['query'];
124
+		if (isset($u['query']) && $u['query'] != '') {
125
+            $this->path .= '?'.$u['query'];
126 126
 		}
127 127
 
128 128
 		// set default port
129
-		if(!isset($u['port'])){
130
-			if($u['scheme'] == 'https'){
129
+		if (!isset($u['port'])) {
130
+			if ($u['scheme'] == 'https') {
131 131
 				$this->port = 443;
132 132
 			} else {
133 133
 				$this->port = 80;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	* @return	boolean true if connected, false if not
172 172
 	* @access   private
173 173
 	*/
174
-	function connect($connection_timeout=0,$response_timeout=30){
174
+	function connect($connection_timeout = 0, $response_timeout = 30) {
175 175
 	  	// For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
176 176
 	  	// "regular" socket.
177 177
 	  	// TODO: disabled for now because OpenSSL must be *compiled* in (not just
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		}
196 196
 
197 197
 		// use persistent connection
198
-		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
198
+		if ($this->persistentConnection && isset($this->fp) && is_resource($this->fp)) {
199 199
 			if (!feof($this->fp)) {
200 200
 				$this->debug('Re-use persistent connection');
201 201
 				return true;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 
207 207
 		// munge host if using OpenSSL
208 208
 		if ($this->scheme == 'ssl') {
209
-			$host = 'ssl://' . $host;
209
+			$host = 'ssl://'.$host;
210 210
 		}
211
-		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
211
+		$this->debug('calling fsockopen with host '.$host.' connection_timeout '.$connection_timeout);
212 212
 
213 213
 		// open socket
214
-		if($connection_timeout > 0){
215
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
214
+		if ($connection_timeout > 0) {
215
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str, $connection_timeout);
216 216
 		} else {
217
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
217
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str);
218 218
 		}
219 219
 
220 220
 		// test pointer
221
-		if(!$this->fp) {
222
-			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
221
+		if (!$this->fp) {
222
+			$msg = 'Couldn\'t open socket connection to server '.$this->url;
223 223
 			if ($this->errno) {
224 224
 				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
225 225
 			} else {
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 		}
232 232
 
233 233
 		// set response timeout
234
-		$this->debug('set response timeout to ' . $response_timeout);
235
-		socket_set_timeout( $this->fp, $response_timeout);
234
+		$this->debug('set response timeout to '.$response_timeout);
235
+		socket_set_timeout($this->fp, $response_timeout);
236 236
 
237 237
 		$this->debug('socket connected');
238 238
 		return true;
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 		$this->debug('cURL connection set up');
392 392
 		return true;
393 393
 	  } else {
394
-		$this->setError('Unknown scheme ' . $this->scheme);
395
-		$this->debug('Unknown scheme ' . $this->scheme);
394
+		$this->setError('Unknown scheme '.$this->scheme);
395
+		$this->debug('Unknown scheme '.$this->scheme);
396 396
 		return false;
397 397
 	  }
398 398
 	}
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	* @return	string data
408 408
 	* @access   public
409 409
 	*/
410
-	function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
410
+	function send($data, $timeout = 0, $response_timeout = 30, $cookies = NULL) {
411 411
 
412 412
 		$this->debug('entered send() with data of length: '.strlen($data));
413 413
 
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 			$this->tryagain = false;
418 418
 			if ($tries++ < 2) {
419 419
 				// make connnection
420
-				if (!$this->connect($timeout, $response_timeout)){
420
+				if (!$this->connect($timeout, $response_timeout)) {
421 421
 					return false;
422 422
 				}
423 423
 
424 424
 				// send request
425
-				if (!$this->sendRequest($data, $cookies)){
425
+				if (!$this->sendRequest($data, $cookies)) {
426 426
 					return false;
427 427
 				}
428 428
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	* @access   public
449 449
 	* @deprecated
450 450
 	*/
451
-	function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
451
+	function sendHTTPS($data, $timeout = 0, $response_timeout = 30, $cookies) {
452 452
 		return $this->send($data, $timeout, $response_timeout, $cookies);
453 453
 	}
454 454
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 		$this->appendDebug($this->varDump($certRequest));
470 470
 		// cf. RFC 2617
471 471
 		if ($authtype == 'basic') {
472
-			$this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password));
472
+			$this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':', '', $username).':'.$password));
473 473
 		} elseif ($authtype == 'digest') {
474 474
 			if (isset($digestRequest['nonce'])) {
475 475
 				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
@@ -477,16 +477,16 @@  discard block
 block discarded – undo
477 477
 				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
478 478
 
479 479
 				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
480
-				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
480
+				$A1 = $username.':'.(isset($digestRequest['realm']) ? $digestRequest['realm'] : '').':'.$password;
481 481
 
482 482
 				// H(A1) = MD5(A1)
483 483
 				$HA1 = md5($A1);
484 484
 
485 485
 				// A2 = Method ":" digest-uri-value
486
-				$A2 = $this->request_method . ':' . $this->digest_uri;
486
+				$A2 = $this->request_method.':'.$this->digest_uri;
487 487
 
488 488
 				// H(A2)
489
-				$HA2 =  md5($A2);
489
+				$HA2 = md5($A2);
490 490
 
491 491
 				// KD(secret, data) = H(concat(secret, ":", data))
492 492
 				// if qop == auth:
@@ -503,19 +503,19 @@  discard block
 block discarded – undo
503 503
 				$nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
504 504
 				$cnonce = $nonce;
505 505
 				if ($digestRequest['qop'] != '') {
506
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
506
+					$unhashedDigest = $HA1.':'.$nonce.':'.sprintf("%08d", $digestRequest['nc']).':'.$cnonce.':'.$digestRequest['qop'].':'.$HA2;
507 507
 				} else {
508
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
508
+					$unhashedDigest = $HA1.':'.$nonce.':'.$HA2;
509 509
 				}
510 510
 
511 511
 				$hashedDigest = md5($unhashedDigest);
512 512
 
513 513
 				$opaque = '';
514 514
 				if (isset($digestRequest['opaque'])) {
515
-					$opaque = ', opaque="' . $digestRequest['opaque'] . '"';
515
+					$opaque = ', opaque="'.$digestRequest['opaque'].'"';
516 516
 				}
517 517
 
518
-				$this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"');
518
+				$this->setHeader('Authorization', 'Digest username="'.$username.'", realm="'.$digestRequest['realm'].'", nonce="'.$nonce.'", uri="'.$this->digest_uri.$opaque.'", cnonce="'.$cnonce.'", nc='.sprintf("%08x", $digestRequest['nc']).', qop="'.$digestRequest['qop'].'", response="'.$hashedDigest.'"');
519 519
 			}
520 520
 		} elseif ($authtype == 'certificate') {
521 521
 			$this->certRequest = $certRequest;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	* @access   public
538 538
 	*/
539 539
 	function setSOAPAction($soapaction) {
540
-		$this->setHeader('SOAPAction', '"' . $soapaction . '"');
540
+		$this->setHeader('SOAPAction', '"'.$soapaction.'"');
541 541
 	}
542 542
 
543 543
 	/**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	* @param    string $enc encoding style. supported values: gzip, deflate, or both
547 547
 	* @access   public
548 548
 	*/
549
-	function setEncoding($enc='gzip, deflate') {
549
+	function setEncoding($enc = 'gzip, deflate') {
550 550
 		if (function_exists('gzdeflate')) {
551 551
 			$this->protocol_version = '1.1';
552 552
 			$this->setHeader('Accept-Encoding', $enc);
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	 * @access	private
600 600
 	 */
601 601
 	function isSkippableCurlHeader(&$data) {
602
-		$skipHeaders = array(	'HTTP/1.1 100',
602
+		$skipHeaders = array('HTTP/1.1 100',
603 603
 								'HTTP/1.0 301',
604 604
 								'HTTP/1.1 301',
605 605
 								'HTTP/1.0 302',
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	* @access   public
626 626
 	* @deprecated
627 627
 	*/
628
-	function decodeChunked($buffer, $lb){
628
+	function decodeChunked($buffer, $lb) {
629 629
 		// length := 0
630 630
 		$length = 0;
631 631
 		$new = '';
@@ -637,17 +637,17 @@  discard block
 block discarded – undo
637 637
 			$this->debug('no linebreak found in decodeChunked');
638 638
 			return $new;
639 639
 		}
640
-		$temp = substr($buffer,0,$chunkend);
641
-		$chunk_size = hexdec( trim($temp) );
640
+		$temp = substr($buffer, 0, $chunkend);
641
+		$chunk_size = hexdec(trim($temp));
642 642
 		$chunkstart = $chunkend + strlen($lb);
643 643
 		// while (chunk-size > 0) {
644 644
 		while ($chunk_size > 0) {
645 645
 			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
646
-			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
646
+			$chunkend = strpos($buffer, $lb, $chunkstart + $chunk_size);
647 647
 
648 648
 			// Just in case we got a broken connection
649 649
 		  	if ($chunkend == FALSE) {
650
-		  	    $chunk = substr($buffer,$chunkstart);
650
+		  	    $chunk = substr($buffer, $chunkstart);
651 651
 				// append chunk-data to entity-body
652 652
 		    	$new .= $chunk;
653 653
 		  	    $length += strlen($chunk);
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 			}
656 656
 
657 657
 		  	// read chunk-data and CRLF
658
-		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
658
+		  	$chunk = substr($buffer, $chunkstart, $chunkend - $chunkstart);
659 659
 		  	// append chunk-data to entity-body
660 660
 		  	$new .= $chunk;
661 661
 		  	// length := length + chunk-size
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 			if ($chunkend == FALSE) {
668 668
 				break; //Just in case we got a broken connection
669 669
 			}
670
-			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
671
-			$chunk_size = hexdec( trim($temp) );
670
+			$temp = substr($buffer, $chunkstart, $chunkend - $chunkstart);
671
+			$chunk_size = hexdec(trim($temp));
672 672
 			$chunkstart = $chunkend;
673 673
 		}
674 674
 		return $new;
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 		$this->outgoing_payload = "$req\r\n";
704 704
 
705 705
 		// loop thru headers, serializing
706
-		foreach($this->outgoing_headers as $k => $v){
706
+		foreach ($this->outgoing_headers as $k => $v) {
707 707
 			$hdr = $k.': '.$v;
708 708
 			$this->debug("HTTP header: $hdr");
709 709
 			$this->outgoing_payload .= "$hdr\r\n";
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
 
741 741
 	  if ($this->io_method() == 'socket') {
742 742
 		// send payload
743
-		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
743
+		if (!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
744 744
 			$this->setError('couldn\'t write message data to socket');
745 745
 			$this->debug('couldn\'t write message data to socket');
746 746
 			return false;
747 747
 		}
748
-		$this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
748
+		$this->debug('wrote data to socket, length = '.strlen($this->outgoing_payload));
749 749
 		return true;
750 750
 	  } else if ($this->io_method() == 'curl') {
751 751
 		// set payload
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		// some servers refuse to work with (so we no longer use this method!)
755 755
 		//$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
756 756
 		$curl_headers = array();
757
-		foreach($this->outgoing_headers as $k => $v){
757
+		foreach ($this->outgoing_headers as $k => $v) {
758 758
 			if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') {
759 759
 				$this->debug("Skip cURL header $k: $v");
760 760
 			} else {
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 			}
763 763
 		}
764 764
 		if ($cookie_str != '') {
765
-			$curl_headers[] = 'Cookie: ' . $cookie_str;
765
+			$curl_headers[] = 'Cookie: '.$cookie_str;
766 766
 		}
767 767
 		$this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers);
768 768
 		$this->debug('set cURL HTTP headers');
@@ -788,62 +788,62 @@  discard block
 block discarded – undo
788 788
 	* @return	string the response (also sets member variables like incoming_payload)
789 789
 	* @access   private
790 790
 	*/
791
-	function getResponse(){
791
+	function getResponse() {
792 792
 		$this->incoming_payload = '';
793 793
 
794 794
 	  if ($this->io_method() == 'socket') {
795 795
 	    // loop until headers have been retrieved
796 796
 	    $data = '';
797
-	    while (!isset($lb)){
797
+	    while (!isset($lb)) {
798 798
 
799 799
 			// We might EOF during header read.
800
-			if(feof($this->fp)) {
800
+			if (feof($this->fp)) {
801 801
 				$this->incoming_payload = $data;
802
-				$this->debug('found no headers before EOF after length ' . strlen($data));
803
-				$this->debug("received before EOF:\n" . $data);
802
+				$this->debug('found no headers before EOF after length '.strlen($data));
803
+				$this->debug("received before EOF:\n".$data);
804 804
 				$this->setError('server failed to send headers');
805 805
 				return false;
806 806
 			}
807 807
 
808 808
 			$tmp = fgets($this->fp, 256);
809 809
 			$tmplen = strlen($tmp);
810
-			$this->debug("read line of $tmplen bytes: " . trim($tmp));
810
+			$this->debug("read line of $tmplen bytes: ".trim($tmp));
811 811
 
812 812
 			if ($tmplen == 0) {
813 813
 				$this->incoming_payload = $data;
814
-				$this->debug('socket read of headers timed out after length ' . strlen($data));
815
-				$this->debug("read before timeout: " . $data);
814
+				$this->debug('socket read of headers timed out after length '.strlen($data));
815
+				$this->debug("read before timeout: ".$data);
816 816
 				$this->setError('socket read of headers timed out');
817 817
 				return false;
818 818
 			}
819 819
 
820 820
 			$data .= $tmp;
821
-			$pos = strpos($data,"\r\n\r\n");
822
-			if($pos > 1){
821
+			$pos = strpos($data, "\r\n\r\n");
822
+			if ($pos > 1) {
823 823
 				$lb = "\r\n";
824 824
 			} else {
825
-				$pos = strpos($data,"\n\n");
826
-				if($pos > 1){
825
+				$pos = strpos($data, "\n\n");
826
+				if ($pos > 1) {
827 827
 					$lb = "\n";
828 828
 				}
829 829
 			}
830 830
 			// remove 100 headers
831
-			if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) {
831
+			if (isset($lb) && preg_match('/^HTTP\/1.1 100/', $data)) {
832 832
 				unset($lb);
833 833
 				$data = '';
834 834
 			}//
835 835
 		}
836 836
 		// store header data
837 837
 		$this->incoming_payload .= $data;
838
-		$this->debug('found end of headers after length ' . strlen($data));
838
+		$this->debug('found end of headers after length '.strlen($data));
839 839
 		// process headers
840
-		$header_data = trim(substr($data,0,$pos));
841
-		$header_array = explode($lb,$header_data);
840
+		$header_data = trim(substr($data, 0, $pos));
841
+		$header_array = explode($lb, $header_data);
842 842
 		$this->incoming_headers = array();
843 843
 		$this->incoming_cookies = array();
844
-		foreach($header_array as $header_line){
845
-			$arr = explode(':',$header_line, 2);
846
-			if(count($arr) > 1){
844
+		foreach ($header_array as $header_line) {
845
+			$arr = explode(':', $header_line, 2);
846
+			if (count($arr) > 1) {
847 847
 				$header_name = strtolower(trim($arr[0]));
848 848
 				$this->incoming_headers[$header_name] = trim($arr[1]);
849 849
 				if ($header_name == 'set-cookie') {
@@ -851,20 +851,20 @@  discard block
 block discarded – undo
851 851
 					$cookie = $this->parseCookie(trim($arr[1]));
852 852
 					if ($cookie) {
853 853
 						$this->incoming_cookies[] = $cookie;
854
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
854
+						$this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']);
855 855
 					} else {
856
-						$this->debug('did not find cookie in ' . trim($arr[1]));
856
+						$this->debug('did not find cookie in '.trim($arr[1]));
857 857
 					}
858 858
     			}
859 859
 			} else if (isset($header_name)) {
860 860
 				// append continuation line to previous header
861
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
861
+				$this->incoming_headers[$header_name] .= $lb.' '.$header_line;
862 862
 			}
863 863
 		}
864 864
 
865 865
 		// loop until msg has been received
866 866
 		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
867
-			$content_length =  2147483647;	// ignore any content-length header
867
+			$content_length = 2147483647; // ignore any content-length header
868 868
 			$chunked = true;
869 869
 			$this->debug("want to read chunked content");
870 870
 		} elseif (isset($this->incoming_headers['content-length'])) {
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 			$chunked = false;
873 873
 			$this->debug("want to read content of length $content_length");
874 874
 		} else {
875
-			$content_length =  2147483647;
875
+			$content_length = 2147483647;
876 876
 			$chunked = false;
877 877
 			$this->debug("want to read content to EOF");
878 878
 		}
@@ -884,8 +884,8 @@  discard block
 block discarded – undo
884 884
 				$this->debug("read chunk line of $tmplen bytes");
885 885
 				if ($tmplen == 0) {
886 886
 					$this->incoming_payload = $data;
887
-					$this->debug('socket read of chunk length timed out after length ' . strlen($data));
888
-					$this->debug("read before timeout:\n" . $data);
887
+					$this->debug('socket read of chunk length timed out after length '.strlen($data));
888
+					$this->debug("read before timeout:\n".$data);
889 889
 					$this->setError('socket read of chunk length timed out');
890 890
 					return false;
891 891
 				}
@@ -900,8 +900,8 @@  discard block
 block discarded – undo
900 900
 				$this->debug("read buffer of $tmplen bytes");
901 901
 				if (($tmplen == 0) && (!feof($this->fp))) {
902 902
 					$this->incoming_payload = $data;
903
-					$this->debug('socket read of body timed out after length ' . strlen($data));
904
-					$this->debug("read before timeout:\n" . $data);
903
+					$this->debug('socket read of body timed out after length '.strlen($data));
904
+					$this->debug("read before timeout:\n".$data);
905 905
 					$this->setError('socket read of body timed out');
906 906
 					return false;
907 907
 				}
@@ -914,8 +914,8 @@  discard block
 block discarded – undo
914 914
 				$this->debug("read chunk terminator of $tmplen bytes");
915 915
 				if ($tmplen == 0) {
916 916
 					$this->incoming_payload = $data;
917
-					$this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
918
-					$this->debug("read before timeout:\n" . $data);
917
+					$this->debug('socket read of chunk terminator timed out after length '.strlen($data));
918
+					$this->debug("read before timeout:\n".$data);
919 919
 					$this->setError('socket read of chunk terminator timed out');
920 920
 					return false;
921 921
 				}
@@ -924,21 +924,21 @@  discard block
 block discarded – undo
924 924
 		if (feof($this->fp)) {
925 925
 			$this->debug('read to EOF');
926 926
 		}
927
-		$this->debug('read body of length ' . strlen($data));
927
+		$this->debug('read body of length '.strlen($data));
928 928
 		$this->incoming_payload .= $data;
929 929
 		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
930 930
 
931 931
 		// close filepointer
932
-		if(
932
+		if (
933 933
 			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') ||
934
-			(! $this->persistentConnection) || feof($this->fp)){
934
+			(!$this->persistentConnection) || feof($this->fp)) {
935 935
 			fclose($this->fp);
936 936
 			$this->fp = false;
937 937
 			$this->debug('closed socket');
938 938
 		}
939 939
 
940 940
 		// connection was closed unexpectedly
941
-		if($this->incoming_payload == ''){
941
+		if ($this->incoming_payload == '') {
942 942
 			$this->setError('no response from server');
943 943
 			return false;
944 944
 		}
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 		if ($cErr != '') {
965 965
         	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
966 966
         	// TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
967
-			foreach(curl_getinfo($this->ch) as $k => $v){
967
+			foreach (curl_getinfo($this->ch) as $k => $v) {
968 968
 				$err .= "$k: $v<br>";
969 969
 			}
970 970
 			$this->debug($err);
@@ -984,44 +984,44 @@  discard block
 block discarded – undo
984 984
 		$savedata = $data;
985 985
 		while ($this->isSkippableCurlHeader($data)) {
986 986
 			$this->debug("Found HTTP header to skip");
987
-			if ($pos = strpos($data,"\r\n\r\n")) {
988
-				$data = ltrim(substr($data,$pos));
989
-			} elseif($pos = strpos($data,"\n\n") ) {
990
-				$data = ltrim(substr($data,$pos));
987
+			if ($pos = strpos($data, "\r\n\r\n")) {
988
+				$data = ltrim(substr($data, $pos));
989
+			} elseif ($pos = strpos($data, "\n\n")) {
990
+				$data = ltrim(substr($data, $pos));
991 991
 			}
992 992
 		}
993 993
 
994 994
 		if ($data == '') {
995 995
 			// have nothing left; just remove 100 header(s)
996 996
 			$data = $savedata;
997
-			while (preg_match('/^HTTP\/1.1 100/',$data)) {
998
-				if ($pos = strpos($data,"\r\n\r\n")) {
999
-					$data = ltrim(substr($data,$pos));
1000
-				} elseif($pos = strpos($data,"\n\n") ) {
1001
-					$data = ltrim(substr($data,$pos));
997
+			while (preg_match('/^HTTP\/1.1 100/', $data)) {
998
+				if ($pos = strpos($data, "\r\n\r\n")) {
999
+					$data = ltrim(substr($data, $pos));
1000
+				} elseif ($pos = strpos($data, "\n\n")) {
1001
+					$data = ltrim(substr($data, $pos));
1002 1002
 				}
1003 1003
 			}
1004 1004
 		}
1005 1005
 
1006 1006
 		// separate content from HTTP headers
1007
-		if ($pos = strpos($data,"\r\n\r\n")) {
1007
+		if ($pos = strpos($data, "\r\n\r\n")) {
1008 1008
 			$lb = "\r\n";
1009
-		} elseif( $pos = strpos($data,"\n\n")) {
1009
+		} elseif ($pos = strpos($data, "\n\n")) {
1010 1010
 			$lb = "\n";
1011 1011
 		} else {
1012 1012
 			$this->debug('no proper separation of headers and document');
1013 1013
 			$this->setError('no proper separation of headers and document');
1014 1014
 			return false;
1015 1015
 		}
1016
-		$header_data = trim(substr($data,0,$pos));
1017
-		$header_array = explode($lb,$header_data);
1018
-		$data = ltrim(substr($data,$pos));
1016
+		$header_data = trim(substr($data, 0, $pos));
1017
+		$header_array = explode($lb, $header_data);
1018
+		$data = ltrim(substr($data, $pos));
1019 1019
 		$this->debug('found proper separation of headers and document');
1020 1020
 		$this->debug('cleaned data, stringlen: '.strlen($data));
1021 1021
 		// clean headers
1022 1022
 		foreach ($header_array as $header_line) {
1023
-			$arr = explode(':',$header_line,2);
1024
-			if(count($arr) > 1){
1023
+			$arr = explode(':', $header_line, 2);
1024
+			if (count($arr) > 1) {
1025 1025
 				$header_name = strtolower(trim($arr[0]));
1026 1026
 				$this->incoming_headers[$header_name] = trim($arr[1]);
1027 1027
 				if ($header_name == 'set-cookie') {
@@ -1029,14 +1029,14 @@  discard block
 block discarded – undo
1029 1029
 					$cookie = $this->parseCookie(trim($arr[1]));
1030 1030
 					if ($cookie) {
1031 1031
 						$this->incoming_cookies[] = $cookie;
1032
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
1032
+						$this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']);
1033 1033
 					} else {
1034
-						$this->debug('did not find cookie in ' . trim($arr[1]));
1034
+						$this->debug('did not find cookie in '.trim($arr[1]));
1035 1035
 					}
1036 1036
     			}
1037 1037
 			} else if (isset($header_name)) {
1038 1038
 				// append continuation line to previous header
1039
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
1039
+				$this->incoming_headers[$header_name] .= $lb.' '.$header_line;
1040 1040
 			}
1041 1041
 		}
1042 1042
 	  }
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 
1050 1050
  		// see if we need to resend the request with http digest authentication
1051 1051
  		if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) {
1052
- 			$this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']);
1052
+ 			$this->debug("Got $http_status $http_reason with Location: ".$this->incoming_headers['location']);
1053 1053
  			$this->setURL($this->incoming_headers['location']);
1054 1054
 			$this->tryagain = true;
1055 1055
 			return false;
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
  		// see if we need to resend the request with http digest authentication
1059 1059
  		if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
1060
- 			$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
1060
+ 			$this->debug("Got 401 $http_reason with WWW-Authenticate: ".$this->incoming_headers['www-authenticate']);
1061 1061
  			if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
1062 1062
  				$this->debug('Server wants digest authentication');
1063 1063
  				// remove "Digest " from our elements
@@ -1092,10 +1092,10 @@  discard block
 block discarded – undo
1092 1092
 		}
1093 1093
 
1094 1094
 		// decode content-encoding
1095
-		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
1096
-			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
1095
+		if (isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != '') {
1096
+			if (strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip') {
1097 1097
     			// if decoding works, use it. else assume data wasn't gzencoded
1098
-    			if(function_exists('gzinflate')){
1098
+    			if (function_exists('gzinflate')) {
1099 1099
 					//$timer->setMarker('starting decoding of gzip/deflated content');
1100 1100
 					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
1101 1101
 					// this means there are no Zlib headers, although there should be
@@ -1104,13 +1104,13 @@  discard block
 block discarded – undo
1104 1104
 					if ($this->incoming_headers['content-encoding'] == 'deflate') {
1105 1105
 						if ($degzdata = @gzinflate($data)) {
1106 1106
 	    					$data = $degzdata;
1107
-	    					$this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
1107
+	    					$this->debug('The payload has been inflated to '.strlen($data).' bytes');
1108 1108
 	    					if (strlen($data) < $datalen) {
1109 1109
 	    						// test for the case that the payload has been compressed twice
1110 1110
 		    					$this->debug('The inflated payload is smaller than the gzipped one; try again');
1111 1111
 								if ($degzdata = @gzinflate($data)) {
1112 1112
 			    					$data = $degzdata;
1113
-			    					$this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
1113
+			    					$this->debug('The payload has been inflated again to '.strlen($data).' bytes');
1114 1114
 								}
1115 1115
 	    					}
1116 1116
 	    				} else {
@@ -1120,13 +1120,13 @@  discard block
 block discarded – undo
1120 1120
 					} elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
1121 1121
 						if ($degzdata = @gzinflate(substr($data, 10))) {	// do our best
1122 1122
 							$data = $degzdata;
1123
-	    					$this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
1123
+	    					$this->debug('The payload has been un-gzipped to '.strlen($data).' bytes');
1124 1124
 	    					if (strlen($data) < $datalen) {
1125 1125
 	    						// test for the case that the payload has been compressed twice
1126 1126
 		    					$this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
1127 1127
 								if ($degzdata = @gzinflate(substr($data, 10))) {
1128 1128
 			    					$data = $degzdata;
1129
-			    					$this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
1129
+			    					$this->debug('The payload has been un-gzipped again to '.strlen($data).' bytes');
1130 1130
 								}
1131 1131
 	    					}
1132 1132
 	    				} else {
@@ -1143,14 +1143,14 @@  discard block
 block discarded – undo
1143 1143
 					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
1144 1144
 				}
1145 1145
 			} else {
1146
-				$this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
1147
-				$this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
1146
+				$this->debug('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']);
1147
+				$this->setError('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']);
1148 1148
 			}
1149 1149
 		} else {
1150 1150
 			$this->debug('No Content-Encoding header');
1151 1151
 		}
1152 1152
 
1153
-		if(strlen($data) == 0){
1153
+		if (strlen($data) == 0) {
1154 1154
 			$this->debug('no data after headers!');
1155 1155
 			$this->setError('no data present after HTTP headers');
1156 1156
 			return false;
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 	 * @access	public
1168 1168
 	 */
1169 1169
 	function setContentType($type, $charset = false) {
1170
-		$this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : ''));
1170
+		$this->setHeader('Content-Type', $type.($charset ? '; charset='.$charset : ''));
1171 1171
 	}
1172 1172
 
1173 1173
 	/**
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 	 * @return	boolean whether the request was honored by this method.
1177 1177
 	 * @access	public
1178 1178
 	 */
1179
-	function usePersistentConnection(){
1179
+	function usePersistentConnection() {
1180 1180
 		if (isset($this->outgoing_headers['Accept-Encoding'])) {
1181 1181
 			return false;
1182 1182
 		}
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 	 * TODO: allow a Set-Cookie string to be parsed into multiple cookies
1198 1198
 	 */
1199 1199
 	function parseCookie($cookie_str) {
1200
-		$cookie_str = str_replace('; ', ';', $cookie_str) . ';';
1200
+		$cookie_str = str_replace('; ', ';', $cookie_str).';';
1201 1201
 		$data = preg_split('/;/', $cookie_str);
1202 1202
 		$value_str = $data[0];
1203 1203
 
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 
1222 1222
 		$cookie_param = 'path=';
1223 1223
 		$start = strpos($cookie_str, $cookie_param);
1224
-		if ( $start > 0 ) {
1224
+		if ($start > 0) {
1225 1225
 			$path = substr($cookie_str, $start + strlen($cookie_param));
1226 1226
 			$path = substr($path, 0, strpos($path, ';'));
1227 1227
 		} else {
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 		if ($sep_pos) {
1241 1241
 			$name = substr($value_str, 0, $sep_pos);
1242 1242
 			$value = substr($value_str, $sep_pos + 1);
1243
-			$cookie= array(	'name' => $name,
1243
+			$cookie = array('name' => $name,
1244 1244
 			                'value' => $value,
1245 1245
 							'domain' => $domain,
1246 1246
 							'path' => $path,
@@ -1260,40 +1260,40 @@  discard block
 block discarded – undo
1260 1260
 	 * @return	string for Cookie-HTTP-Header
1261 1261
 	 * @access	private
1262 1262
 	 */
1263
-	function getCookiesForRequest($cookies, $secure=false) {
1263
+	function getCookiesForRequest($cookies, $secure = false) {
1264 1264
 		$cookie_str = '';
1265
-		if ((! is_null($cookies)) && (is_array($cookies))) {
1265
+		if ((!is_null($cookies)) && (is_array($cookies))) {
1266 1266
 			foreach ($cookies as $cookie) {
1267
-				if (! is_array($cookie)) {
1267
+				if (!is_array($cookie)) {
1268 1268
 					continue;
1269 1269
 				}
1270 1270
 	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
1271
-				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
1271
+				if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) {
1272 1272
 					if (strtotime($cookie['expires']) <= time()) {
1273 1273
 						$this->debug('cookie has expired');
1274 1274
 						continue;
1275 1275
 					}
1276 1276
 				}
1277
-				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
1277
+				if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) {
1278 1278
 					$domain = preg_quote($cookie['domain']);
1279
-					if (! preg_match("'.*$domain$'i", $this->host)) {
1279
+					if (!preg_match("'.*$domain$'i", $this->host)) {
1280 1280
 						$this->debug('cookie has different domain');
1281 1281
 						continue;
1282 1282
 					}
1283 1283
 				}
1284
-				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
1284
+				if ((isset($cookie['path'])) && (!empty($cookie['path']))) {
1285 1285
 					$path = preg_quote($cookie['path']);
1286
-					if (! preg_match("'^$path.*'i", $this->path)) {
1286
+					if (!preg_match("'^$path.*'i", $this->path)) {
1287 1287
 						$this->debug('cookie is for a different path');
1288 1288
 						continue;
1289 1289
 					}
1290 1290
 				}
1291
-				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1291
+				if ((!$secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1292 1292
 					$this->debug('cookie is secure, transport is not');
1293 1293
 					continue;
1294 1294
 				}
1295
-				$cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
1296
-	    		$this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
1295
+				$cookie_str .= $cookie['name'].'='.$cookie['value'].'; ';
1296
+	    		$this->debug('add cookie to Cookie-String: '.$cookie['name'].'='.$cookie['value']);
1297 1297
 			}
1298 1298
 		}
1299 1299
 		return $cookie_str;
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.xmlschema.php 1 patch
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	* @param	string $namespaces namespaces defined in enclosing XML
49 49
 	* @access   public
50 50
 	*/
51
-	function __construct($schema='',$xml='',$namespaces=array()){
51
+	function __construct($schema = '', $xml = '', $namespaces = array()) {
52 52
 		parent::__construct();
53 53
 		$this->debug('nusoap_xmlschema class instantiated, inside constructor');
54 54
 		// files
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 		$this->namespaces = array_merge($this->namespaces, $namespaces);
61 61
 
62 62
 		// parse schema file
63
-		if($schema != ''){
63
+		if ($schema != '') {
64 64
 			$this->debug('initial schema file: '.$schema);
65 65
 			$this->parseFile($schema, 'schema');
66 66
 		}
67 67
 
68 68
 		// parse xml file
69
-		if($xml != ''){
69
+		if ($xml != '') {
70 70
 			$this->debug('initial xml file: '.$xml);
71 71
 			$this->parseFile($xml, 'xml');
72 72
 		}
@@ -81,18 +81,18 @@  discard block
 block discarded – undo
81 81
 	* @return boolean
82 82
     * @access public
83 83
     */
84
-	function parseFile($xml,$type){
84
+	function parseFile($xml, $type) {
85 85
 		// parse xml file
86
-		if($xml != ""){
87
-			$xmlStr = @join("",@file($xml));
88
-			if($xmlStr == ""){
86
+		if ($xml != "") {
87
+			$xmlStr = @join("", @file($xml));
88
+			if ($xmlStr == "") {
89 89
 				$msg = 'Error reading XML from '.$xml;
90 90
 				$this->setError($msg);
91 91
 				$this->debug($msg);
92 92
 			return false;
93 93
 			} else {
94 94
 				$this->debug("parsing $xml");
95
-				$this->parseString($xmlStr,$type);
95
+				$this->parseString($xmlStr, $type);
96 96
 				$this->debug("done parsing $xml");
97 97
 			return true;
98 98
 			}
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     * @param	string $type (schema|xml)
108 108
 	* @access   private
109 109
 	*/
110
-	function parseString($xml,$type){
110
+	function parseString($xml, $type) {
111 111
 		// parse xml string
112
-		if($xml != ""){
112
+		if ($xml != "") {
113 113
 
114 114
 	    	// Create an XML parser.
115 115
 	    	$this->parser = xml_parser_create();
@@ -120,28 +120,28 @@  discard block
 block discarded – undo
120 120
 	    	xml_set_object($this->parser, $this);
121 121
 
122 122
 	    	// Set the element handlers for the parser.
123
-			if($type == "schema"){
124
-		    	xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
125
-		    	xml_set_character_data_handler($this->parser,'schemaCharacterData');
126
-			} elseif($type == "xml"){
127
-				xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
128
-		    	xml_set_character_data_handler($this->parser,'xmlCharacterData');
123
+			if ($type == "schema") {
124
+		    	xml_set_element_handler($this->parser, 'schemaStartElement', 'schemaEndElement');
125
+		    	xml_set_character_data_handler($this->parser, 'schemaCharacterData');
126
+			} elseif ($type == "xml") {
127
+				xml_set_element_handler($this->parser, 'xmlStartElement', 'xmlEndElement');
128
+		    	xml_set_character_data_handler($this->parser, 'xmlCharacterData');
129 129
 			}
130 130
 
131 131
 		    // Parse the XML file.
132
-		    if(!xml_parse($this->parser,$xml,true)){
132
+		    if (!xml_parse($this->parser, $xml, true)) {
133 133
 			// Display an error message.
134 134
 				$errstr = sprintf('XML error parsing XML schema on line %d: %s',
135 135
 				xml_get_current_line_number($this->parser),
136 136
 				xml_error_string(xml_get_error_code($this->parser))
137 137
 				);
138 138
 				$this->debug($errstr);
139
-				$this->debug("XML payload:\n" . $xml);
139
+				$this->debug("XML payload:\n".$xml);
140 140
 				$this->setError($errstr);
141 141
 	    	}
142 142
 
143 143
 			xml_parser_free($this->parser);
144
-		} else{
144
+		} else {
145 145
 			$this->debug('no xml passed to parseString()!!');
146 146
 			$this->setError('no xml passed to parseString()!!');
147 147
 		}
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	function CreateTypeName($ename) {
158 158
 		$scope = '';
159 159
 		for ($i = 0; $i < count($this->complexTypeStack); $i++) {
160
-			$scope .= $this->complexTypeStack[$i] . '_';
160
+			$scope .= $this->complexTypeStack[$i].'_';
161 161
 		}
162
-		return $scope . $ename . '_ContainedType';
162
+		return $scope.$ename.'_ContainedType';
163 163
 	}
164 164
 
165 165
 	/**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 
187 187
 		// get element prefix
188
-		if($prefix = $this->getPrefix($name)){
188
+		if ($prefix = $this->getPrefix($name)) {
189 189
 			// get unqualified name
190 190
 			$name = $this->getLocalPart($name);
191 191
 		} else {
@@ -193,31 +193,31 @@  discard block
 block discarded – undo
193 193
         }
194 194
 
195 195
         // loop thru attributes, expanding, and registering namespace declarations
196
-        if(count($attrs) > 0){
197
-        	foreach($attrs as $k => $v){
196
+        if (count($attrs) > 0) {
197
+        	foreach ($attrs as $k => $v) {
198 198
                 // if ns declarations, add to class level array of valid namespaces
199
-				if(preg_match('/^xmlns/',$k)){
199
+				if (preg_match('/^xmlns/', $k)) {
200 200
                 	//$this->xdebug("$k: $v");
201 201
                 	//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
202
-                	if($ns_prefix = substr(strrchr($k,':'),1)){
202
+                	if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
203 203
                 		//$this->xdebug("Add namespace[$ns_prefix] = $v");
204 204
 						$this->namespaces[$ns_prefix] = $v;
205 205
 					} else {
206 206
 						$this->defaultNamespace[$pos] = $v;
207
-						if (! $this->getPrefixFromNamespace($v)) {
208
-							$this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
207
+						if (!$this->getPrefixFromNamespace($v)) {
208
+							$this->namespaces['ns'.(count($this->namespaces) + 1)] = $v;
209 209
 						}
210 210
 					}
211
-					if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){
211
+					if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
212 212
 						$this->XMLSchemaVersion = $v;
213 213
 						$this->namespaces['xsi'] = $v.'-instance';
214 214
 					}
215 215
 				}
216 216
         	}
217
-        	foreach($attrs as $k => $v){
217
+        	foreach ($attrs as $k => $v) {
218 218
                 // expand each attribute
219
-                $k = strpos($k,':') ? $this->expandQname($k) : $k;
220
-                $v = strpos($v,':') ? $this->expandQname($v) : $v;
219
+                $k = strpos($k, ':') ? $this->expandQname($k) : $k;
220
+                $v = strpos($v, ':') ? $this->expandQname($v) : $v;
221 221
         		$eAttrs[$k] = $v;
222 222
         	}
223 223
         	$attrs = $eAttrs;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	$attrs = array();
226 226
         }
227 227
 		// find status, register data
228
-		switch($name){
228
+		switch ($name) {
229 229
 			case 'all':			// (optional) compositor content for a complexType
230 230
 			case 'choice':
231 231
 			case 'group':
@@ -250,41 +250,41 @@  discard block
 block discarded – undo
250 250
 						// no namespace in arrayType attribute value...
251 251
 						if ($this->defaultNamespace[$pos]) {
252 252
 							// ...so use the default
253
-							$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
253
+							$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos].':'.$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
254 254
 						}
255 255
 					}
256 256
             	}
257
-                if(isset($attrs['name'])){
257
+                if (isset($attrs['name'])) {
258 258
 					$this->attributes[$attrs['name']] = $attrs;
259 259
 					$aname = $attrs['name'];
260
-				} elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
260
+				} elseif (isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType') {
261 261
 					if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
262 262
 	                	$aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
263 263
 	                } else {
264 264
 	                	$aname = '';
265 265
 	                }
266
-				} elseif(isset($attrs['ref'])){
266
+				} elseif (isset($attrs['ref'])) {
267 267
 					$aname = $attrs['ref'];
268 268
                     $this->attributes[$attrs['ref']] = $attrs;
269 269
 				}
270 270
 
271
-				if($this->currentComplexType){	// This should *always* be
271
+				if ($this->currentComplexType) {	// This should *always* be
272 272
 					$this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
273 273
 				}
274 274
 				// arrayType attribute
275
-				if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){
275
+				if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType') {
276 276
 					$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
277 277
                 	$prefix = $this->getPrefix($aname);
278
-					if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){
278
+					if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
279 279
 						$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
280 280
 					} else {
281 281
 						$v = '';
282 282
 					}
283
-                    if(strpos($v,'[,]')){
283
+                    if (strpos($v, '[,]')) {
284 284
                         $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
285 285
                     }
286
-                    $v = substr($v,0,strpos($v,'[')); // clip the []
287
-                    if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
286
+                    $v = substr($v, 0, strpos($v, '[')); // clip the []
287
+                    if (!strpos($v, ':') && isset($this->typemap[$this->XMLSchemaVersion][$v])) {
288 288
                         $v = $this->XMLSchemaVersion.':'.$v;
289 289
                     }
290 290
                     $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			break;
296 296
 			case 'complexType':
297 297
 				array_push($this->complexTypeStack, $this->currentComplexType);
298
-				if(isset($attrs['name'])){
298
+				if (isset($attrs['name'])) {
299 299
 					// TODO: what is the scope of named complexTypes that appear
300 300
 					//       nested within other c complexTypes?
301 301
 					$this->xdebug('processing named complexType '.$attrs['name']);
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 					//                        minOccurs="0" maxOccurs="unbounded" />
311 311
 					//                </sequence>
312 312
 					//            </complexType>
313
-					if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
313
+					if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
314 314
 						$this->xdebug('complexType is unusual array');
315 315
 						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
316 316
 					} else {
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 					}
319 319
 				} else {
320 320
 					$name = $this->CreateTypeName($this->currentElement);
321
-					$this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name);
321
+					$this->xdebug('processing unnamed complexType for element '.$this->currentElement.' named '.$name);
322 322
 					$this->currentComplexType = $name;
323 323
 					//$this->currentElement = false;
324 324
 					$this->complexTypes[$this->currentComplexType] = $attrs;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 					//                        minOccurs="0" maxOccurs="unbounded" />
331 331
 					//                </sequence>
332 332
 					//            </complexType>
333
-					if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
333
+					if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
334 334
 						$this->xdebug('complexType is unusual array');
335 335
 						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
336 336
 					} else {
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 						$attrs['form'] = 'qualified';
350 350
 					}
351 351
 				}
352
-				if(isset($attrs['type'])){
352
+				if (isset($attrs['type'])) {
353 353
 					$this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
354
-					if (! $this->getPrefix($attrs['type'])) {
354
+					if (!$this->getPrefix($attrs['type'])) {
355 355
 						if ($this->defaultNamespace[$pos]) {
356
-							$attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
357
-							$this->xdebug('used default namespace to make type ' . $attrs['type']);
356
+							$attrs['type'] = $this->defaultNamespace[$pos].':'.$attrs['type'];
357
+							$this->xdebug('used default namespace to make type '.$attrs['type']);
358 358
 						}
359 359
 					}
360 360
 					// This is for constructs like
@@ -365,20 +365,20 @@  discard block
 block discarded – undo
365 365
 					//                </sequence>
366 366
 					//            </complexType>
367 367
 					if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
368
-						$this->xdebug('arrayType for unusual array is ' . $attrs['type']);
368
+						$this->xdebug('arrayType for unusual array is '.$attrs['type']);
369 369
 						$this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
370 370
 					}
371 371
 					$this->currentElement = $attrs['name'];
372 372
 					$ename = $attrs['name'];
373
-				} elseif(isset($attrs['ref'])){
373
+				} elseif (isset($attrs['ref'])) {
374 374
 					$this->xdebug("processing element as ref to ".$attrs['ref']);
375 375
 					$this->currentElement = "ref to ".$attrs['ref'];
376 376
 					$ename = $this->getLocalPart($attrs['ref']);
377 377
 				} else {
378
-					$type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
379
-					$this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
378
+					$type = $this->CreateTypeName($this->currentComplexType.'_'.$attrs['name']);
379
+					$this->xdebug("processing untyped element ".$attrs['name'].' type '.$type);
380 380
 					$this->currentElement = $attrs['name'];
381
-					$attrs['type'] = $this->schemaTargetNamespace . ':' . $type;
381
+					$attrs['type'] = $this->schemaTargetNamespace.':'.$type;
382 382
 					$ename = $attrs['name'];
383 383
 				}
384 384
 				if (isset($ename) && $this->currentComplexType) {
@@ -386,12 +386,12 @@  discard block
 block discarded – undo
386 386
 					$this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
387 387
 				} elseif (!isset($attrs['ref'])) {
388 388
 					$this->xdebug("add element $ename to elements array");
389
-					$this->elements[ $attrs['name'] ] = $attrs;
390
-					$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
389
+					$this->elements[$attrs['name']] = $attrs;
390
+					$this->elements[$attrs['name']]['typeClass'] = 'element';
391 391
 				}
392 392
 			break;
393 393
 			case 'enumeration':	//	restriction value list member
394
-				$this->xdebug('enumeration ' . $attrs['value']);
394
+				$this->xdebug('enumeration '.$attrs['value']);
395 395
 				if ($this->currentSimpleType) {
396 396
 					$this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
397 397
 				} elseif ($this->currentComplexType) {
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
 				}
400 400
 			break;
401 401
 			case 'extension':	// simpleContent or complexContent type extension
402
-				$this->xdebug('extension ' . $attrs['base']);
402
+				$this->xdebug('extension '.$attrs['base']);
403 403
 				if ($this->currentComplexType) {
404 404
 					$ns = $this->getPrefix($attrs['base']);
405 405
 					if ($ns == '') {
406
-						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base'];
406
+						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace.':'.$attrs['base'];
407 407
 					} else {
408 408
 						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
409 409
 					}
@@ -413,19 +413,19 @@  discard block
 block discarded – undo
413 413
 			break;
414 414
 			case 'import':
415 415
 			    if (isset($attrs['schemaLocation'])) {
416
-					$this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
416
+					$this->xdebug('import namespace '.$attrs['namespace'].' from '.$attrs['schemaLocation']);
417 417
                     $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
418 418
 				} else {
419
-					$this->xdebug('import namespace ' . $attrs['namespace']);
419
+					$this->xdebug('import namespace '.$attrs['namespace']);
420 420
                     $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
421
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
422
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
421
+					if (!$this->getPrefixFromNamespace($attrs['namespace'])) {
422
+						$this->namespaces['ns'.(count($this->namespaces) + 1)] = $attrs['namespace'];
423 423
 					}
424 424
 				}
425 425
 			break;
426 426
 			case 'include':
427 427
 			    if (isset($attrs['schemaLocation'])) {
428
-					$this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
428
+					$this->xdebug('include into namespace '.$this->schemaTargetNamespace.' from '.$attrs['schemaLocation']);
429 429
                     $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
430 430
 				} else {
431 431
 					$this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute');
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 				$this->xdebug("do nothing for element $name");
436 436
 			break;
437 437
 			case 'restriction':	// simpleType, simpleContent or complexContent value restriction
438
-				$this->xdebug('restriction ' . $attrs['base']);
439
-				if($this->currentSimpleType){
438
+				$this->xdebug('restriction '.$attrs['base']);
439
+				if ($this->currentSimpleType) {
440 440
 					$this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
441
-				} elseif($this->currentComplexType){
441
+				} elseif ($this->currentComplexType) {
442 442
 					$this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
443
-					if(strstr($attrs['base'],':') == ':Array'){
443
+					if (strstr($attrs['base'], ':') == ':Array') {
444 444
 						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
445 445
 					}
446 446
 				}
@@ -467,15 +467,15 @@  discard block
 block discarded – undo
467 467
 			break;
468 468
 			case 'simpleType':
469 469
 				array_push($this->simpleTypeStack, $this->currentSimpleType);
470
-				if(isset($attrs['name'])){
471
-					$this->xdebug("processing simpleType for name " . $attrs['name']);
470
+				if (isset($attrs['name'])) {
471
+					$this->xdebug("processing simpleType for name ".$attrs['name']);
472 472
 					$this->currentSimpleType = $attrs['name'];
473
-					$this->simpleTypes[ $attrs['name'] ] = $attrs;
474
-					$this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
475
-					$this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
473
+					$this->simpleTypes[$attrs['name']] = $attrs;
474
+					$this->simpleTypes[$attrs['name']]['typeClass'] = 'simpleType';
475
+					$this->simpleTypes[$attrs['name']]['phpType'] = 'scalar';
476 476
 				} else {
477
-					$name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
478
-					$this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name);
477
+					$name = $this->CreateTypeName($this->currentComplexType.'_'.$this->currentElement);
478
+					$this->xdebug('processing unnamed simpleType for element '.$this->currentElement.' named '.$name);
479 479
 					$this->currentSimpleType = $name;
480 480
 					//$this->currentElement = false;
481 481
 					$this->simpleTypes[$this->currentSimpleType] = $attrs;
@@ -501,29 +501,29 @@  discard block
 block discarded – undo
501 501
 		// bring depth down a notch
502 502
 		$this->depth--;
503 503
 		// position of current element is equal to the last value left in depth_array for my depth
504
-		if(isset($this->depth_array[$this->depth])){
504
+		if (isset($this->depth_array[$this->depth])) {
505 505
         	$pos = $this->depth_array[$this->depth];
506 506
         }
507 507
 		// get element prefix
508
-		if ($prefix = $this->getPrefix($name)){
508
+		if ($prefix = $this->getPrefix($name)) {
509 509
 			// get unqualified name
510 510
 			$name = $this->getLocalPart($name);
511 511
 		} else {
512 512
         	$prefix = '';
513 513
         }
514 514
 		// move on...
515
-		if($name == 'complexType'){
516
-			$this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
515
+		if ($name == 'complexType') {
516
+			$this->xdebug('done processing complexType '.($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
517 517
 			$this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType]));
518 518
 			$this->currentComplexType = array_pop($this->complexTypeStack);
519 519
 			//$this->currentElement = false;
520 520
 		}
521
-		if($name == 'element'){
522
-			$this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)'));
521
+		if ($name == 'element') {
522
+			$this->xdebug('done processing element '.($this->currentElement ? $this->currentElement : '(unknown)'));
523 523
 			$this->currentElement = array_pop($this->elementStack);
524 524
 		}
525
-		if($name == 'simpleType'){
526
-			$this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
525
+		if ($name == 'simpleType') {
526
+			$this->xdebug('done processing simpleType '.($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
527 527
 			$this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType]));
528 528
 			$this->currentSimpleType = array_pop($this->simpleTypeStack);
529 529
 		}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	* @param    string $data element content
537 537
 	* @access   private
538 538
 	*/
539
-	function schemaCharacterData($parser, $data){
539
+	function schemaCharacterData($parser, $data) {
540 540
 		$pos = $this->depth_array[$this->depth - 1];
541 541
 		$this->message[$pos]['cdata'] .= $data;
542 542
 	}
@@ -546,32 +546,32 @@  discard block
 block discarded – undo
546 546
 	*
547 547
 	* @access   public
548 548
 	*/
549
-	function serializeSchema(){
549
+	function serializeSchema() {
550 550
 
551 551
 		$schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
552 552
 		$xml = '';
553 553
 		// imports
554 554
 		if (sizeof($this->imports) > 0) {
555
-			foreach($this->imports as $ns => $list) {
555
+			foreach ($this->imports as $ns => $list) {
556 556
 				foreach ($list as $ii) {
557 557
 					if ($ii['location'] != '') {
558
-						$xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
558
+						$xml .= " <$schemaPrefix:import location=\"".$ii['location'].'" namespace="'.$ns."\" />\n";
559 559
 					} else {
560
-						$xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
560
+						$xml .= " <$schemaPrefix:import namespace=\"".$ns."\" />\n";
561 561
 					}
562 562
 				}
563 563
 			}
564 564
 		}
565 565
 		// complex types
566
-		foreach($this->complexTypes as $typeName => $attrs){
566
+		foreach ($this->complexTypes as $typeName => $attrs) {
567 567
 			$contentStr = '';
568 568
 			// serialize child elements
569
-			if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){
570
-				foreach($attrs['elements'] as $element => $eParts){
571
-					if(isset($eParts['ref'])){
569
+			if (isset($attrs['elements']) && (count($attrs['elements']) > 0)) {
570
+				foreach ($attrs['elements'] as $element => $eParts) {
571
+					if (isset($eParts['ref'])) {
572 572
 						$contentStr .= "   <$schemaPrefix:element ref=\"$element\"/>\n";
573 573
 					} else {
574
-						$contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
574
+						$contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"";
575 575
 						foreach ($eParts as $aName => $aValue) {
576 576
 							// handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
577 577
 							if ($aName != 'name' && $aName != 'type') {
@@ -587,8 +587,8 @@  discard block
 block discarded – undo
587 587
 				}
588 588
 			}
589 589
 			// attributes
590
-			if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){
591
-				foreach($attrs['attrs'] as $attr => $aParts){
590
+			if (isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)) {
591
+				foreach ($attrs['attrs'] as $attr => $aParts) {
592 592
 					$contentStr .= "    <$schemaPrefix:attribute";
593 593
 					foreach ($aParts as $a => $v) {
594 594
 						if ($a == 'ref' || $a == 'type') {
@@ -604,15 +604,15 @@  discard block
 block discarded – undo
604 604
 				}
605 605
 			}
606 606
 			// if restriction
607
-			if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){
607
+			if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != '') {
608 608
 				$contentStr = "   <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr."   </$schemaPrefix:restriction>\n";
609 609
 				// complex or simple content
610
-				if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){
610
+				if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)) {
611 611
 					$contentStr = "  <$schemaPrefix:complexContent>\n".$contentStr."  </$schemaPrefix:complexContent>\n";
612 612
 				}
613 613
 			}
614 614
 			// finalize complex type
615
-			if($contentStr != ''){
615
+			if ($contentStr != '') {
616 616
 				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n";
617 617
 			} else {
618 618
 				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
@@ -620,8 +620,8 @@  discard block
 block discarded – undo
620 620
 			$xml .= $contentStr;
621 621
 		}
622 622
 		// simple types
623
-		if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
624
-			foreach($this->simpleTypes as $typeName => $eParts){
623
+		if (isset($this->simpleTypes) && count($this->simpleTypes) > 0) {
624
+			foreach ($this->simpleTypes as $typeName => $eParts) {
625 625
 				$xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n  <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n";
626 626
 				if (isset($eParts['enumeration'])) {
627 627
 					foreach ($eParts['enumeration'] as $e) {
@@ -632,14 +632,14 @@  discard block
 block discarded – undo
632 632
 			}
633 633
 		}
634 634
 		// elements
635
-		if(isset($this->elements) && count($this->elements) > 0){
636
-			foreach($this->elements as $element => $eParts){
635
+		if (isset($this->elements) && count($this->elements) > 0) {
636
+			foreach ($this->elements as $element => $eParts) {
637 637
 				$xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n";
638 638
 			}
639 639
 		}
640 640
 		// attributes
641
-		if(isset($this->attributes) && count($this->attributes) > 0){
642
-			foreach($this->attributes as $attr => $aParts){
641
+		if (isset($this->attributes) && count($this->attributes) > 0) {
642
+			foreach ($this->attributes as $attr => $aParts) {
643 643
 				$xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>";
644 644
 			}
645 645
 		}
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
655 655
 			$el .= " xmlns:$nsp=\"$ns\"";
656 656
 		}
657
-		$xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n";
657
+		$xml = $el.">\n".$xml."</$schemaPrefix:schema>\n";
658 658
 		return $xml;
659 659
 	}
660 660
 
@@ -664,8 +664,8 @@  discard block
 block discarded – undo
664 664
 	* @param    string $string debug data
665 665
 	* @access   private
666 666
 	*/
667
-	function xdebug($string){
668
-		$this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
667
+	function xdebug($string) {
668
+		$this->debug('<'.$this->schemaTargetNamespace.'> '.$string);
669 669
 	}
670 670
 
671 671
     /**
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
     * @access public
681 681
     * @deprecated
682 682
     */
683
-	function getPHPType($type,$ns){
684
-		if(isset($this->typemap[$ns][$type])){
683
+	function getPHPType($type, $ns) {
684
+		if (isset($this->typemap[$ns][$type])) {
685 685
 			//print "found type '$type' and ns $ns in typemap<br>";
686 686
 			return $this->typemap[$ns][$type];
687
-		} elseif(isset($this->complexTypes[$type])){
687
+		} elseif (isset($this->complexTypes[$type])) {
688 688
 			//print "getting type '$type' and ns $ns from complexTypes array<br>";
689 689
 			return $this->complexTypes[$type]['phpType'];
690 690
 		}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
     * @see addSimpleType
714 714
     * @see addElement
715 715
     */
716
-	function getTypeDef($type){
716
+	function getTypeDef($type) {
717 717
 		//$this->debug("in getTypeDef for type $type");
718 718
 		if (substr($type, -1) == '^') {
719 719
 			$is_element = 1;
@@ -722,10 +722,10 @@  discard block
 block discarded – undo
722 722
 			$is_element = 0;
723 723
 		}
724 724
 
725
-		if((! $is_element) && isset($this->complexTypes[$type])){
725
+		if ((!$is_element) && isset($this->complexTypes[$type])) {
726 726
 			$this->xdebug("in getTypeDef, found complexType $type");
727 727
 			return $this->complexTypes[$type];
728
-		} elseif((! $is_element) && isset($this->simpleTypes[$type])){
728
+		} elseif ((!$is_element) && isset($this->simpleTypes[$type])) {
729 729
 			$this->xdebug("in getTypeDef, found simpleType $type");
730 730
 			if (!isset($this->simpleTypes[$type]['phpType'])) {
731 731
 				// get info for type to tack onto the simple type
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 				}
746 746
 			}
747 747
 			return $this->simpleTypes[$type];
748
-		} elseif(isset($this->elements[$type])){
748
+		} elseif (isset($this->elements[$type])) {
749 749
 			$this->xdebug("in getTypeDef, found element $type");
750 750
 			if (!isset($this->elements[$type]['phpType'])) {
751 751
 				// get info for type to tack onto the element
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 				}
771 771
 			}
772 772
 			return $this->elements[$type];
773
-		} elseif(isset($this->attributes[$type])){
773
+		} elseif (isset($this->attributes[$type])) {
774 774
 			$this->xdebug("in getTypeDef, found attribute $type");
775 775
 			return $this->attributes[$type];
776 776
 		} elseif (preg_match('/_ContainedType$/', $type)) {
@@ -792,23 +792,23 @@  discard block
 block discarded – undo
792 792
     * @access public
793 793
     * @deprecated
794 794
     */
795
-    function serializeTypeDef($type){
795
+    function serializeTypeDef($type) {
796 796
     	//print "in sTD() for type $type<br>";
797
-	if($typeDef = $this->getTypeDef($type)){
797
+	if ($typeDef = $this->getTypeDef($type)) {
798 798
 		$str .= '<'.$type;
799
-	    if(is_array($typeDef['attrs'])){
800
-		foreach($typeDef['attrs'] as $attName => $data){
799
+	    if (is_array($typeDef['attrs'])) {
800
+		foreach ($typeDef['attrs'] as $attName => $data) {
801 801
 		    $str .= " $attName=\"{type = ".$data['type']."}\"";
802 802
 		}
803 803
 	    }
804 804
 	    $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
805
-	    if(count($typeDef['elements']) > 0){
805
+	    if (count($typeDef['elements']) > 0) {
806 806
 		$str .= ">";
807
-		foreach($typeDef['elements'] as $element => $eData){
807
+		foreach ($typeDef['elements'] as $element => $eData) {
808 808
 		    $str .= $this->serializeTypeDef($element);
809 809
 		}
810 810
 		$str .= "</$type>";
811
-	    } elseif($typeDef['typeClass'] == 'element') {
811
+	    } elseif ($typeDef['typeClass'] == 'element') {
812 812
 		$str .= "></$type>";
813 813
 	    } else {
814 814
 		$str .= "/>";
@@ -828,22 +828,22 @@  discard block
 block discarded – undo
828 828
     * @access public
829 829
     * @deprecated
830 830
 	*/
831
-	function typeToForm($name,$type){
831
+	function typeToForm($name, $type) {
832 832
 		// get typedef
833
-		if($typeDef = $this->getTypeDef($type)){
833
+		if ($typeDef = $this->getTypeDef($type)) {
834 834
 			// if struct
835
-			if($typeDef['phpType'] == 'struct'){
835
+			if ($typeDef['phpType'] == 'struct') {
836 836
 				$buffer .= '<table>';
837
-				foreach($typeDef['elements'] as $child => $childDef){
837
+				foreach ($typeDef['elements'] as $child => $childDef) {
838 838
 					$buffer .= "
839 839
 					<tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
840 840
 					<td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>";
841 841
 				}
842 842
 				$buffer .= '</table>';
843 843
 			// if array
844
-			} elseif($typeDef['phpType'] == 'array'){
844
+			} elseif ($typeDef['phpType'] == 'array') {
845 845
 				$buffer .= '<table>';
846
-				for($i=0;$i < 3; $i++){
846
+				for ($i = 0; $i < 3; $i++) {
847 847
 					$buffer .= "
848 848
 					<tr><td align='right'>array item (type: $typeDef[arrayType]):</td>
849 849
 					<td><input type='text' name='parameters[".$name."][]'></td></tr>";
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	* @access public
901 901
 	* @see getTypeDef
902 902
 	*/
903
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
903
+	function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') {
904 904
 		$this->complexTypes[$name] = array(
905 905
 	    'name'		=> $name,
906 906
 	    'typeClass'	=> $typeClass,
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 	* @see nusoap_xmlschema
929 929
 	* @see getTypeDef
930 930
 	*/
931
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
931
+	function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) {
932 932
 		$this->simpleTypes[$name] = array(
933 933
 	    'name'			=> $name,
934 934
 	    'typeClass'		=> $typeClass,
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 	* @access public
950 950
 	*/
951 951
 	function addElement($attrs) {
952
-		if (! $this->getPrefix($attrs['type'])) {
953
-			$attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
952
+		if (!$this->getPrefix($attrs['type'])) {
953
+			$attrs['type'] = $this->schemaTargetNamespace.':'.$attrs['type'];
954 954
 		}
955
-		$this->elements[ $attrs['name'] ] = $attrs;
956
-		$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
955
+		$this->elements[$attrs['name']] = $attrs;
956
+		$this->elements[$attrs['name']]['typeClass'] = 'element';
957 957
 
958
-		$this->xdebug("addElement " . $attrs['name']);
959
-		$this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
958
+		$this->xdebug("addElement ".$attrs['name']);
959
+		$this->appendDebug($this->varDump($this->elements[$attrs['name']]));
960 960
 	}
961 961
 }
962 962
 
Please login to merge, or discard this patch.
src/Chamilo/UserBundle/Entity/Repository/UserRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                         INNER JOIN ChamiloUserBundle:User AS U WITH UF.friendUserId = U
259 259
                         WHERE
260 260
                             U.status != 6 AND
261
-                            UF.relationType NOT IN(" . USER_RELATION_TYPE_DELETED . ", " . USER_RELATION_TYPE_RRHH . ") AND
261
+                            UF.relationType NOT IN(" . USER_RELATION_TYPE_DELETED.", ".USER_RELATION_TYPE_RRHH.") AND
262 262
                             UF.userId = $currentUserId AND
263 263
                             UF.friendUserId != $currentUserId AND
264 264
                             U = R.user AND
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                 $dql = "SELECT DISTINCT U
283 283
                         FROM ChamiloUserBundle:User U
284 284
                         INNER JOIN ChamiloCoreBundle:TrackEOnline T WITH U.id = T.loginUserId
285
-                        WHERE T.loginDate >= '" . $limit_date . "'";
285
+                        WHERE T.loginDate >= '" . $limit_date."'";
286 286
             }
287 287
         }
288 288
 
Please login to merge, or discard this patch.
plugin/ims_lti/create.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         Display::return_message($plugin->get_lang('ToolAdded'), 'success')
34 34
     );
35 35
 
36
-    header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'ims_lti/list.php');
36
+    header('Location: '.api_get_path(WEB_PLUGIN_PATH).'ims_lti/list.php');
37 37
     exit;
38 38
 }
39 39
 
Please login to merge, or discard this patch.
plugin/ims_lti/OAuthSimple.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param shared_secret (String) The shared secret. This value is also usually provided by the site you wish to use.
26 26
 	 * @return OAuthSimple (Object)
27 27
      */
28
-    function __construct ($APIKey = "", $sharedSecret=""){
28
+    function __construct($APIKey = "", $sharedSecret = "") {
29 29
 
30 30
         if (!empty($APIKey))
31 31
 		{
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param(string, object) List of parameters for the call, this can either be a URI string (e.g. "foo=bar&gorp=banana" or an object/hash)
66 66
 	 * @return OAuthSimple (Object)
67 67
 	 */
68
-    public function setParameters ($parameters=Array()) {
68
+    public function setParameters($parameters = Array()) {
69 69
 
70 70
         if (is_string($parameters))
71 71
 		{
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		}
78 78
         else if (!empty($parameters))
79 79
 		{
80
-			$this->_parameters = array_merge($this->_parameters,$parameters);
80
+			$this->_parameters = array_merge($this->_parameters, $parameters);
81 81
 		}
82 82
         if (empty($this->_parameters['oauth_nonce']))
83 83
 		{
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		}
102 102
         if (empty($this->_parameters['oauth_version']))
103 103
 		{
104
-            $this->_parameters['oauth_version']="1.0";
104
+            $this->_parameters['oauth_version'] = "1.0";
105 105
 		}
106 106
 
107 107
         return $this;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @access public
114 114
 	 * @see setParameters
115 115
 	 */
116
-    public function setQueryString ($parameters)
116
+    public function setQueryString($parameters)
117 117
     {
118 118
         return $this->setParameters($parameters);
119 119
     }
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
      * @param path (String) the fully qualified URI (excluding query arguments) (e.g "http://example.org/foo")
125 125
 	 * @return OAuthSimple (Object)
126 126
      */
127
-    public function setURL ($path)
127
+    public function setURL($path)
128 128
 	{
129 129
         if (empty($path))
130 130
 		{
131 131
             throw new OAuthSimpleException('No path specified for OAuthSimple.setURL');
132 132
 		}
133
-        $this->_path=$path;
133
+        $this->_path = $path;
134 134
 
135 135
         return $this;
136 136
     }
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
      * @param path (String)
142 142
 	 * @see setURL
143 143
      */
144
-    public function setPath ($path)
144
+    public function setPath($path)
145 145
     {
146
-        return $this->_path=$path;
146
+        return $this->_path = $path;
147 147
     }
148 148
 
149 149
     /**
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
      * @param action (String) HTTP Action word.
153 153
 	 * @return OAuthSimple (Object)
154 154
      */
155
-    public function setAction ($action)
155
+    public function setAction($action)
156 156
     {
157 157
         if (empty($action))
158 158
 		{
159 159
 			$action = 'GET';
160 160
 		}
161 161
         $action = strtoupper($action);
162
-        if (preg_match('/[^A-Z]/',$action))
162
+        if (preg_match('/[^A-Z]/', $action))
163 163
 		{
164 164
             throw new OAuthSimpleException('Invalid action specified for OAuthSimple.setAction');
165 165
 		}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param signatures (object) object/hash of the token/signature pairs {api_key:, shared_secret:, oauth_token: oauth_secret:}
175 175
 	 * @return OAuthSimple (Object)
176 176
      */
177
-    public function signatures ($signatures)
177
+    public function signatures($signatures)
178 178
     {
179 179
         if (!empty($signatures) && !is_array($signatures))
180 180
 		{
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
         {
185 185
             if (empty($this->_secrets))
186 186
             {
187
-                $this->_secrets=Array();
187
+                $this->_secrets = Array();
188 188
             }
189
-            $this->_secrets=array_merge($this->_secrets,$signatures);
189
+            $this->_secrets = array_merge($this->_secrets, $signatures);
190 190
         }
191 191
         if (isset($this->_secrets['api_key']))
192 192
 		{
@@ -231,21 +231,21 @@  discard block
 block discarded – undo
231 231
      * @param method (String) Method of signing the transaction (only PLAINTEXT and SHA-MAC1 allowed for now)
232 232
 	 * @return OAuthSimple (Object)
233 233
     */
234
-    public function setSignatureMethod ($method="")
234
+    public function setSignatureMethod($method = "")
235 235
 	{
236 236
         if (empty($method))
237 237
 		{
238 238
             $method = $this->_default_signature_method;
239 239
 		}
240 240
         $method = strtoupper($method);
241
-        switch($method)
241
+        switch ($method)
242 242
         {
243 243
             case 'PLAINTEXT':
244 244
             case 'HMAC-SHA1':
245
-                $this->_parameters['oauth_signature_method']=$method;
245
+                $this->_parameters['oauth_signature_method'] = $method;
246 246
 				break;
247 247
             default:
248
-                throw new OAuthSimpleException ("Unknown signing method $method specified for OAuthSimple.setSignatureMethod");
248
+                throw new OAuthSimpleException("Unknown signing method $method specified for OAuthSimple.setSignatureMethod");
249 249
 				break;
250 250
         }
251 251
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      * @param args (Array) hash of arguments for the call {action, path, parameters (array), method, signatures (array)} all arguments are optional.
261 261
 	 * @return (Array) signed values
262 262
      */
263
-    public function sign($args=array())
263
+    public function sign($args = array())
264 264
     {
265 265
         if (!empty($args['action']))
266 266
 		{
@@ -280,15 +280,15 @@  discard block
 block discarded – undo
280 280
 		}
281 281
         if (empty($args['parameters']))
282 282
 		{
283
-            $args['parameters']=array();
283
+            $args['parameters'] = array();
284 284
 		}
285 285
         $this->setParameters($args['parameters']);
286 286
         $normParams = $this->_normalizedParameters();
287 287
 
288
-        return Array (
288
+        return Array(
289 289
             'parameters' => $this->_parameters,
290 290
             'signature' => self::_oauthEscape($this->_parameters['oauth_signature']),
291
-            'signed_url' => $this->_path . '?' . $normParams,
291
+            'signed_url' => $this->_path.'?'.$normParams,
292 292
             'header' => $this->getHeaderString(),
293 293
             'sbs'=> $this->sbs
294 294
             );
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @param args (Array)
305 305
 	 * @return $result (String)
306 306
     */
307
-    public function getHeaderString ($args=array())
307
+    public function getHeaderString($args = array())
308 308
     {
309 309
         if (empty($this->_parameters['oauth_signature']))
310 310
 		{
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
         foreach ($this->_parameters as $pName => $pValue)
316 316
         {
317
-            if (strpos($pName,'oauth_') !== 0)
317
+            if (strpos($pName, 'oauth_') !== 0)
318 318
 			{
319 319
                 continue;
320 320
 			}
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
             {
323 323
                 foreach ($pValue as $val)
324 324
                 {
325
-                    $result .= $pName .'="' . self::_oauthEscape($val) . '", ';
325
+                    $result .= $pName.'="'.self::_oauthEscape($val).'", ';
326 326
                 }
327 327
             }
328 328
             else
329 329
             {
330
-                $result .= $pName . '="' . self::_oauthEscape($pValue) . '", ';
330
+                $result .= $pName.'="'.self::_oauthEscape($pValue).'", ';
331 331
             }
332 332
         }
333 333
 
334
-        return preg_replace('/, $/','',$result);
334
+        return preg_replace('/, $/', '', $result);
335 335
     }
336 336
 
337
-    private function _parseParameterString ($paramString)
337
+    private function _parseParameterString($paramString)
338 338
     {
339
-        $elements = explode('&',$paramString);
339
+        $elements = explode('&', $paramString);
340 340
         $result = array();
341 341
         foreach ($elements as $element)
342 342
         {
343
-            list ($key,$token) = explode('=',$element);
343
+            list ($key, $token) = explode('=', $element);
344 344
             if ($token)
345 345
 			{
346 346
                 $token = urldecode($token);
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
             {
350 350
                 if (!is_array($result[$key]))
351 351
 				{
352
-                    $result[$key] = array($result[$key],$token);
352
+                    $result[$key] = array($result[$key], $token);
353 353
 				}
354 354
                 else
355 355
 				{
356
-                    array_push($result[$key],$token);
356
+                    array_push($result[$key], $token);
357 357
 				}
358 358
             }
359 359
             else
360
-                $result[$key]=$token;
360
+                $result[$key] = $token;
361 361
         }
362 362
         return $result;
363 363
     }
@@ -375,21 +375,21 @@  discard block
 block discarded – undo
375 375
 
376 376
 	    //FIX: urlencode of ~ and '+'
377 377
         $string = str_replace(
378
-            Array('%7E','+'  ), // Replace these
379
-            Array('~',  '%20'), // with these
378
+            Array('%7E', '+'), // Replace these
379
+            Array('~', '%20'), // with these
380 380
             $string);
381 381
 
382 382
         return $string;
383 383
     }
384 384
 
385
-    private function _getNonce($length=5)
385
+    private function _getNonce($length = 5)
386 386
     {
387 387
         $result = '';
388 388
         $cLength = strlen($this->_nonce_chars);
389
-        for ($i=0; $i < $length; $i++)
389
+        for ($i = 0; $i < $length; $i++)
390 390
         {
391
-            $rnum = rand(0,$cLength - 1);
392
-            $result .= substr($this->_nonce_chars,$rnum,1);
391
+            $rnum = rand(0, $cLength - 1);
392
+            $result .= substr($this->_nonce_chars, $rnum, 1);
393 393
         }
394 394
         $this->_parameters['oauth_nonce'] = $result;
395 395
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         {
403 403
             throw new OAuthSimpleException('No consumer_key set for OAuthSimple');
404 404
         }
405
-        $this->_parameters['oauth_consumer_key']=$this->_secrets['consumer_key'];
405
+        $this->_parameters['oauth_consumer_key'] = $this->_secrets['consumer_key'];
406 406
 
407 407
         return $this->_parameters['oauth_consumer_key'];
408 408
     }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 		$normalized_keys = array();
433 433
 		$return_array = array();
434 434
 
435
-        foreach ( $this->_parameters as $paramName=>$paramValue) {
435
+        foreach ($this->_parameters as $paramName=>$paramValue) {
436 436
             if (preg_match('/w+_secret/', $paramName) OR
437 437
                 $paramName == "oauth_signature") {
438 438
                     continue;
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 				if (is_array($paramValue))
444 444
 				{
445 445
 					$normalized_keys[self::_oauthEscape($paramName)] = array();
446
-					foreach($paramValue as $item)
446
+					foreach ($paramValue as $item)
447 447
 					{
448
-						array_push($normalized_keys[self::_oauthEscape($paramName)],  self::_oauthEscape($item));
448
+						array_push($normalized_keys[self::_oauthEscape($paramName)], self::_oauthEscape($item));
449 449
 					}
450 450
 				}
451 451
 				else
@@ -457,54 +457,54 @@  discard block
 block discarded – undo
457 457
 
458 458
 		ksort($normalized_keys);
459 459
 
460
-		foreach($normalized_keys as $key=>$val)
460
+		foreach ($normalized_keys as $key=>$val)
461 461
 		{
462 462
 			if (is_array($val))
463 463
 			{
464 464
 				sort($val);
465
-				foreach($val as $element)
465
+				foreach ($val as $element)
466 466
 				{
467
-					array_push($return_array, $key . "=" . $element);
467
+					array_push($return_array, $key."=".$element);
468 468
 				}
469 469
 			}
470 470
 			else
471 471
 			{
472
-				array_push($return_array, $key .'='. $val);
472
+				array_push($return_array, $key.'='.$val);
473 473
 			}
474 474
 
475 475
         }
476 476
         $presig = join("&", $return_array);
477 477
         $sig = $this->_generateSignature($presig);
478
-        $this->_parameters['oauth_signature']=$sig;
478
+        $this->_parameters['oauth_signature'] = $sig;
479 479
         array_push($return_array, "oauth_signature=$sig");
480 480
 		return join("&", $return_array);
481 481
     }
482 482
 
483 483
 
484
-    private function _generateSignature ($parameters="")
484
+    private function _generateSignature($parameters = "")
485 485
     {
486 486
         $secretKey = '';
487
-		if(isset($this->_secrets['shared_secret']))
487
+		if (isset($this->_secrets['shared_secret']))
488 488
 		{
489 489
 			$secretKey = self::_oauthEscape($this->_secrets['shared_secret']);
490 490
 		}
491 491
 
492 492
 		$secretKey .= '&';
493
-		if(isset($this->_secrets['oauth_secret']))
493
+		if (isset($this->_secrets['oauth_secret']))
494 494
 		{
495 495
             $secretKey .= self::_oauthEscape($this->_secrets['oauth_secret']);
496 496
         }
497
-        if(!empty($parameters)){
497
+        if (!empty($parameters)) {
498 498
             $parameters = urlencode($parameters);
499 499
         }
500
-        switch($this->_parameters['oauth_signature_method'])
500
+        switch ($this->_parameters['oauth_signature_method'])
501 501
         {
502 502
             case 'PLAINTEXT':
503
-                return urlencode($secretKey);;
503
+                return urlencode($secretKey); ;
504 504
             case 'HMAC-SHA1':
505 505
                 $this->sbs = self::_oauthEscape($this->_action).'&'.self::_oauthEscape($this->_path).'&'.$parameters;
506 506
 
507
-                return base64_encode(hash_hmac('sha1',$this->sbs,$secretKey,TRUE));
507
+                return base64_encode(hash_hmac('sha1', $this->sbs, $secretKey, TRUE));
508 508
             default:
509 509
                 throw new OAuthSimpleException('Unknown signature method for OAuthSimple');
510 510
 				break;
Please login to merge, or discard this patch.