Completed
Push — scrutinizer ( 84e9d0...6a9613 )
by Fabio
22:48
created
framework/Xml/TXmlDocument.php 3 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -66,6 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 	/**
68 68
 	 * @param TXmlElement parent element of this element
69
+	 * @param TXmlElement|null $parent
69 70
 	 */
70 71
 	public function setParent($parent)
71 72
 	{
@@ -121,6 +122,7 @@  discard block
 block discarded – undo
121 122
 	}
122 123
 
123 124
 	/**
125
+	 * @param string $name
124 126
 	 * @return string the attribute specified by the name, null if no such attribute
125 127
 	 */
126 128
 	public function getAttribute($name)
@@ -134,6 +136,8 @@  discard block
 block discarded – undo
134 136
 	/**
135 137
 	 * @param string attribute name
136 138
 	 * @param string attribute value
139
+	 * @param string $name
140
+	 * @param string $value
137 141
 	 */
138 142
 	public function setAttribute($name,$value)
139 143
 	{
@@ -161,6 +165,7 @@  discard block
 block discarded – undo
161 165
 	}
162 166
 
163 167
 	/**
168
+	 * @param string $tagName
164 169
 	 * @return TXmlElement the first child element that has the specified tag-name, null if not found
165 170
 	 */
166 171
 	public function getElementByTagName($tagName)
@@ -175,6 +180,7 @@  discard block
 block discarded – undo
175 180
 	}
176 181
 
177 182
 	/**
183
+	 * @param string $tagName
178 184
 	 * @return TList list of all child elements that have the specified tag-name
179 185
 	 */
180 186
 	public function getElementsByTagName($tagName)
@@ -334,6 +340,7 @@  discard block
 block discarded – undo
334 340
 
335 341
 	/**
336 342
 	 * @param string version of this XML document
343
+	 * @param string $version
337 344
 	 */
338 345
 	public function setVersion($version)
339 346
 	{
@@ -350,6 +357,7 @@  discard block
 block discarded – undo
350 357
 
351 358
 	/**
352 359
 	 * @param string encoding of this XML document
360
+	 * @param string $encoding
353 361
 	 */
354 362
 	public function setEncoding($encoding)
355 363
 	{
@@ -426,6 +434,7 @@  discard block
 block discarded – undo
426 434
 	/**
427 435
 	 * Saves this XML document as an XML file.
428 436
 	 * @param string the name of the file to be stored with XML output
437
+	 * @param string $file
429 438
 	 * @throws TIOException if the file cannot be written
430 439
 	 */
431 440
 	public function saveToFile($file)
@@ -532,6 +541,7 @@  discard block
 block discarded – undo
532 541
 	 * operations for each newly added TXmlElement object.
533 542
 	 * @param integer the specified position.
534 543
 	 * @param mixed new item
544
+	 * @param integer $index
535 545
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a TXmlElement object.
536 546
 	 */
537 547
 	public function insertAt($index,$item)
@@ -552,6 +562,7 @@  discard block
 block discarded – undo
552 562
 	 * This overrides the parent implementation by performing additional
553 563
 	 * cleanup work when removing a TXmlElement object.
554 564
 	 * @param integer the index of the item to be removed.
565
+	 * @param integer $index
555 566
 	 * @return mixed the removed item.
556 567
 	 */
557 568
 	public function removeAt($index)
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * @var TXmlElement parent of this element
31 31
 	 */
32
-	private $_parent=null;
32
+	private $_parent = null;
33 33
 	/**
34 34
 	 * @var string tag-name of this element
35 35
 	 */
36
-	private $_tagName='unknown';
36
+	private $_tagName = 'unknown';
37 37
 	/**
38 38
 	 * @var string text enclosed between opening and closing tags of this element
39 39
 	 */
40
-	private $_value='';
40
+	private $_value = '';
41 41
 	/**
42 42
 	 * @var TXmlElementList list of child elements of this element
43 43
 	 */
44
-	private $_elements=null;
44
+	private $_elements = null;
45 45
 	/**
46 46
 	 * @var TMap attributes of this element
47 47
 	 */
48
-	private $_attributes=null;
48
+	private $_attributes = null;
49 49
 
50 50
 	/**
51 51
 	 * Constructor.
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function setParent($parent)
71 71
 	{
72
-		$this->_parent=$parent;
72
+		$this->_parent = $parent;
73 73
 	}
74 74
 
75 75
 	/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function setTagName($tagName)
87 87
 	{
88
-		$this->_tagName=$tagName;
88
+		$this->_tagName = $tagName;
89 89
 	}
90 90
 
91 91
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function setValue($value)
103 103
 	{
104
-		$this->_value=TPropertyValue::ensureString($value);
104
+		$this->_value = TPropertyValue::ensureString($value);
105 105
 	}
106 106
 
107 107
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function getHasElement()
111 111
 	{
112
-		return $this->_elements!==null && $this->_elements->getCount()>0;
112
+		return $this->_elements !== null && $this->_elements->getCount() > 0;
113 113
 	}
114 114
 
115 115
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function getHasAttribute()
119 119
 	{
120
-		return $this->_attributes!==null && $this->_attributes->getCount()>0;
120
+		return $this->_attributes !== null && $this->_attributes->getCount() > 0;
121 121
 	}
122 122
 
123 123
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function getAttribute($name)
127 127
 	{
128
-		if($this->_attributes!==null)
128
+		if ($this->_attributes !== null)
129 129
 			return $this->_attributes->itemAt($name);
130 130
 		else
131 131
 			return null;
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 * @param string attribute name
136 136
 	 * @param string attribute value
137 137
 	 */
138
-	public function setAttribute($name,$value)
138
+	public function setAttribute($name, $value)
139 139
 	{
140
-		$this->getAttributes()->add($name,TPropertyValue::ensureString($value));
140
+		$this->getAttributes()->add($name, TPropertyValue::ensureString($value));
141 141
 	}
142 142
 
143 143
 	/**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public function getElements()
147 147
 	{
148
-		if(!$this->_elements)
149
-			$this->_elements=new TXmlElementList($this);
148
+		if (!$this->_elements)
149
+			$this->_elements = new TXmlElementList($this);
150 150
 		return $this->_elements;
151 151
 	}
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function getAttributes()
157 157
 	{
158
-		if(!$this->_attributes)
159
-			$this->_attributes=new TMap;
158
+		if (!$this->_attributes)
159
+			$this->_attributes = new TMap;
160 160
 		return $this->_attributes;
161 161
 	}
162 162
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function getElementByTagName($tagName)
167 167
 	{
168
-		if($this->_elements)
168
+		if ($this->_elements)
169 169
 		{
170
-			foreach($this->_elements as $element)
171
-				if($element->_tagName===$tagName)
170
+			foreach ($this->_elements as $element)
171
+				if ($element->_tagName === $tagName)
172 172
 					return $element;
173 173
 		}
174 174
 		return null;
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function getElementsByTagName($tagName)
181 181
 	{
182
-		$list=new TList;
183
-		if($this->_elements)
182
+		$list = new TList;
183
+		if ($this->_elements)
184 184
 		{
185
-			foreach($this->_elements as $element)
186
-				if($element->_tagName===$tagName)
185
+			foreach ($this->_elements as $element)
186
+				if ($element->_tagName === $tagName)
187 187
 					$list->add($element);
188 188
 		}
189 189
 		return $list;
@@ -192,33 +192,33 @@  discard block
 block discarded – undo
192 192
 	/**
193 193
 	 * @return string string representation of this element
194 194
 	 */
195
-	public function toString($indent=0)
195
+	public function toString($indent = 0)
196 196
 	{
197
-		$attr='';
198
-		if($this->_attributes!==null)
197
+		$attr = '';
198
+		if ($this->_attributes !== null)
199 199
 		{
200
-			foreach($this->_attributes as $name=>$value)
200
+			foreach ($this->_attributes as $name=>$value)
201 201
 			{
202
-				$value=$this->xmlEncode($value);
203
-				$attr.=" $name=\"$value\"";
202
+				$value = $this->xmlEncode($value);
203
+				$attr .= " $name=\"$value\"";
204 204
 			}
205 205
 		}
206
-		$prefix=str_repeat(' ',$indent*4);
207
-		if($this->getHasElement())
206
+		$prefix = str_repeat(' ', $indent * 4);
207
+		if ($this->getHasElement())
208 208
 		{
209
-			$str=$prefix."<{$this->_tagName}$attr>\n";
210
-			foreach($this->getElements() as $element)
211
-				$str.=$element->toString($indent+1)."\n";
212
-			$str.=$prefix."</{$this->_tagName}>";
209
+			$str = $prefix . "<{$this->_tagName}$attr>\n";
210
+			foreach ($this->getElements() as $element)
211
+				$str .= $element->toString($indent + 1) . "\n";
212
+			$str .= $prefix . "</{$this->_tagName}>";
213 213
 			return $str;
214 214
 		}
215
-		else if(($value=$this->getValue())!=='')
215
+		else if (($value = $this->getValue()) !== '')
216 216
 		{
217
-			$value=$this->xmlEncode($value);
218
-			return $prefix."<{$this->_tagName}$attr>$value</{$this->_tagName}>";
217
+			$value = $this->xmlEncode($value);
218
+			return $prefix . "<{$this->_tagName}$attr>$value</{$this->_tagName}>";
219 219
 		}
220 220
 		else
221
-			return $prefix."<{$this->_tagName}$attr />";
221
+			return $prefix . "<{$this->_tagName}$attr />";
222 222
 	}
223 223
 
224 224
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 	private function xmlEncode($str)
243 243
 	{
244
-		return strtr($str,array(
244
+		return strtr($str, array(
245 245
 			'>'=>'&gt;',
246 246
 			'<'=>'&lt;',
247 247
 			'&'=>'&amp;',
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @param string version of this XML document
318 318
 	 * @param string encoding of this XML document
319 319
 	 */
320
-	public function __construct($version='1.0',$encoding='')
320
+	public function __construct($version = '1.0', $encoding = '')
321 321
 	{
322 322
 		parent::__construct('');
323 323
 		$this->setVersion($version);
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	public function setVersion($version)
339 339
 	{
340
-		$this->_version=$version;
340
+		$this->_version = $version;
341 341
 	}
342 342
 
343 343
 	/**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	 */
354 354
 	public function setEncoding($encoding)
355 355
 	{
356
-		$this->_encoding=$encoding;
356
+		$this->_encoding = $encoding;
357 357
 	}
358 358
 
359 359
 	/**
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	public function loadFromFile($file)
366 366
 	{
367
-		if(($str=@file_get_contents($file))!==false)
367
+		if (($str = @file_get_contents($file)) !== false)
368 368
 			return $this->loadFromString($str);
369 369
 		else
370
-			throw new TIOException('xmldocument_file_read_failed',$file);
370
+			throw new TIOException('xmldocument_file_read_failed', $file);
371 371
 	}
372 372
 
373 373
 	/**
@@ -379,44 +379,44 @@  discard block
 block discarded – undo
379 379
 	public function loadFromString($string)
380 380
 	{
381 381
 		// TODO: since PHP 5.1, we can get parsing errors and throw them as exception
382
-		$doc=new DOMDocument();
383
-		if($doc->loadXML($string)===false)
382
+		$doc = new DOMDocument();
383
+		if ($doc->loadXML($string) === false)
384 384
 			return false;
385 385
 
386 386
 		$this->setEncoding($doc->encoding);
387 387
 		$this->setVersion($doc->version);
388 388
 
389
-		$element=$doc->documentElement;
389
+		$element = $doc->documentElement;
390 390
 		$this->setTagName($element->tagName);
391 391
 		$this->setValue($element->nodeValue);
392
-		$elements=$this->getElements();
393
-		$attributes=$this->getAttributes();
392
+		$elements = $this->getElements();
393
+		$attributes = $this->getAttributes();
394 394
 		$elements->clear();
395 395
 		$attributes->clear();
396 396
 
397 397
 		static $bSimpleXml;
398
-		if($bSimpleXml === null)
399
-			$bSimpleXml = (boolean)function_exists('simplexml_load_string');
398
+		if ($bSimpleXml === null)
399
+			$bSimpleXml = (boolean) function_exists('simplexml_load_string');
400 400
 
401
-		if($bSimpleXml)
401
+		if ($bSimpleXml)
402 402
 		{
403 403
 			$simpleDoc = simplexml_load_string($string);
404 404
 			$docNamespaces = $simpleDoc->getDocNamespaces(false);
405 405
 			$simpleDoc = null;
406
-			foreach($docNamespaces as $prefix => $uri)
406
+			foreach ($docNamespaces as $prefix => $uri)
407 407
 			{
408
- 				if($prefix === '')
408
+ 				if ($prefix === '')
409 409
    					$attributes->add('xmlns', $uri);
410 410
    				else
411
-   					$attributes->add('xmlns:'.$prefix, $uri);
411
+   					$attributes->add('xmlns:' . $prefix, $uri);
412 412
 			}
413 413
 		}
414 414
 
415
-		foreach($element->attributes as $name=>$attr)
416
-			$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value);
417
-		foreach($element->childNodes as $child)
415
+		foreach ($element->attributes as $name=>$attr)
416
+			$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name, $attr->value);
417
+		foreach ($element->childNodes as $child)
418 418
 		{
419
-			if($child instanceof DOMElement)
419
+			if ($child instanceof DOMElement)
420 420
 				$elements->add($this->buildElement($child));
421 421
 		}
422 422
 
@@ -430,13 +430,13 @@  discard block
 block discarded – undo
430 430
 	 */
431 431
 	public function saveToFile($file)
432 432
 	{
433
-		if(($fw=fopen($file,'w'))!==false)
433
+		if (($fw = fopen($file, 'w')) !== false)
434 434
 		{
435
-			fwrite($fw,$this->saveToString());
435
+			fwrite($fw, $this->saveToString());
436 436
 			fclose($fw);
437 437
 		}
438 438
 		else
439
-			throw new TIOException('xmldocument_file_write_failed',$file);
439
+			throw new TIOException('xmldocument_file_write_failed', $file);
440 440
 	}
441 441
 
442 442
 	/**
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	public function saveToString()
447 447
 	{
448
-		$version=empty($this->_version)?' version="1.0"':' version="'.$this->_version.'"';
449
-		$encoding=empty($this->_encoding)?'':' encoding="'.$this->_encoding.'"';
450
-		return "<?xml{$version}{$encoding}?>\n".$this->toString(0);
448
+		$version = empty($this->_version) ? ' version="1.0"' : ' version="' . $this->_version . '"';
449
+		$encoding = empty($this->_encoding) ? '' : ' encoding="' . $this->_encoding . '"';
450
+		return "<?xml{$version}{$encoding}?>\n" . $this->toString(0);
451 451
 	}
452 452
 
453 453
 	/**
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	protected function buildElement($node)
479 479
 	{
480
-		$element=new TXmlElement($node->tagName);
480
+		$element = new TXmlElement($node->tagName);
481 481
 		$element->setValue($node->nodeValue);
482
-		foreach($node->attributes as $name=>$attr)
483
-			$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value);
482
+		foreach ($node->attributes as $name=>$attr)
483
+			$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name, $attr->value);
484 484
 
485
-		foreach($node->childNodes as $child)
485
+		foreach ($node->childNodes as $child)
486 486
 		{
487
-			if($child instanceof DOMElement)
487
+			if ($child instanceof DOMElement)
488 488
 				$element->getElements()->add($this->buildElement($child));
489 489
 		}
490 490
 		return $element;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	public function __construct(TXmlElement $owner)
517 517
 	{
518
-		$this->_o=$owner;
518
+		$this->_o = $owner;
519 519
 	}
520 520
 
521 521
 	/**
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
 	 * @param mixed new item
535 535
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a TXmlElement object.
536 536
 	 */
537
-	public function insertAt($index,$item)
537
+	public function insertAt($index, $item)
538 538
 	{
539
-		if($item instanceof TXmlElement)
539
+		if ($item instanceof TXmlElement)
540 540
 		{
541
-			parent::insertAt($index,$item);
542
-			if($item->getParent()!==null)
541
+			parent::insertAt($index, $item);
542
+			if ($item->getParent() !== null)
543 543
 				$item->getParent()->getElements()->remove($item);
544 544
 			$item->setParent($this->_o);
545 545
 		}
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	public function removeAt($index)
558 558
 	{
559
-		$item=parent::removeAt($index);
560
-		if($item instanceof TXmlElement)
559
+		$item = parent::removeAt($index);
560
+		if ($item instanceof TXmlElement)
561 561
 			$item->setParent(null);
562 562
 		return $item;
563 563
 	}
Please login to merge, or discard this patch.
Braces   +61 added lines, -46 removed lines patch added patch discarded remove patch
@@ -125,10 +125,11 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function getAttribute($name)
127 127
 	{
128
-		if($this->_attributes!==null)
129
-			return $this->_attributes->itemAt($name);
130
-		else
131
-			return null;
128
+		if($this->_attributes!==null) {
129
+					return $this->_attributes->itemAt($name);
130
+		} else {
131
+					return null;
132
+		}
132 133
 	}
133 134
 
134 135
 	/**
@@ -145,8 +146,9 @@  discard block
 block discarded – undo
145 146
 	 */
146 147
 	public function getElements()
147 148
 	{
148
-		if(!$this->_elements)
149
-			$this->_elements=new TXmlElementList($this);
149
+		if(!$this->_elements) {
150
+					$this->_elements=new TXmlElementList($this);
151
+		}
150 152
 		return $this->_elements;
151 153
 	}
152 154
 
@@ -155,8 +157,9 @@  discard block
 block discarded – undo
155 157
 	 */
156 158
 	public function getAttributes()
157 159
 	{
158
-		if(!$this->_attributes)
159
-			$this->_attributes=new TMap;
160
+		if(!$this->_attributes) {
161
+					$this->_attributes=new TMap;
162
+		}
160 163
 		return $this->_attributes;
161 164
 	}
162 165
 
@@ -167,9 +170,10 @@  discard block
 block discarded – undo
167 170
 	{
168 171
 		if($this->_elements)
169 172
 		{
170
-			foreach($this->_elements as $element)
171
-				if($element->_tagName===$tagName)
173
+			foreach($this->_elements as $element) {
174
+							if($element->_tagName===$tagName)
172 175
 					return $element;
176
+			}
173 177
 		}
174 178
 		return null;
175 179
 	}
@@ -182,9 +186,10 @@  discard block
 block discarded – undo
182 186
 		$list=new TList;
183 187
 		if($this->_elements)
184 188
 		{
185
-			foreach($this->_elements as $element)
186
-				if($element->_tagName===$tagName)
189
+			foreach($this->_elements as $element) {
190
+							if($element->_tagName===$tagName)
187 191
 					$list->add($element);
192
+			}
188 193
 		}
189 194
 		return $list;
190 195
 	}
@@ -207,18 +212,18 @@  discard block
 block discarded – undo
207 212
 		if($this->getHasElement())
208 213
 		{
209 214
 			$str=$prefix."<{$this->_tagName}$attr>\n";
210
-			foreach($this->getElements() as $element)
211
-				$str.=$element->toString($indent+1)."\n";
215
+			foreach($this->getElements() as $element) {
216
+							$str.=$element->toString($indent+1)."\n";
217
+			}
212 218
 			$str.=$prefix."</{$this->_tagName}>";
213 219
 			return $str;
214
-		}
215
-		else if(($value=$this->getValue())!=='')
220
+		} else if(($value=$this->getValue())!=='')
216 221
 		{
217 222
 			$value=$this->xmlEncode($value);
218 223
 			return $prefix."<{$this->_tagName}$attr>$value</{$this->_tagName}>";
224
+		} else {
225
+					return $prefix."<{$this->_tagName}$attr />";
219 226
 		}
220
-		else
221
-			return $prefix."<{$this->_tagName}$attr />";
222 227
 	}
223 228
 
224 229
 	/**
@@ -364,10 +369,11 @@  discard block
 block discarded – undo
364 369
 	 */
365 370
 	public function loadFromFile($file)
366 371
 	{
367
-		if(($str=@file_get_contents($file))!==false)
368
-			return $this->loadFromString($str);
369
-		else
370
-			throw new TIOException('xmldocument_file_read_failed',$file);
372
+		if(($str=@file_get_contents($file))!==false) {
373
+					return $this->loadFromString($str);
374
+		} else {
375
+					throw new TIOException('xmldocument_file_read_failed',$file);
376
+		}
371 377
 	}
372 378
 
373 379
 	/**
@@ -380,8 +386,9 @@  discard block
 block discarded – undo
380 386
 	{
381 387
 		// TODO: since PHP 5.1, we can get parsing errors and throw them as exception
382 388
 		$doc=new DOMDocument();
383
-		if($doc->loadXML($string)===false)
384
-			return false;
389
+		if($doc->loadXML($string)===false) {
390
+					return false;
391
+		}
385 392
 
386 393
 		$this->setEncoding($doc->encoding);
387 394
 		$this->setVersion($doc->version);
@@ -395,8 +402,9 @@  discard block
 block discarded – undo
395 402
 		$attributes->clear();
396 403
 
397 404
 		static $bSimpleXml;
398
-		if($bSimpleXml === null)
399
-			$bSimpleXml = (boolean)function_exists('simplexml_load_string');
405
+		if($bSimpleXml === null) {
406
+					$bSimpleXml = (boolean)function_exists('simplexml_load_string');
407
+		}
400 408
 
401 409
 		if($bSimpleXml)
402 410
 		{
@@ -405,19 +413,22 @@  discard block
 block discarded – undo
405 413
 			$simpleDoc = null;
406 414
 			foreach($docNamespaces as $prefix => $uri)
407 415
 			{
408
- 				if($prefix === '')
409
-   					$attributes->add('xmlns', $uri);
410
-   				else
411
-   					$attributes->add('xmlns:'.$prefix, $uri);
416
+ 				if($prefix === '') {
417
+ 				   					$attributes->add('xmlns', $uri);
418
+ 				} else {
419
+   				   					$attributes->add('xmlns:'.$prefix, $uri);
420
+   				}
412 421
 			}
413 422
 		}
414 423
 
415
-		foreach($element->attributes as $name=>$attr)
416
-			$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value);
424
+		foreach($element->attributes as $name=>$attr) {
425
+					$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value);
426
+		}
417 427
 		foreach($element->childNodes as $child)
418 428
 		{
419
-			if($child instanceof DOMElement)
420
-				$elements->add($this->buildElement($child));
429
+			if($child instanceof DOMElement) {
430
+							$elements->add($this->buildElement($child));
431
+			}
421 432
 		}
422 433
 
423 434
 		return true;
@@ -434,9 +445,9 @@  discard block
 block discarded – undo
434 445
 		{
435 446
 			fwrite($fw,$this->saveToString());
436 447
 			fclose($fw);
448
+		} else {
449
+					throw new TIOException('xmldocument_file_write_failed',$file);
437 450
 		}
438
-		else
439
-			throw new TIOException('xmldocument_file_write_failed',$file);
440 451
 	}
441 452
 
442 453
 	/**
@@ -479,13 +490,15 @@  discard block
 block discarded – undo
479 490
 	{
480 491
 		$element=new TXmlElement($node->tagName);
481 492
 		$element->setValue($node->nodeValue);
482
-		foreach($node->attributes as $name=>$attr)
483
-			$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value);
493
+		foreach($node->attributes as $name=>$attr) {
494
+					$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value);
495
+		}
484 496
 
485 497
 		foreach($node->childNodes as $child)
486 498
 		{
487
-			if($child instanceof DOMElement)
488
-				$element->getElements()->add($this->buildElement($child));
499
+			if($child instanceof DOMElement) {
500
+							$element->getElements()->add($this->buildElement($child));
501
+			}
489 502
 		}
490 503
 		return $element;
491 504
 	}
@@ -539,12 +552,13 @@  discard block
 block discarded – undo
539 552
 		if($item instanceof TXmlElement)
540 553
 		{
541 554
 			parent::insertAt($index,$item);
542
-			if($item->getParent()!==null)
543
-				$item->getParent()->getElements()->remove($item);
555
+			if($item->getParent()!==null) {
556
+							$item->getParent()->getElements()->remove($item);
557
+			}
544 558
 			$item->setParent($this->_o);
559
+		} else {
560
+					throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required');
545 561
 		}
546
-		else
547
-			throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required');
548 562
 	}
549 563
 
550 564
 	/**
@@ -557,8 +571,9 @@  discard block
 block discarded – undo
557 571
 	public function removeAt($index)
558 572
 	{
559 573
 		$item=parent::removeAt($index);
560
-		if($item instanceof TXmlElement)
561
-			$item->setParent(null);
574
+		if($item instanceof TXmlElement) {
575
+					$item->setParent(null);
576
+		}
562 577
 		return $item;
563 578
 	}
564 579
 }
Please login to merge, or discard this patch.
tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -19,6 +19,9 @@
 block discarded – undo
19 19
 			$this->setVisible(false);
20 20
     }
21 21
     
22
+    /**
23
+     * @param boolean $value
24
+     */
22 25
     public function setVisible($value)
23 26
     {
24 27
 		$this->ensureChildControls();
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -2,60 +2,60 @@
 block discarded – undo
2 2
 
3 3
 class DMessagesPanel extends TTemplateControl
4 4
 {
5
-    private $_panelCssClass = '';
5
+	private $_panelCssClass = '';
6 6
     
7
-    public function onInit($param)
8
-    {
9
-        parent::onInit($param);
10
-    	$this->MessagesPanelEffect->Text = "";
11
-    }
7
+	public function onInit($param)
8
+	{
9
+		parent::onInit($param);
10
+		$this->MessagesPanelEffect->Text = "";
11
+	}
12 12
     
13
-    public function setMessage($value)
14
-    {
15
-        $this->Message->Text = $value;
16
-        if ($value != '') 
13
+	public function setMessage($value)
14
+	{
15
+		$this->Message->Text = $value;
16
+		if ($value != '') 
17 17
 			$this->setVisible(true);
18
-        else 
18
+		else 
19 19
 			$this->setVisible(false);
20
-    }
20
+	}
21 21
     
22
-    public function setVisible($value)
23
-    {
22
+	public function setVisible($value)
23
+	{
24 24
 		$this->ensureChildControls();
25
-        if ($value === true) {
25
+		if ($value === true) {
26 26
 			echo "set visible";
27
-            $this->MessagesPanel->Visible = true;
28
-    	    $this->Message->Visible = true;
29
-    	    $this->setEffect(null);
30
-        } else {
31
-            $this->MessagesPanel->Visible = false;
32
-        }
33
-    }
27
+			$this->MessagesPanel->Visible = true;
28
+			$this->Message->Visible = true;
29
+			$this->setEffect(null);
30
+		} else {
31
+			$this->MessagesPanel->Visible = false;
32
+		}
33
+	}
34 34
     
35
-    public function setEffect($effect = null)
36
-    {
37
-        if ($effect !== null) {
38
-            $text = "<script type=\"text/javascript\" language=\"javascript\">\r\n";
39
-            $text .= "// <![CDATA[\r\n";
40
-            //$text .= "new Effect.$effect(\"" . $this->Page->DMessagesPanel->MessagesPanel->ClientID . "\");\r\n";
41
-            $text .= "new Effect.$effect(\"" . $this->ClientID . "\");\r\n";
42
-            $text .= "// ]]>\r\n";
43
-            $text .= "</script>";
44
-            $this->MessagesPanelEffect->Text = $text;
45
-        } else {
46
-            $this->MessagesPanelEffect->Text = '';
47
-        }
48
-    }
35
+	public function setEffect($effect = null)
36
+	{
37
+		if ($effect !== null) {
38
+			$text = "<script type=\"text/javascript\" language=\"javascript\">\r\n";
39
+			$text .= "// <![CDATA[\r\n";
40
+			//$text .= "new Effect.$effect(\"" . $this->Page->DMessagesPanel->MessagesPanel->ClientID . "\");\r\n";
41
+			$text .= "new Effect.$effect(\"" . $this->ClientID . "\");\r\n";
42
+			$text .= "// ]]>\r\n";
43
+			$text .= "</script>";
44
+			$this->MessagesPanelEffect->Text = $text;
45
+		} else {
46
+			$this->MessagesPanelEffect->Text = '';
47
+		}
48
+	}
49 49
     
50
-    public function setPanelCssClass($value)
51
-    {
50
+	public function setPanelCssClass($value)
51
+	{
52 52
 		$this->ensureChildControls();
53
-    	$this->MessagesPanel->CssClass = $value;
54
-    }
53
+		$this->MessagesPanel->CssClass = $value;
54
+	}
55 55
     
56
-    public function setMessageCssClass($value)
57
-    {
56
+	public function setMessageCssClass($value)
57
+	{
58 58
 		$this->ensureChildControls();
59
-    	$this->Message->CssClass = $value;
60
-    }
59
+		$this->Message->CssClass = $value;
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,10 +13,11 @@
 block discarded – undo
13 13
     public function setMessage($value)
14 14
     {
15 15
         $this->Message->Text = $value;
16
-        if ($value != '') 
17
-			$this->setVisible(true);
18
-        else 
19
-			$this->setVisible(false);
16
+        if ($value != '') {
17
+        			$this->setVisible(true);
18
+        } else {
19
+        			$this->setVisible(false);
20
+        }
20 21
     }
21 22
     
22 23
     public function setVisible($value)
Please login to merge, or discard this patch.
tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
4 4
 {
5 5
 	private $panels = array('pnlContentsA', 'pnlContentsB', 'pnlContentsC', );
6 6
 
7
+	/**
8
+	 * @param string $id
9
+	 */
7 10
 	private function showPanel($id, $param) 
8 11
 	{
9 12
 		foreach($this->panels as $panel) 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 
3 3
 class MyTabPanelTest extends TPage 
4 4
 {
5
-	private $panels = array('pnlContentsA', 'pnlContentsB', 'pnlContentsC', );
5
+	private $panels = array('pnlContentsA', 'pnlContentsB', 'pnlContentsC',);
6 6
 
7 7
 	private function showPanel($id, $param) 
8 8
 	{
9
-		foreach($this->panels as $panel) 
9
+		foreach ($this->panels as $panel) 
10 10
 		{
11
-			if($id == $panel) 
11
+			if ($id == $panel) 
12 12
 			{
13 13
 				$this->$panel->setAttribute('style', 'display: block;');
14 14
 				$this->$panel->setVisible(true);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
 				$this->$panel->setAttribute('style', 'display: block;');
14 14
 				$this->$panel->setVisible(true);
15 15
 				$this->$panel->render($param->NewWriter);
16
-			} 
17
-			else 
16
+			} else 
18 17
 			{
19 18
 				$this->$panel->setVisible(false);
20 19
 			}
Please login to merge, or discard this patch.
tests/FunctionalTests/active-controlstests/ActiveRatingListTestCase.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -247,6 +247,9 @@
 block discarded – undo
247 247
 		$this->byXPath("//input[@id='{$clientID}']/../..")->click();
248 248
 	}
249 249
 
250
+	/**
251
+	 * @param integer[] $checks
252
+	 */
250 253
 	function assertCheckBoxes($clientID, $checks, $total = 5)
251 254
 	{
252 255
 		for($i = 0; $i < $total; $i++)
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * ActiveRatingListTestCase.php
4
- *
5
- * @author Bradley Booms <[email protected]>
6
- * @version Creation Date: Oct 22, 2008
7
- */
3
+	 * ActiveRatingListTestCase.php
4
+	 *
5
+	 * @author Bradley Booms <[email protected]>
6
+	 * @version Creation Date: Oct 22, 2008
7
+	 */
8 8
 
9 9
 /**
10 10
  * ActiveRatingListTestCase.php class
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 {
24 24
 	function testCheckBoxes()
25 25
 	{
26
-		$base='ctl0_Content_';
26
+		$base = 'ctl0_Content_';
27 27
 		// Verify we're on the right page.
28 28
 		$this->url("active-controls/index.php?page=ActiveRatingListCheckBoxesTest");
29 29
 		$this->assertSourceContains("TActiveRatingList Check Boxes Test Case");
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	function testRating()
43 43
 	{
44
-		$base='ctl0_Content_';
44
+		$base = 'ctl0_Content_';
45 45
 		// Verify we're on the right page.
46 46
 		$this->url("active-controls/index.php?page=ActiveRatingListRatingTest");
47 47
 		$this->assertSourceContains("TActiveRatingList Rating Test Case");
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 	function testSelectedIndex()
64 64
 	{
65
-		$base='ctl0_Content_';
65
+		$base = 'ctl0_Content_';
66 66
 		// Verify we're on the right page.
67 67
 		$this->url("active-controls/index.php?page=ActiveRatingListSelectedIndexTest");
68 68
 		$this->assertSourceContains("TActiveRatingList SelectedIndex Test Case");
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 	function testAutoPostBack()
83 83
 	{
84
-		$base='ctl0_Content_';
84
+		$base = 'ctl0_Content_';
85 85
 		// Verify we're on the right page.
86 86
 		$this->url("active-controls/index.php?page=ActiveRatingListAutoPostBackTest");
87 87
 		$this->assertSourceContains("TActiveRatingList AutoPostBack Test Case");
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 	function testAllowInput()
102 102
 	{
103
-		$base='ctl0_Content_';
103
+		$base = 'ctl0_Content_';
104 104
 		// Verify we're on the right page.
105 105
 		$this->url("active-controls/index.php?page=ActiveRatingListAllowInputTest");
106 106
 		$this->assertSourceContains("TActiveRatingList AllowInput Test Case");
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 	function testReadOnly()
118 118
 	{
119
-		$base='ctl0_Content_';
119
+		$base = 'ctl0_Content_';
120 120
 		// Verify we're on the right page.
121 121
 		$this->url("active-controls/index.php?page=ActiveRatingListReadOnlyTest");
122 122
 		$this->assertSourceContains("TActiveRatingList ReadOnly Test Case");
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	function testEnabled()
157 157
 	{
158
-		$base='ctl0_Content_';
158
+		$base = 'ctl0_Content_';
159 159
 		// Verify we're on the right page.
160 160
 		$this->url("active-controls/index.php?page=ActiveRatingListEnabledTest");
161 161
 		$this->assertSourceContains("TActiveRatingList Enabled Test Case");
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 	function testHoverCaption()
196 196
 	{
197
-		$base='ctl0_Content_';
197
+		$base = 'ctl0_Content_';
198 198
 		// Verify we're on the right page.
199 199
 		$this->url("active-controls/index.php?page=ActiveRatingListHoverCaptionTest");
200 200
 		$this->assertSourceContains("TActiveRatingList Hover Caption Test Case");
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
 		$this->assertElementPresent("//input[@id='{$base}RatingList_c5']/../../../td[contains(@class, 'rating')]");
244 244
 	}
245 245
 
246
-	function clickTD($clientID){
246
+	function clickTD($clientID) {
247 247
 		$this->byXPath("//input[@id='{$clientID}']/../..")->click();
248 248
 	}
249 249
 
250 250
 	function assertCheckBoxes($clientID, $checks, $total = 5)
251 251
 	{
252
-		for($i = 0; $i < $total; $i++)
252
+		for ($i = 0; $i < $total; $i++)
253 253
 		{
254
-			if(in_array($i, $checks))
254
+			if (in_array($i, $checks))
255 255
 				$this->assertTrue($this->byId("{$clientID}_c{$i}")->selected());
256 256
 			else
257 257
 				$this->assertFalse($this->byId("{$clientID}_c{$i}")->selected());
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -251,10 +251,11 @@
 block discarded – undo
251 251
 	{
252 252
 		for($i = 0; $i < $total; $i++)
253 253
 		{
254
-			if(in_array($i, $checks))
255
-				$this->assertTrue($this->byId("{$clientID}_c{$i}")->selected());
256
-			else
257
-				$this->assertFalse($this->byId("{$clientID}_c{$i}")->selected());
254
+			if(in_array($i, $checks)) {
255
+							$this->assertTrue($this->byId("{$clientID}_c{$i}")->selected());
256
+			} else {
257
+							$this->assertFalse($this->byId("{$clientID}_c{$i}")->selected());
258
+			}
258 259
 		}
259 260
 	}
260 261
 }
261 262
\ No newline at end of file
Please login to merge, or discard this patch.
tests/FunctionalTests/features/protected/pages/FeatureList.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -10,6 +10,10 @@
 block discarded – undo
10 10
 		$this->List->dataBind();
11 11
 	}
12 12
 
13
+	/**
14
+	 * @param string $directory
15
+	 * @param string $basePath
16
+	 */
13 17
 	protected function getPageList($directory,$basePath)
14 18
 	{
15 19
 		$list=array();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,26 +5,26 @@
 block discarded – undo
5 5
 	public function onLoad($param)
6 6
 	{
7 7
 		parent::onLoad($param);
8
-		$list=$this->getPageList(dirname(__FILE__),'');
9
-		$this->List->DataSource=$list;
8
+		$list = $this->getPageList(dirname(__FILE__), '');
9
+		$this->List->DataSource = $list;
10 10
 		$this->List->dataBind();
11 11
 	}
12 12
 
13
-	protected function getPageList($directory,$basePath)
13
+	protected function getPageList($directory, $basePath)
14 14
 	{
15
-		$list=array();
16
-		$folder=@opendir($directory);
17
-		while($entry=@readdir($folder))
15
+		$list = array();
16
+		$folder = @opendir($directory);
17
+		while ($entry = @readdir($folder))
18 18
 		{
19
-			if($entry[0]==='.')
19
+			if ($entry[0] === '.')
20 20
 				continue;
21
-			else if(is_file($directory.'/'.$entry))
21
+			else if (is_file($directory . '/' . $entry))
22 22
 			{
23
-				if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false)
24
-					$list['?page='.$basePath.$page]=$basePath.$page;
23
+				if (($page = basename($entry, '.page')) !== $entry && strpos($page, '.') === false)
24
+					$list['?page=' . $basePath . $page] = $basePath . $page;
25 25
 			}
26 26
 			else
27
-				$list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.'));
27
+				$list = array_merge($list, $this->getPageList($directory . '/' . $entry, $basePath . $entry . '.'));
28 28
 		}
29 29
 		closedir($folder);
30 30
 		return $list;
Please login to merge, or discard this patch.
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,15 +16,16 @@
 block discarded – undo
16 16
 		$folder=@opendir($directory);
17 17
 		while($entry=@readdir($folder))
18 18
 		{
19
-			if($entry[0]==='.')
20
-				continue;
21
-			else if(is_file($directory.'/'.$entry))
19
+			if($entry[0]==='.') {
20
+							continue;
21
+			} else if(is_file($directory.'/'.$entry))
22 22
 			{
23
-				if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false)
24
-					$list['?page='.$basePath.$page]=$basePath.$page;
23
+				if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false) {
24
+									$list['?page='.$basePath.$page]=$basePath.$page;
25
+				}
26
+			} else {
27
+							$list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.'));
25 28
 			}
26
-			else
27
-				$list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.'));
28 29
 		}
29 30
 		closedir($folder);
30 31
 		return $list;
Please login to merge, or discard this patch.
tests/FunctionalTests/tickets/tests/Ticket700TestCase.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -74,6 +74,9 @@
 block discarded – undo
74 74
 		$this->byId('ctl0_Logout')->click();
75 75
 	}
76 76
 
77
+	/**
78
+	 * @param string $title
79
+	 */
77 80
 	public function assertTitleEquals($title)
78 81
 	{
79 82
 		$this->pause(50);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 		// page: admin.Home
19 19
 		$this->byId('pageAdminHome')->click();
20 20
 		$this->assertTitleEquals('UserLogin');
21
-		$this->type('ctl0_Main_Username','AdminUser');
22
-		$this->type('ctl0_Main_Password','demo');
21
+		$this->type('ctl0_Main_Username', 'AdminUser');
22
+		$this->type('ctl0_Main_Password', 'demo');
23 23
 		$this->byId('ctl0_Main_LoginButton')->click();
24 24
 		$this->pause(50);
25 25
 		$this->byId('pageAdminHome')->click();
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 		// page: admin.users.Home
42 42
 		$this->byId('pageAdminUsersHome')->click();
43 43
 		$this->assertTitleEquals('UserLogin');
44
-		$this->type('ctl0_Main_Username','NormalUser');
45
-		$this->type('ctl0_Main_Password','demo');
44
+		$this->type('ctl0_Main_Username', 'NormalUser');
45
+		$this->type('ctl0_Main_Password', 'demo');
46 46
 		$this->byId('ctl0_Main_LoginButton')->click();
47 47
 		$this->pause(50);
48 48
 		$this->byId('pageAdminUsersHome')->click();
49 49
 		$this->assertTitleEquals('UserLogin');
50
-		$this->type('ctl0_Main_Username','AdminUser');
51
-		$this->type('ctl0_Main_Password','demo');
50
+		$this->type('ctl0_Main_Username', 'AdminUser');
51
+		$this->type('ctl0_Main_Password', 'demo');
52 52
 		$this->byId('ctl0_Main_LoginButton')->click();
53 53
 		$this->pause(50);
54 54
 		$this->byId('pageAdminUsersHome')->click();
Please login to merge, or discard this patch.
tests/simple_unit/ActiveRecord/ActiveRecordMySql5TestCase.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -35,6 +35,10 @@
 block discarded – undo
35 35
 		$this->assertTrue($blog->delete());
36 36
 	}
37 37
 
38
+	/**
39
+	 * @param null|TActiveRecord $check
40
+	 * @param Blogs $blog
41
+	 */
38 42
 	function assertSameBlog($check, $blog)
39 43
 	{
40 44
 		$props = array('blog_id', 'blog_name', 'blog_author');
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 Prado::using('System.Data.ActiveRecord.TActiveRecord');
3
-require_once(dirname(__FILE__).'/records/Blogs.php');
3
+require_once(dirname(__FILE__) . '/records/Blogs.php');
4 4
 
5 5
 class ActiveRecordMySql5TestCase extends UnitTestCase
6 6
 {
7 7
 	function setup()
8 8
 	{
9
-		$conn = new TDbConnection('mysql:host=localhost;dbname=ar_test;port=3307', 'test5','test5');
9
+		$conn = new TDbConnection('mysql:host=localhost;dbname=ar_test;port=3307', 'test5', 'test5');
10 10
 		TActiveRecordManager::getInstance()->setDbConnection($conn);
11 11
 	}
12 12
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$check = Blogs::finder()->findByPk($blog->blog_id);
32 32
 
33
-		$this->assertSameBlog($check,$blog);
33
+		$this->assertSameBlog($check, $blog);
34 34
 
35 35
 		$this->assertTrue($blog->delete());
36 36
 	}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	function assertSameBlog($check, $blog)
39 39
 	{
40 40
 		$props = array('blog_id', 'blog_name', 'blog_author');
41
-		foreach($props as $prop)
41
+		foreach ($props as $prop)
42 42
 			$this->assertEqual($check->{$prop}, $blog->{$prop});
43 43
 	}
44 44
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@
 block discarded – undo
38 38
 	function assertSameBlog($check, $blog)
39 39
 	{
40 40
 		$props = array('blog_id', 'blog_name', 'blog_author');
41
-		foreach($props as $prop)
42
-			$this->assertEqual($check->{$prop}, $blog->{$prop});
41
+		foreach($props as $prop) {
42
+					$this->assertEqual($check->{$prop}, $blog->{$prop});
43
+		}
43 44
 	}
44 45
 
45 46
 }
46 47
\ No newline at end of file
Please login to merge, or discard this patch.
tests/simple_unit/ActiveRecord/FindByPksTestCase.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -53,6 +53,10 @@
 block discarded – undo
53 53
 		$this->assertIsDepSection($ds[1], 2, 5);
54 54
 	}
55 55
 
56
+	/**
57
+	 * @param integer $dep_id
58
+	 * @param integer $sec_id
59
+	 */
56 60
 	function assertIsDepSection($dep, $dep_id, $sec_id)
57 61
 	{
58 62
 		$this->assertTrue($dep instanceof DepSections);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 Prado::using('System.Data.ActiveRecord.TActiveRecord');
3
-require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
4
-require_once(dirname(__FILE__).'/records/DepSections.php');
3
+require_once(dirname(__FILE__) . '/records/DepartmentRecord.php');
4
+require_once(dirname(__FILE__) . '/records/DepSections.php');
5 5
 
6 6
 class FindByPksTestCase extends UnitTestCase
7 7
 {
8 8
 	function setup()
9 9
 	{
10
-		$conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test');
10
+		$conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test', 'test');
11 11
 		TActiveRecordManager::getInstance()->setDbConnection($conn);
12 12
 	}
13 13
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 	function test_find_by_pks()
29 29
 	{
30
-		$deps = DepartmentRecord::finder()->findAllByPks(1,2,4);
30
+		$deps = DepartmentRecord::finder()->findAllByPks(1, 2, 4);
31 31
 		$this->assertEqual(count($deps), 3);
32 32
 
33 33
 		$this->assertEqual($deps[0]->department_id, 1);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
 	function test_find_by_pks_with_invalid()
39 39
 	{
40
-		$deps = DepartmentRecord::finder()->findAllByPks(4,2,14);
40
+		$deps = DepartmentRecord::finder()->findAllByPks(4, 2, 14);
41 41
 		$this->assertEqual(count($deps), 2);
42 42
 
43 43
 		$this->assertEqual($deps[0]->department_id, 2);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 	function test_find_by_composite_pks()
48 48
 	{
49
-		$ds = DepSections::finder()->findAllByPks(array(1,1), array(2,5));
49
+		$ds = DepSections::finder()->findAllByPks(array(1, 1), array(2, 5));
50 50
 		$this->assertEqual(count($ds), 2);
51 51
 
52 52
 		$this->assertIsDepSection($ds[0], 1, 1);
Please login to merge, or discard this patch.
tests/simple_unit/ActiveRecord/UserRecordTestCase.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -53,6 +53,10 @@
 block discarded – undo
53 53
 		$this->assertTrue($user->delete());
54 54
 	}
55 55
 
56
+	/**
57
+	 * @param UserRecord $user
58
+	 * @param null|TActiveRecord $check
59
+	 */
56 60
 	function assertSameUser($user,$check)
57 61
 	{
58 62
 		$props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title',
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 Prado::using('System.Data.ActiveRecord.TActiveRecord');
3
-require_once(dirname(__FILE__).'/records/UserRecord.php');
3
+require_once(dirname(__FILE__) . '/records/UserRecord.php');
4 4
 
5 5
 class UserRecordTestCase extends UnitTestCase
6 6
 {
7 7
 	function setup()
8 8
 	{
9
-		$conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test');
9
+		$conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test', 'test');
10 10
 		TActiveRecordManager::getInstance()->setDbConnection($conn);
11 11
 	}
12 12
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$this->assertNotNull($user1);
23 23
 
24 24
 		$user2 = UserRecord::finder()->findByPk('admin');
25
-		$this->assertFalse($user1===$user2);
25
+		$this->assertFalse($user1 === $user2);
26 26
 	}
27 27
 
28 28
 	function testFindByPk_returns_null()
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 		$this->assertTrue($user->delete());
54 54
 	}
55 55
 
56
-	function assertSameUser($user,$check)
56
+	function assertSameUser($user, $check)
57 57
 	{
58 58
 		$props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title',
59 59
 						'work_phone', 'work_fax', 'active', 'department_id', 'salutation',
60 60
 						'hint_question', 'hint_answer');
61
-		foreach($props as $prop)
62
-			$this->assertEqual($user->$prop,$check->$prop);
61
+		foreach ($props as $prop)
62
+			$this->assertEqual($user->$prop, $check->$prop);
63 63
 	}
64 64
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@
 block discarded – undo
58 58
 		$props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title',
59 59
 						'work_phone', 'work_fax', 'active', 'department_id', 'salutation',
60 60
 						'hint_question', 'hint_answer');
61
-		foreach($props as $prop)
62
-			$this->assertEqual($user->$prop,$check->$prop);
61
+		foreach($props as $prop) {
62
+					$this->assertEqual($user->$prop,$check->$prop);
63
+		}
63 64
 	}
64 65
 }
Please login to merge, or discard this patch.