Completed
Branch scrutinizer (4d54e2)
by Fabio
15:49
created
framework/pradolite.php 1 patch
Braces   +430 added lines, -507 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@  discard block
 block discarded – undo
46 46
 		{
47 47
 			$am=self::$_application->getAssetManager();
48 48
 			$url=$am->publishFilePath(self::getPathOfNamespace('System.'.$logoName,'.gif'));
49
-		}
50
-		else
49
+		} else
51 50
 			$url='http://pradosoft.github.io/docs/'.$logoName.'.gif';
52 51
 		return '<a title="Powered by PRADO" href="https://github.com/pradosoft/prado" target="_blank"><img src="'.$url.'" style="border-width:0px;" alt="Powered by PRADO" /></a>';
53 52
 	}
@@ -71,8 +70,7 @@  discard block
 block discarded – undo
71 70
 		if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null)
72 71
 		{
73 72
 			$errorHandler->handleError(null,$exception);
74
-		}
75
-		else
73
+		} else
76 74
 		{
77 75
 			echo $exception;
78 76
 		}
@@ -120,14 +118,14 @@  discard block
 block discarded – undo
120 118
 				break;
121 119
 				default:
122 120
 					$s='$args[1]';
123
-					for($i=2;$i<$n;++$i)
124
-						$s.=",\$args[$i]";
121
+					for($i=2;$i<$n;++$i) {
122
+											$s.=",\$args[$i]";
123
+					}
125 124
 					eval("\$component=new $type($s);");
126 125
 					return $component;
127 126
 				break;
128 127
 			}
129
-		}
130
-		else
128
+		} else
131 129
 			return new $type;
132 130
 	}
133 131
 	public static function using($namespace,$checkClassExistence=true)
@@ -138,31 +136,27 @@  discard block
 block discarded – undo
138 136
 			try
139 137
 			{
140 138
 				include_once($namespace.self::CLASS_FILE_EXT);
141
-			}
142
-			catch(Exception $e)
139
+			} catch(Exception $e)
143 140
 			{
144 141
 				if($checkClassExistence && !class_exists($namespace,false))
145 142
 					throw new TInvalidOperationException('prado_component_unknown',$namespace,$e->getMessage());
146 143
 				else
147 144
 					throw $e;
148 145
 			}
149
-		}
150
-		else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
146
+		} else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
151 147
 		{
152 148
 			$className=substr($namespace,$pos+1);
153 149
 			if($className==='*')  			{
154 150
 				self::$_usings[$namespace]=$path;
155 151
 				set_include_path(get_include_path().PATH_SEPARATOR.$path);
156
-			}
157
-			else  			{
152
+			} else  			{
158 153
 				self::$_usings[$namespace]=$path;
159 154
 				if(!$checkClassExistence || !class_exists($className,false))
160 155
 				{
161 156
 					try
162 157
 					{
163 158
 						include_once($path);
164
-					}
165
-					catch(Exception $e)
159
+					} catch(Exception $e)
166 160
 					{
167 161
 						if($checkClassExistence && !class_exists($className,false))
168 162
 							throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage());
@@ -171,8 +165,7 @@  discard block
 block discarded – undo
171 165
 					}
172 166
 				}
173 167
 			}
174
-		}
175
-		else
168
+		} else
176 169
 			throw new TInvalidDataValueException('prado_using_invalid',$namespace);
177 170
 	}
178 171
 	public static function getPathOfNamespace($namespace, $ext='')
@@ -208,8 +201,7 @@  discard block
 block discarded – undo
208 201
 				self::$_aliases[$alias]=$rp;
209 202
 			else
210 203
 				throw new TInvalidDataValueException('prado_aliasname_invalid',$alias);
211
-		}
212
-		else
204
+		} else
213 205
 			throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path);
214 206
 	}
215 207
 	public static function fatalError($msg)
@@ -246,8 +238,7 @@  discard block
 block discarded – undo
246 238
 							echo "'". substr($str, 0, 70) . "...'";
247 239
 						else
248 240
 							echo "'" . $str . "'";
249
-					}
250
-					else if (is_int($item) || is_float($item))
241
+					} else if (is_int($item) || is_float($item))
251 242
 						echo $item;
252 243
 					else if (is_object($item))
253 244
 						echo get_class($item);
@@ -316,8 +307,7 @@  discard block
 block discarded – undo
316 307
 			if(isset($trace[0]['file']) && isset($trace[0]['line']))
317 308
 				$msg.=" (line {$trace[0]['line']}, {$trace[0]['file']})";
318 309
 			$level=TLogger::DEBUG;
319
-		}
320
-		else
310
+		} else
321 311
 			$level=TLogger::INFO;
322 312
 		self::log($msg,$level,$category,$ctl);
323 313
 	}
@@ -343,8 +333,9 @@  discard block
 block discarded – undo
343 333
 		Prado::using('System.I18N.Translation');
344 334
 		$app = Prado::getApplication()->getGlobalization(false);
345 335
 		$params = array();
346
-		foreach($parameters as $key => $value)
347
-			$params['{'.$key.'}'] = $value;
336
+		foreach($parameters as $key => $value) {
337
+					$params['{'.$key.'}'] = $value;
338
+		}
348 339
 				if($app===null || ($config = $app->getTranslationConfiguration())===null)
349 340
 			return strtr($text, $params);
350 341
 		if ($catalogue===null)
@@ -622,8 +613,7 @@  discard block
 block discarded – undo
622 613
 			echo "<body><h1>Recursive Error</h1>\n";
623 614
 			echo "<pre>".$exception->__toString()."</pre>\n";
624 615
 			echo "</body></html>";
625
-		}
626
-		else
616
+		} else
627 617
 		{
628 618
 			error_log("Error happened while processing an existing error:\n".$exception->__toString());
629 619
 			header('HTTP/1.0 500 Internal Error');
@@ -645,15 +635,13 @@  discard block
 block discarded – undo
645 635
 			if($fileName==='')
646 636
 				$fileName='---embedded template---';
647 637
 			$errorLine=$exception->getLineNumber();
648
-		}
649
-		else
638
+		} else
650 639
 		{
651 640
 			if(($trace=$this->getExactTrace($exception))!==null)
652 641
 			{
653 642
 				$fileName=$trace['file'];
654 643
 				$errorLine=$trace['line'];
655
-			}
656
-			else
644
+			} else
657 645
 			{
658 646
 				$fileName=$exception->getFile();
659 647
 				$errorLine=$exception->getLine();
@@ -712,8 +700,7 @@  discard block
 block discarded – undo
712 700
 				$result=$trace[0];
713 701
 			elseif(isset($trace[1]))
714 702
 				$result=$trace[1];
715
-		}
716
-		else if($exception instanceof TInvalidOperationException)
703
+		} else if($exception instanceof TInvalidOperationException)
717 704
 		{
718 705
 						if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null)
719 706
 				$result=$this->getPropertyAccessTrace($trace,'__set');
@@ -745,8 +732,7 @@  discard block
 block discarded – undo
745 732
 			{
746 733
 				$line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
747 734
 				$source.="<div class=\"error\">".$line."</div>";
748
-			}
749
-			else
735
+			} else
750 736
 				$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
751 737
 		}
752 738
 		return $source;
@@ -810,11 +796,9 @@  discard block
 block discarded – undo
810 796
 			{
811 797
 				array_splice($this->_d,$index,0,array($item));
812 798
 				$this->_c++;
813
-			}
814
-			else
799
+			} else
815 800
 				throw new TInvalidDataValueException('list_index_invalid',$index);
816
-		}
817
-		else
801
+		} else
818 802
 			throw new TInvalidOperationException('list_readonly',get_class($this));
819 803
 	}
820 804
 	public function remove($item)
@@ -825,11 +809,9 @@  discard block
 block discarded – undo
825 809
 			{
826 810
 				$this->removeAt($index);
827 811
 				return $index;
828
-			}
829
-			else
812
+			} else
830 813
 				throw new TInvalidDataValueException('list_item_inexistent');
831
-		}
832
-		else
814
+		} else
833 815
 			throw new TInvalidOperationException('list_readonly',get_class($this));
834 816
 	}
835 817
 	public function removeAt($index)
@@ -847,17 +829,16 @@  discard block
 block discarded – undo
847 829
 					array_splice($this->_d,$index,1);
848 830
 					return $item;
849 831
 				}
850
-			}
851
-			else
832
+			} else
852 833
 				throw new TInvalidDataValueException('list_index_invalid',$index);
853
-		}
854
-		else
834
+		} else
855 835
 			throw new TInvalidOperationException('list_readonly',get_class($this));
856 836
 	}
857 837
 	public function clear()
858 838
 	{
859
-		for($i=$this->_c-1;$i>=0;--$i)
860
-			$this->removeAt($i);
839
+		for($i=$this->_c-1;$i>=0;--$i) {
840
+					$this->removeAt($i);
841
+		}
861 842
 	}
862 843
 	public function contains($item)
863 844
 	{
@@ -878,8 +859,7 @@  discard block
 block discarded – undo
878 859
 				throw new TInvalidDataValueException('list_item_inexistent');
879 860
 			$this->insertAt($index, $item);
880 861
 			return $index;
881
-		}
882
-		else
862
+		} else
883 863
 			throw new TInvalidOperationException('list_readonly',get_class($this));
884 864
 	}
885 865
 	public function insertAfter($baseitem, $item)
@@ -890,8 +870,7 @@  discard block
 block discarded – undo
890 870
 				throw new TInvalidDataValueException('list_item_inexistent');
891 871
 			$this->insertAt($index + 1, $item);
892 872
 			return $index + 1;
893
-		}
894
-		else
873
+		} else
895 874
 			throw new TInvalidOperationException('list_readonly',get_class($this));
896 875
 	}
897 876
 	public function toArray()
@@ -904,20 +883,20 @@  discard block
 block discarded – undo
904 883
 		{
905 884
 			if($this->_c>0)
906 885
 				$this->clear();
907
-			foreach($data as $item)
908
-				$this->add($item);
909
-		}
910
-		else if($data!==null)
886
+			foreach($data as $item) {
887
+							$this->add($item);
888
+			}
889
+		} else if($data!==null)
911 890
 			throw new TInvalidDataTypeException('list_data_not_iterable');
912 891
 	}
913 892
 	public function mergeWith($data)
914 893
 	{
915 894
 		if(is_array($data) || ($data instanceof Traversable))
916 895
 		{
917
-			foreach($data as $item)
918
-				$this->add($item);
919
-		}
920
-		else if($data!==null)
896
+			foreach($data as $item) {
897
+							$this->add($item);
898
+			}
899
+		} else if($data!==null)
921 900
 			throw new TInvalidDataTypeException('list_data_not_iterable');
922 901
 	}
923 902
 	public function offsetExists($offset)
@@ -1131,8 +1110,7 @@  discard block
 block discarded – undo
1131 1110
 			{
1132 1111
 				if(($this->_recursiveLevel<0 || $level<$this->_recursiveLevel) && $this->validateDirectory($path))
1133 1112
 					$timestamps=array_merge($this->generateTimestamps($path,$level+1));
1134
-			}
1135
-			else if($this->validateFile($path))
1113
+			} else if($this->validateFile($path))
1136 1114
 				$timestamps[$path]=filemtime($path);
1137 1115
 		}
1138 1116
 		closedir($dir);
@@ -1174,9 +1152,10 @@  discard block
 block discarded – undo
1174 1152
 	{
1175 1153
 		if($this->_dependencies!==null)
1176 1154
 		{
1177
-			foreach($this->_dependencies as $dependency)
1178
-				if($dependency->getHasChanged())
1155
+			foreach($this->_dependencies as $dependency) {
1156
+							if($dependency->getHasChanged())
1179 1157
 					return true;
1158
+			}
1180 1159
 		}
1181 1160
 		return false;
1182 1161
 	}
@@ -1286,8 +1265,9 @@  discard block
 block discarded – undo
1286 1265
 			return $this->_fd;
1287 1266
 		$this->sortPriorities();
1288 1267
 		$this->_fd=array();
1289
-		foreach($this->_d as $priority => $itemsatpriority)
1290
-			$this->_fd=array_merge($this->_fd,$itemsatpriority);
1268
+		foreach($this->_d as $priority => $itemsatpriority) {
1269
+					$this->_fd=array_merge($this->_fd,$itemsatpriority);
1270
+		}
1291 1271
 		return $this->_fd;
1292 1272
 	}
1293 1273
 	public function itemAt($index)
@@ -1339,9 +1319,10 @@  discard block
 block discarded – undo
1339 1319
 		if($preserveCache) {
1340 1320
 			$this->sortPriorities();
1341 1321
 			$cc=0;
1342
-			foreach($this->_d as $prioritykey=>$items)
1343
-				if($prioritykey>=$priority)
1322
+			foreach($this->_d as $prioritykey=>$items) {
1323
+							if($prioritykey>=$priority)
1344 1324
 					break;
1325
+			}
1345 1326
 				else
1346 1327
 					$cc+=count($items);
1347 1328
 			if($index===false&&isset($this->_d[$priority])) {
@@ -1393,8 +1374,7 @@  discard block
 block discarded – undo
1393 1374
 			}
1394 1375
 			$this->removeAtIndexInPriority($p[1],$p[0]);
1395 1376
 			return $p[2];
1396
-		}
1397
-		else
1377
+		} else
1398 1378
 			throw new TInvalidDataValueException('list_item_inexistent');
1399 1379
 	}
1400 1380
 	public function removeAt($index)
@@ -1428,8 +1408,9 @@  discard block
 block discarded – undo
1428 1408
 			throw new TInvalidOperationException('list_readonly',get_class($this));
1429 1409
 		$d=array_reverse($this->_d,true);
1430 1410
 		foreach($this->_d as $priority=>$items) {
1431
-			for($index=count($items)-1;$index>=0;$index--)
1432
-				$this->removeAtIndexInPriority($index,$priority);
1411
+			for($index=count($items)-1;$index>=0;$index--) {
1412
+							$this->removeAtIndexInPriority($index,$priority);
1413
+			}
1433 1414
 			unset($this->_d[$priority]);
1434 1415
 		}
1435 1416
 	}
@@ -1532,14 +1513,16 @@  discard block
 block discarded – undo
1532 1513
 				$this->clear();
1533 1514
 			foreach($data->getPriorities() as $priority)
1534 1515
 			{
1535
-				foreach($data->itemsAtPriority($priority) as $index=>$item)
1536
-					$this->insertAtIndexInPriority($item,$index,$priority);
1516
+				foreach($data->itemsAtPriority($priority) as $index=>$item) {
1517
+									$this->insertAtIndexInPriority($item,$index,$priority);
1518
+				}
1537 1519
 			}
1538 1520
 		} else if(is_array($data)||$data instanceof Traversable) {
1539 1521
 			if($this->getCount()>0)
1540 1522
 				$this->clear();
1541
-			foreach($data as $key=>$item)
1542
-				$this->add($item);
1523
+			foreach($data as $key=>$item) {
1524
+							$this->add($item);
1525
+			}
1543 1526
 		} else if($data!==null)
1544 1527
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1545 1528
 	}
@@ -1549,16 +1532,16 @@  discard block
 block discarded – undo
1549 1532
 		{
1550 1533
 			foreach($data->getPriorities() as $priority)
1551 1534
 			{
1552
-				foreach($data->itemsAtPriority($priority) as $index=>$item)
1553
-					$this->insertAtIndexInPriority($item,false,$priority);
1535
+				foreach($data->itemsAtPriority($priority) as $index=>$item) {
1536
+									$this->insertAtIndexInPriority($item,false,$priority);
1537
+				}
1554 1538
 			}
1555
-		}
1556
-		else if(is_array($data)||$data instanceof Traversable)
1539
+		} else if(is_array($data)||$data instanceof Traversable)
1557 1540
 		{
1558
-			foreach($data as $priority=>$item)
1559
-				$this->add($item);
1560
-		}
1561
-		else if($data!==null)
1541
+			foreach($data as $priority=>$item) {
1542
+							$this->add($item);
1543
+			}
1544
+		} else if($data!==null)
1562 1545
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1563 1546
 	}
1564 1547
 	public function offsetExists($offset)
@@ -1649,17 +1632,16 @@  discard block
 block discarded – undo
1649 1632
 				$value=$this->_d[$key];
1650 1633
 				unset($this->_d[$key]);
1651 1634
 				return $value;
1652
-			}
1653
-			else
1635
+			} else
1654 1636
 				return null;
1655
-		}
1656
-		else
1637
+		} else
1657 1638
 			throw new TInvalidOperationException('map_readonly',get_class($this));
1658 1639
 	}
1659 1640
 	public function clear()
1660 1641
 	{
1661
-		foreach(array_keys($this->_d) as $key)
1662
-			$this->remove($key);
1642
+		foreach(array_keys($this->_d) as $key) {
1643
+					$this->remove($key);
1644
+		}
1663 1645
 	}
1664 1646
 	public function contains($key)
1665 1647
 	{
@@ -1675,20 +1657,20 @@  discard block
 block discarded – undo
1675 1657
 		{
1676 1658
 			if($this->getCount()>0)
1677 1659
 				$this->clear();
1678
-			foreach($data as $key=>$value)
1679
-				$this->add($key,$value);
1680
-		}
1681
-		else if($data!==null)
1660
+			foreach($data as $key=>$value) {
1661
+							$this->add($key,$value);
1662
+			}
1663
+		} else if($data!==null)
1682 1664
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1683 1665
 	}
1684 1666
 	public function mergeWith($data)
1685 1667
 	{
1686 1668
 		if(is_array($data) || $data instanceof Traversable)
1687 1669
 		{
1688
-			foreach($data as $key=>$value)
1689
-				$this->add($key,$value);
1690
-		}
1691
-		else if($data!==null)
1670
+			foreach($data as $key=>$value) {
1671
+							$this->add($key,$value);
1672
+			}
1673
+		} else if($data!==null)
1692 1674
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1693 1675
 	}
1694 1676
 	public function offsetExists($offset)
@@ -1767,8 +1749,9 @@  discard block
 block discarded – undo
1767 1749
 			return $this->_fd;
1768 1750
 		$this->sortPriorities();
1769 1751
 		$this->_fd = array();
1770
-		foreach($this->_d as $priority => $itemsatpriority)
1771
-			$this->_fd = array_merge($this->_fd, $itemsatpriority);
1752
+		foreach($this->_d as $priority => $itemsatpriority) {
1753
+					$this->_fd = array_merge($this->_fd, $itemsatpriority);
1754
+		}
1772 1755
 		return $this->_fd;
1773 1756
 	}
1774 1757
 	public function count()
@@ -1831,17 +1814,19 @@  discard block
 block discarded – undo
1831 1814
 	public function priorityOf($item)
1832 1815
 	{
1833 1816
 		$this->sortPriorities();
1834
-		foreach($this->_d as $priority=>$items)
1835
-			if(($index=array_search($item,$items,true))!==false)
1817
+		foreach($this->_d as $priority=>$items) {
1818
+					if(($index=array_search($item,$items,true))!==false)
1836 1819
 				return $priority;
1820
+		}
1837 1821
 		return false;
1838 1822
 	}
1839 1823
 	public function priorityAt($key)
1840 1824
 	{
1841 1825
 		$this->sortPriorities();
1842
-		foreach($this->_d as $priority=>$items)
1843
-			if(array_key_exists($key,$items))
1826
+		foreach($this->_d as $priority=>$items) {
1827
+					if(array_key_exists($key,$items))
1844 1828
 				return $priority;
1829
+		}
1845 1830
 		return false;
1846 1831
 	}
1847 1832
 	public function add($key,$value,$priority=null)
@@ -1851,10 +1836,11 @@  discard block
 block discarded – undo
1851 1836
 		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1852 1837
 		if(!$this->_r)
1853 1838
 		{
1854
-			foreach($this->_d as $innerpriority=>$items)
1855
-				if(array_key_exists($key,$items))
1839
+			foreach($this->_d as $innerpriority=>$items) {
1840
+							if(array_key_exists($key,$items))
1856 1841
 				{
1857 1842
 					unset($this->_d[$innerpriority][$key]);
1843
+			}
1858 1844
 					$this->_c--;
1859 1845
 					if(count($this->_d[$innerpriority])===0)
1860 1846
 						unset($this->_d[$innerpriority]);
@@ -1862,13 +1848,11 @@  discard block
 block discarded – undo
1862 1848
 			if(!isset($this->_d[$priority])) {
1863 1849
 				$this->_d[$priority]=array($key=>$value);
1864 1850
 				$this->_o=false;
1865
-			}
1866
-			else
1851
+			} else
1867 1852
 				$this->_d[$priority][$key]=$value;
1868 1853
 			$this->_c++;
1869 1854
 			$this->_fd=null;
1870
-		}
1871
-		else
1855
+		} else
1872 1856
 			throw new TInvalidOperationException('map_readonly',get_class($this));
1873 1857
 		return $priority;
1874 1858
 	}
@@ -1881,10 +1865,11 @@  discard block
 block discarded – undo
1881 1865
 			if($priority===false)
1882 1866
 			{
1883 1867
 				$this->sortPriorities();
1884
-				foreach($this->_d as $priority=>$items)
1885
-					if(array_key_exists($key,$items))
1868
+				foreach($this->_d as $priority=>$items) {
1869
+									if(array_key_exists($key,$items))
1886 1870
 					{
1887 1871
 						$value=$this->_d[$priority][$key];
1872
+				}
1888 1873
 						unset($this->_d[$priority][$key]);
1889 1874
 						$this->_c--;
1890 1875
 						if(count($this->_d[$priority])===0)
@@ -1896,8 +1881,7 @@  discard block
 block discarded – undo
1896 1881
 						return $value;
1897 1882
 					}
1898 1883
 				return null;
1899
-			}
1900
-			else
1884
+			} else
1901 1885
 			{
1902 1886
 				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1903 1887
 				if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority])))
@@ -1911,19 +1895,18 @@  discard block
 block discarded – undo
1911 1895
 					}
1912 1896
 					$this->_fd=null;
1913 1897
 					return $value;
1914
-				}
1915
-				else
1898
+				} else
1916 1899
 					return null;
1917 1900
 			}
1918
-		}
1919
-		else
1901
+		} else
1920 1902
 			throw new TInvalidOperationException('map_readonly',get_class($this));
1921 1903
 	}
1922 1904
 	public function clear()
1923 1905
 	{
1924
-		foreach($this->_d as $priority=>$items)
1925
-			foreach(array_keys($items) as $key)
1906
+		foreach($this->_d as $priority=>$items) {
1907
+					foreach(array_keys($items) as $key)
1926 1908
 				$this->remove($key);
1909
+		}
1927 1910
 	}
1928 1911
 	public function contains($key)
1929 1912
 	{
@@ -1969,15 +1952,14 @@  discard block
 block discarded – undo
1969 1952
 					$this->add($key,$value,$priority);
1970 1953
 				}
1971 1954
 			}
1972
-		}
1973
-		else if(is_array($data)||$data instanceof Traversable)
1955
+		} else if(is_array($data)||$data instanceof Traversable)
1974 1956
 		{
1975 1957
 			if($this->getCount()>0)
1976 1958
 				$this->clear();
1977
-			foreach($data as $key=>$value)
1978
-				$this->add($key,$value);
1979
-		}
1980
-		else if($data!==null)
1959
+			foreach($data as $key=>$value) {
1960
+							$this->add($key,$value);
1961
+			}
1962
+		} else if($data!==null)
1981 1963
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1982 1964
 	}
1983 1965
 	public function mergeWith($data)
@@ -1986,16 +1968,16 @@  discard block
 block discarded – undo
1986 1968
 		{
1987 1969
 			foreach($data->getPriorities() as $priority)
1988 1970
 			{
1989
-				foreach($data->itemsAtPriority($priority) as $key => $value)
1990
-					$this->add($key,$value,$priority);
1971
+				foreach($data->itemsAtPriority($priority) as $key => $value) {
1972
+									$this->add($key,$value,$priority);
1973
+				}
1991 1974
 			}
1992
-		}
1993
-		else if(is_array($data)||$data instanceof Traversable)
1975
+		} else if(is_array($data)||$data instanceof Traversable)
1994 1976
 		{
1995
-			foreach($data as $key=>$value)
1996
-				$this->add($key,$value);
1997
-		}
1998
-		else if($data!==null)
1977
+			foreach($data as $key=>$value) {
1978
+							$this->add($key,$value);
1979
+			}
1980
+		} else if($data!==null)
1999 1981
 			throw new TInvalidDataTypeException('map_data_not_iterable');
2000 1982
 	}
2001 1983
 	public function offsetExists($offset)
@@ -2038,8 +2020,7 @@  discard block
 block discarded – undo
2038 2020
 				$this->_d[]=$item;
2039 2021
 				++$this->_c;
2040 2022
 			}
2041
-		}
2042
-		else if($data!==null)
2023
+		} else if($data!==null)
2043 2024
 			throw new TInvalidDataTypeException('stack_data_not_iterable');
2044 2025
 	}
2045 2026
 	public function clear()
@@ -2188,9 +2169,10 @@  discard block
 block discarded – undo
2188 2169
 	{
2189 2170
 		if($this->_elements)
2190 2171
 		{
2191
-			foreach($this->_elements as $element)
2192
-				if($element->_tagName===$tagName)
2172
+			foreach($this->_elements as $element) {
2173
+							if($element->_tagName===$tagName)
2193 2174
 					return $element;
2175
+			}
2194 2176
 		}
2195 2177
 		return null;
2196 2178
 	}
@@ -2199,9 +2181,10 @@  discard block
 block discarded – undo
2199 2181
 		$list=new TList;
2200 2182
 		if($this->_elements)
2201 2183
 		{
2202
-			foreach($this->_elements as $element)
2203
-				if($element->_tagName===$tagName)
2184
+			foreach($this->_elements as $element) {
2185
+							if($element->_tagName===$tagName)
2204 2186
 					$list->add($element);
2187
+			}
2205 2188
 		}
2206 2189
 		return $list;
2207 2190
 	}
@@ -2220,17 +2203,16 @@  discard block
 block discarded – undo
2220 2203
 		if($this->getHasElement())
2221 2204
 		{
2222 2205
 			$str=$prefix."<{$this->_tagName}$attr>\n";
2223
-			foreach($this->getElements() as $element)
2224
-				$str.=$element->toString($indent+1)."\n";
2206
+			foreach($this->getElements() as $element) {
2207
+							$str.=$element->toString($indent+1)."\n";
2208
+			}
2225 2209
 			$str.=$prefix."</{$this->_tagName}>";
2226 2210
 			return $str;
2227
-		}
2228
-		else if(($value=$this->getValue())!=='')
2211
+		} else if(($value=$this->getValue())!=='')
2229 2212
 		{
2230 2213
 			$value=$this->xmlEncode($value);
2231 2214
 			return $prefix."<{$this->_tagName}$attr>$value</{$this->_tagName}>";
2232
-		}
2233
-		else
2215
+		} else
2234 2216
 			return $prefix."<{$this->_tagName}$attr />";
2235 2217
 	}
2236 2218
 	public function __toString()
@@ -2312,8 +2294,9 @@  discard block
 block discarded – undo
2312 2294
    					$attributes->add('xmlns:'.$prefix, $uri);
2313 2295
 			}
2314 2296
 		}
2315
-		foreach($element->attributes as $name=>$attr)
2316
-			$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value);
2297
+		foreach($element->attributes as $name=>$attr) {
2298
+					$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value);
2299
+		}
2317 2300
 		foreach($element->childNodes as $child)
2318 2301
 		{
2319 2302
 			if($child instanceof DOMElement)
@@ -2327,8 +2310,7 @@  discard block
 block discarded – undo
2327 2310
 		{
2328 2311
 			fwrite($fw,$this->saveToString());
2329 2312
 			fclose($fw);
2330
-		}
2331
-		else
2313
+		} else
2332 2314
 			throw new TIOException('xmldocument_file_write_failed',$file);
2333 2315
 	}
2334 2316
 	public function saveToString()
@@ -2345,8 +2327,9 @@  discard block
 block discarded – undo
2345 2327
 	{
2346 2328
 		$element=new TXmlElement($node->tagName);
2347 2329
 		$element->setValue($node->nodeValue);
2348
-		foreach($node->attributes as $name=>$attr)
2349
-			$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value);
2330
+		foreach($node->attributes as $name=>$attr) {
2331
+					$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value);
2332
+		}
2350 2333
 		foreach($node->childNodes as $child)
2351 2334
 		{
2352 2335
 			if($child instanceof DOMElement)
@@ -2374,8 +2357,7 @@  discard block
 block discarded – undo
2374 2357
 			if($item->getParent()!==null)
2375 2358
 				$item->getParent()->getElements()->remove($item);
2376 2359
 			$item->setParent($this->_o);
2377
-		}
2378
-		else
2360
+		} else
2379 2361
 			throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required');
2380 2362
 	}
2381 2363
 	public function removeAt($index)
@@ -2419,8 +2401,7 @@  discard block
 block discarded – undo
2419 2401
 				{
2420 2402
 					$this->_everyone=true;
2421 2403
 					break;
2422
-				}
2423
-				else if($user==='?')
2404
+				} else if($user==='?')
2424 2405
 					$this->_guest=true;
2425 2406
 				else if($user==='@')
2426 2407
 					$this->_authenticated=true;
@@ -2530,8 +2511,7 @@  discard block
 block discarded – undo
2530 2511
 					return ($decision>0);
2531 2512
 			}
2532 2513
 			return true;
2533
-		}
2534
-		else
2514
+		} else
2535 2515
 			return false;
2536 2516
 	}
2537 2517
 	public function insertAt($index,$item)
@@ -2661,8 +2641,7 @@  discard block
 block discarded – undo
2661 2641
 			if($module===false)
2662 2642
 				throw new TNotSupportedException('securitymanager_mcryptextension_initfailed');
2663 2643
 			return $module;
2664
-		}
2665
-		else
2644
+		} else
2666 2645
 			throw new TNotSupportedException('securitymanager_mcryptextension_required');
2667 2646
 	}
2668 2647
 	public function hashData($data)
@@ -2732,8 +2711,9 @@  discard block
 block discarded – undo
2732 2711
 	public static function renderScriptFiles($files)
2733 2712
 	{
2734 2713
 		$str='';
2735
-		foreach($files as $file)
2736
-			$str.= self::renderScriptFile($file);
2714
+		foreach($files as $file) {
2715
+					$str.= self::renderScriptFile($file);
2716
+		}
2737 2717
 		return $str;
2738 2718
 	}
2739 2719
 	public static function renderScriptFile($file)
@@ -2802,8 +2782,7 @@  discard block
 block discarded – undo
2802 2782
 					}
2803 2783
 				}
2804 2784
 				return '{'.$results.'}';
2805
-			}
2806
-			else
2785
+			} else
2807 2786
 			{
2808 2787
 				foreach($value as $v)
2809 2788
 				{
@@ -2816,8 +2795,7 @@  discard block
 block discarded – undo
2816 2795
 				}
2817 2796
 				return '['.$results.']';
2818 2797
 			}
2819
-		}
2820
-		else if(is_integer($value))
2798
+		} else if(is_integer($value))
2821 2799
 			return "$value";
2822 2800
 		else if(is_float($value))
2823 2801
 		{
@@ -2837,8 +2815,7 @@  discard block
 block discarded – undo
2837 2815
 						return str_replace($locale['decimal_point'], '.', "$value");
2838 2816
 					break;
2839 2817
 			}
2840
-		}
2841
-		else if(is_object($value))
2818
+		} else if(is_object($value))
2842 2819
 			if ($value instanceof TJavaScriptLiteral)
2843 2820
 				return $value->toJavaScriptLiteral();
2844 2821
 			else
@@ -2863,8 +2840,9 @@  discard block
 block discarded – undo
2863 2840
 			$value=iconv($sourceEncoding, 'UTF-8', $value);
2864 2841
 		else if (is_array($value))
2865 2842
 		{
2866
-			foreach($value as &$element)
2867
-				self::convertToUtf8($element, $sourceEncoding);
2843
+			foreach($value as &$element) {
2844
+							self::convertToUtf8($element, $sourceEncoding);
2845
+			}
2868 2846
 		}
2869 2847
 	}
2870 2848
 	public static function jsonDecode($value, $assoc = false, $depth = 512)
@@ -2923,23 +2901,22 @@  discard block
 block discarded – undo
2923 2901
 					if(is_array($value))
2924 2902
 					{
2925 2903
 						$name=urlencode($name.'[]');
2926
-						foreach($value as $v)
2927
-							$url.=$amp.$name.'='.urlencode($v);
2928
-					}
2929
-					else
2904
+						foreach($value as $v) {
2905
+													$url.=$amp.$name.'='.urlencode($v);
2906
+						}
2907
+					} else
2930 2908
 						$url.=$amp.urlencode($name).'='.urlencode($value);
2931 2909
 				}
2932
-			}
2933
-			else
2910
+			} else
2934 2911
 			{
2935 2912
 				foreach($getItems as $name=>$value)
2936 2913
 				{
2937 2914
 					if(is_array($value))
2938 2915
 					{
2939
-						foreach($value as $v)
2940
-							$url.=$amp.$name.'[]='.$v;
2941
-					}
2942
-					else
2916
+						foreach($value as $v) {
2917
+													$url.=$amp.$name.'[]='.$v;
2918
+						}
2919
+					} else
2943 2920
 						$url.=$amp.$name.'='.$value;
2944 2921
 				}
2945 2922
 			}
@@ -2977,14 +2954,12 @@  discard block
 block discarded – undo
2977 2954
 							$getVariables[substr($name,0,$pos)][]=$value;
2978 2955
 						else
2979 2956
 							$getVariables[$name]=$value;
2980
-					}
2981
-					else
2957
+					} else
2982 2958
 						$getVariables[$path]='';
2983 2959
 				}
2984 2960
 			}
2985 2961
 			return $getVariables;
2986
-		}
2987
-		else
2962
+		} else
2988 2963
 			return array();
2989 2964
 	}
2990 2965
 }
@@ -3068,8 +3043,7 @@  discard block
 block discarded – undo
3068 3043
 				$port=$_SERVER['SERVER_PORT'];
3069 3044
 				if(($port!=80 && !$secure) || ($port!=443 && $secure))
3070 3045
 					$url.=':'.$port;
3071
-			}
3072
-			else
3046
+			} else
3073 3047
 				$url.=$_SERVER['HTTP_HOST'];
3074 3048
 			$url.=$this->getRequestUri();
3075 3049
 			$this->_url=new TUri($url);
@@ -3139,8 +3113,7 @@  discard block
 block discarded – undo
3139 3113
 				{
3140 3114
 					$this->_urlManager=new TUrlManager;
3141 3115
 					$this->_urlManager->init(null);
3142
-				}
3143
-				else
3116
+				} else
3144 3117
 				{
3145 3118
 					$this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID);
3146 3119
 					if($this->_urlManager===null)
@@ -3205,8 +3178,7 @@  discard block
 block discarded – undo
3205 3178
 		static $result;
3206 3179
 		if($result === null && function_exists('apache_request_headers')) {
3207 3180
 			$result = apache_request_headers();
3208
-		}
3209
-		elseif($result === null) {
3181
+		} elseif($result === null) {
3210 3182
 			$result = array();
3211 3183
 			foreach($_SERVER as $key=>$value) {
3212 3184
 				if(strncasecmp($key, 'HTTP_', 5) !== 0) continue;
@@ -3261,8 +3233,7 @@  discard block
 block discarded – undo
3261 3233
 		try
3262 3234
 		{
3263 3235
 			return get_browser();
3264
-		}
3265
-		catch(TPhpErrorException $e)
3236
+		} catch(TPhpErrorException $e)
3266 3237
 		{
3267 3238
 			throw new TConfigurationException('httprequest_browscap_required');
3268 3239
 		}
@@ -3316,11 +3287,11 @@  discard block
 block discarded – undo
3316 3287
 					if(($value=$sm->validateData($value))!==false)
3317 3288
 						$this->_cookies->add(new THttpCookie($key,$value));
3318 3289
 				}
3319
-			}
3320
-			else
3290
+			} else
3321 3291
 			{
3322
-				foreach($_COOKIE as $key=>$value)
3323
-					$this->_cookies->add(new THttpCookie($key,$value));
3292
+				foreach($_COOKIE as $key=>$value) {
3293
+									$this->_cookies->add(new THttpCookie($key,$value));
3294
+				}
3324 3295
 			}
3325 3296
 		}
3326 3297
 		return $this->_cookies;
@@ -3354,8 +3325,9 @@  discard block
 block discarded – undo
3354 3325
 	public function resolveRequest($serviceIDs)
3355 3326
 	{
3356 3327
 		$getParams=$this->parseUrl();
3357
-		foreach($getParams as $name=>$value)
3358
-			$_GET[$name]=$value;
3328
+		foreach($getParams as $name=>$value) {
3329
+					$_GET[$name]=$value;
3330
+		}
3359 3331
 		$this->_items=array_merge($_GET,$_POST);
3360 3332
 		$this->_requestResolved=true;
3361 3333
 		foreach($serviceIDs as $serviceID)
@@ -3420,14 +3392,14 @@  discard block
 block discarded – undo
3420 3392
 			$value=$this->_items[$key];
3421 3393
 			unset($this->_items[$key]);
3422 3394
 			return $value;
3423
-		}
3424
-		else
3395
+		} else
3425 3396
 			return null;
3426 3397
 	}
3427 3398
 	public function clear()
3428 3399
 	{
3429
-		foreach(array_keys($this->_items) as $key)
3430
-			$this->remove($key);
3400
+		foreach(array_keys($this->_items) as $key) {
3401
+					$this->remove($key);
3402
+		}
3431 3403
 	}
3432 3404
 	public function contains($key)
3433 3405
 	{
@@ -3468,8 +3440,7 @@  discard block
 block discarded – undo
3468 3440
 			parent::insertAt($index,$item);
3469 3441
 			if($this->_o instanceof THttpResponse)
3470 3442
 				$this->_o->addCookie($item);
3471
-		}
3472
-		else
3443
+		} else
3473 3444
 			throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
3474 3445
 	}
3475 3446
 	public function removeAt($index)
@@ -3488,9 +3459,10 @@  discard block
 block discarded – undo
3488 3459
 	}
3489 3460
 	public function findCookieByName($name)
3490 3461
 	{
3491
-		foreach($this as $cookie)
3492
-			if($cookie->getName()===$name)
3462
+		foreach($this as $cookie) {
3463
+					if($cookie->getName()===$name)
3493 3464
 				return $cookie;
3465
+		}
3494 3466
 		return null;
3495 3467
 	}
3496 3468
 }
@@ -3599,8 +3571,7 @@  discard block
 block discarded – undo
3599 3571
 			$this->_query=isset($ret['query'])?$ret['query']:'';
3600 3572
 			$this->_fragment=isset($ret['fragment'])?$ret['fragment']:'';
3601 3573
 			$this->_uri=$uri;
3602
-		}
3603
-		else
3574
+		} else
3604 3575
 		{
3605 3576
 			throw new TInvalidDataValueException('uri_format_invalid',$uri);
3606 3577
 		}
@@ -3772,7 +3743,7 @@  discard block
 block discarded – undo
3772 3743
 		$status=TPropertyValue::ensureInteger($status);
3773 3744
 		if(isset(self::$HTTP_STATUS_CODES[$status])) {
3774 3745
 			$this->_reason=self::$HTTP_STATUS_CODES[$status];
3775
-		}else{
3746
+		} else{
3776 3747
 			if($reason===null || $reason==='') {
3777 3748
 				throw new TInvalidDataValueException("response_status_reason_missing");
3778 3749
 			}
@@ -3834,10 +3805,10 @@  discard block
 block discarded – undo
3834 3805
 		$this->sendHttpHeader();
3835 3806
 		if(is_array($headers))
3836 3807
 		{
3837
-			foreach($headers as $h)
3838
-				header($h);
3839
-		}
3840
-		else
3808
+			foreach($headers as $h) {
3809
+							header($h);
3810
+			}
3811
+		} else
3841 3812
 		{
3842 3813
 			header('Pragma: public');
3843 3814
 			header('Expires: 0');
@@ -3900,13 +3871,11 @@  discard block
 block discarded – undo
3900 3871
 				{
3901 3872
 					$this->_bufferOutput = false;
3902 3873
 					ob_end_flush();
3903
-				}
3904
-				else
3874
+				} else
3905 3875
 					ob_flush();
3906 3876
 				flush();
3907 3877
 			}
3908
-		}
3909
-		else
3878
+		} else
3910 3879
 			flush();
3911 3880
 	}
3912 3881
 	protected function ensureHttpHeaderSent()
@@ -3992,8 +3961,7 @@  discard block
 block discarded – undo
3992 3961
 				$cookie->getSecure(),
3993 3962
 				$cookie->getHttpOnly()
3994 3963
 			);
3995
-		}
3996
-		else {
3964
+		} else {
3997 3965
 			setcookie(
3998 3966
 				$cookie->getName(),
3999 3967
 				$cookie->getValue(),
@@ -4173,13 +4141,11 @@  discard block
 block discarded – undo
4173 4141
       {
4174 4142
 				ini_set('session.use_cookies','0');
4175 4143
 			  ini_set('session.use_only_cookies','0');
4176
-      }
4177
-			else if($value===THttpSessionCookieMode::Allow)
4144
+      } else if($value===THttpSessionCookieMode::Allow)
4178 4145
 			{
4179 4146
 				ini_set('session.use_cookies','1');
4180 4147
 				ini_set('session.use_only_cookies','0');
4181
-			}
4182
-			else
4148
+			} else
4183 4149
 			{
4184 4150
 				ini_set('session.use_cookies','1');
4185 4151
 				ini_set('session.use_only_cookies','1');
@@ -4213,8 +4179,7 @@  discard block
 block discarded – undo
4213 4179
 			{
4214 4180
 				ini_set('session.gc_probability',$value);
4215 4181
 				ini_set('session.gc_divisor','100');
4216
-			}
4217
-			else
4182
+			} else
4218 4183
 				throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value);
4219 4184
 		}
4220 4185
 	}
@@ -4300,14 +4265,14 @@  discard block
 block discarded – undo
4300 4265
 			$value=$_SESSION[$key];
4301 4266
 			unset($_SESSION[$key]);
4302 4267
 			return $value;
4303
-		}
4304
-		else
4268
+		} else
4305 4269
 			return null;
4306 4270
 	}
4307 4271
 	public function clear()
4308 4272
 	{
4309
-		foreach(array_keys($_SESSION) as $key)
4310
-			unset($_SESSION[$key]);
4273
+		foreach(array_keys($_SESSION) as $key) {
4274
+					unset($_SESSION[$key]);
4275
+		}
4311 4276
 	}
4312 4277
 	public function contains($key)
4313 4278
 	{
@@ -4617,10 +4582,8 @@  discard block
 block discarded – undo
4617 4582
 					return $this->_id;
4618 4583
 				else
4619 4584
 					return ($this->_uid=$prefix.self::ID_SEPARATOR.$this->_id);
4620
-			}
4621
-			else					return $this->_id;
4622
-		}
4623
-		else
4585
+			} else					return $this->_id;
4586
+		} else
4624 4587
 			return $this->_uid;
4625 4588
 	}
4626 4589
 	public function focus()
@@ -4692,12 +4655,12 @@  discard block
 block discarded – undo
4692 4655
 	{
4693 4656
 		if($checkParents)
4694 4657
 		{
4695
-			for($control=$this;$control;$control=$control->_parent)
4696
-				if(!$control->getVisible(false))
4658
+			for($control=$this;$control;$control=$control->_parent) {
4659
+							if(!$control->getVisible(false))
4697 4660
 					return false;
4661
+			}
4698 4662
 			return true;
4699
-		}
4700
-		else
4663
+		} else
4701 4664
 			return $this->getViewState('Visible',true);
4702 4665
 	}
4703 4666
 	public function setVisible($value)
@@ -4708,12 +4671,12 @@  discard block
 block discarded – undo
4708 4671
 	{
4709 4672
 		if($checkParents)
4710 4673
 		{
4711
-			for($control=$this;$control;$control=$control->_parent)
4712
-				if(!$control->getViewState('Enabled',true))
4674
+			for($control=$this;$control;$control=$control->_parent) {
4675
+							if(!$control->getViewState('Enabled',true))
4713 4676
 					return false;
4677
+			}
4714 4678
 			return true;
4715
-		}
4716
-		else
4679
+		} else
4717 4680
 			return $this->getViewState('Enabled',true);
4718 4681
 	}
4719 4682
 	public function setEnabled($value)
@@ -4767,12 +4730,12 @@  discard block
 block discarded – undo
4767 4730
 	{
4768 4731
 		if($checkParents)
4769 4732
 		{
4770
-			for($control=$this;$control!==null;$control=$control->getParent())
4771
-				if($control->_flags & self::IS_DISABLE_VIEWSTATE)
4733
+			for($control=$this;$control!==null;$control=$control->getParent()) {
4734
+							if($control->_flags & self::IS_DISABLE_VIEWSTATE)
4772 4735
 					return false;
4736
+			}
4773 4737
 			return true;
4774
-		}
4775
-		else
4738
+		} else
4776 4739
 			return !($this->_flags & self::IS_DISABLE_VIEWSTATE);
4777 4740
 	}
4778 4741
 	public function setEnableViewState($value)
@@ -4810,8 +4773,7 @@  discard block
 block discarded – undo
4810 4773
 			if(is_object($this->_tempState[$key]) && $this->_trackViewState)
4811 4774
 				$this->_viewState[$key]=$this->_tempState[$key];
4812 4775
 			return $this->_tempState[$key];
4813
-		}
4814
-		else
4776
+		} else
4815 4777
 			return $defaultValue;
4816 4778
 	}
4817 4779
 	public function setViewState($key,$value,$defaultValue=null)
@@ -4823,8 +4785,7 @@  discard block
 block discarded – undo
4823 4785
 				unset($this->_viewState[$key]);
4824 4786
 			else
4825 4787
 				$this->_viewState[$key]=$value;
4826
-		}
4827
-		else
4788
+		} else
4828 4789
 		{
4829 4790
 			unset($this->_viewState[$key]);
4830 4791
 			if($value===$defaultValue)
@@ -4862,8 +4823,9 @@  discard block
 block discarded – undo
4862 4823
 		{
4863 4824
 			if(($context=$this->getTemplateControl())===null)
4864 4825
 				$context=$this;
4865
-			foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression)
4866
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
4826
+			foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression) {
4827
+							$this->setSubProperty($property,$context->evaluateExpression($expression));
4828
+			}
4867 4829
 		}
4868 4830
 	}
4869 4831
 	protected function autoDataBindProperties()
@@ -4872,17 +4834,19 @@  discard block
 block discarded – undo
4872 4834
 		{
4873 4835
 			if(($context=$this->getTemplateControl())===null)
4874 4836
 				$context=$this;
4875
-			foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression)
4876
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
4837
+			foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression) {
4838
+							$this->setSubProperty($property,$context->evaluateExpression($expression));
4839
+			}
4877 4840
 		}
4878 4841
 	}
4879 4842
 	protected function dataBindChildren()
4880 4843
 	{
4881 4844
 		if(isset($this->_rf[self::RF_CONTROLS]))
4882 4845
 		{
4883
-			foreach($this->_rf[self::RF_CONTROLS] as $control)
4884
-				if($control instanceof IBindable)
4846
+			foreach($this->_rf[self::RF_CONTROLS] as $control) {
4847
+							if($control instanceof IBindable)
4885 4848
 					$control->dataBind();
4849
+			}
4886 4850
 		}
4887 4851
 	}
4888 4852
 	final protected function getChildControlsCreated()
@@ -4913,8 +4877,7 @@  discard block
 block discarded – undo
4913 4877
 					$this->createChildControls();
4914 4878
 				$this->_flags &= ~self::IS_CREATING_CHILD;
4915 4879
 				$this->_flags |= self::IS_CHILD_CREATED;
4916
-			}
4917
-			catch(Exception $e)
4880
+			} catch(Exception $e)
4918 4881
 			{
4919 4882
 				$this->_flags &= ~self::IS_CREATING_CHILD;
4920 4883
 				$this->_flags |= self::IS_CHILD_CREATED;
@@ -5038,8 +5001,9 @@  discard block
 block discarded – undo
5038 5001
 	final protected function isDescendentOf($ancestor)
5039 5002
 	{
5040 5003
 		$control=$this;
5041
-		while($control!==$ancestor && $control->_parent)
5042
-			$control=$control->_parent;
5004
+		while($control!==$ancestor && $control->_parent) {
5005
+					$control=$control->_parent;
5006
+		}
5043 5007
 		return $control===$ancestor;
5044 5008
 	}
5045 5009
 	public function addedControl($control)
@@ -5067,8 +5031,7 @@  discard block
 block discarded – undo
5067 5031
 				{
5068 5032
 					$state=$this->_rf[self::RF_CHILD_STATE][$control->_id];
5069 5033
 					unset($this->_rf[self::RF_CHILD_STATE][$control->_id]);
5070
-				}
5071
-				else
5034
+				} else
5072 5035
 					$state=null;
5073 5036
 				$control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE));
5074 5037
 				if($this->_stage>=self::CS_LOADED)
@@ -5178,9 +5141,10 @@  discard block
 block discarded – undo
5178 5141
 			$this->_id='';
5179 5142
 		if($this->getHasControls())
5180 5143
 		{
5181
-			foreach($this->_rf[self::RF_CONTROLS] as $control)
5182
-				if($control instanceof TControl)
5144
+			foreach($this->_rf[self::RF_CONTROLS] as $control) {
5145
+							if($control instanceof TControl)
5183 5146
 					$control->unloadRecursive();
5147
+			}
5184 5148
 		}
5185 5149
 		if(isset($this->_rf[self::RF_ADAPTER]))
5186 5150
 			$this->_rf[self::RF_ADAPTER]->onUnload(null);
@@ -5301,8 +5265,7 @@  discard block
 block discarded – undo
5301 5265
 			{
5302 5266
 				$this->_rf[self::RF_CONTROLSTATE]=&$state[1];
5303 5267
 				unset($state[1]);
5304
-			}
5305
-			else
5268
+			} else
5306 5269
 				unset($this->_rf[self::RF_CONTROLSTATE]);
5307 5270
 			if($needViewState)
5308 5271
 			{
@@ -5366,17 +5329,17 @@  discard block
 block discarded – undo
5366 5329
 		{
5367 5330
 			$page->applyControlStyleSheet($this);
5368 5331
 			$this->_flags |= self::IS_STYLESHEET_APPLIED;
5369
-		}
5370
-		else if($this->_flags & self::IS_STYLESHEET_APPLIED)
5332
+		} else if($this->_flags & self::IS_STYLESHEET_APPLIED)
5371 5333
 			throw new TInvalidOperationException('control_stylesheet_applied',get_class($this));
5372 5334
 	}
5373 5335
 	private function clearCachedUniqueID($recursive)
5374 5336
 	{
5375 5337
 		if($recursive && $this->_uid!==null && isset($this->_rf[self::RF_CONTROLS]))
5376 5338
 		{
5377
-			foreach($this->_rf[self::RF_CONTROLS] as $control)
5378
-				if($control instanceof TControl)
5339
+			foreach($this->_rf[self::RF_CONTROLS] as $control) {
5340
+							if($control instanceof TControl)
5379 5341
 					$control->clearCachedUniqueID($recursive);
5342
+			}
5380 5343
 		}
5381 5344
 		$this->_uid=null;
5382 5345
 	}
@@ -5430,8 +5393,7 @@  discard block
 block discarded – undo
5430 5393
 		{
5431 5394
 			parent::insertAt($index,$item);
5432 5395
 			$this->_o->addedControl($item);
5433
-		}
5434
-		else if(is_string($item) || ($item instanceof IRenderable))
5396
+		} else if(is_string($item) || ($item instanceof IRenderable))
5435 5397
 			parent::insertAt($index,$item);
5436 5398
 		else
5437 5399
 			throw new TInvalidDataTypeException('controlcollection_control_required');
@@ -5591,8 +5553,7 @@  discard block
 block discarded – undo
5591 5553
 				else if($item[0]===self::TYPE_DATABINDING)
5592 5554
 					$this->_bindings[$id]=$item[1];
5593 5555
 				$this->_items[$id]='';
5594
-			}
5595
-			else
5556
+			} else
5596 5557
 				$this->_items[$id]=$item;
5597 5558
 		}
5598 5559
 	}
@@ -5607,16 +5568,19 @@  discard block
 block discarded – undo
5607 5568
 	public function evaluateDynamicContent()
5608 5569
 	{
5609 5570
 		$context=$this->_container===null?$this:$this->_container;
5610
-		foreach($this->_expressions as $id=>$expression)
5611
-			$this->_items[$id]=$context->evaluateExpression($expression);
5612
-		foreach($this->_statements as $id=>$statement)
5613
-			$this->_items[$id]=$context->evaluateStatements($statement);
5571
+		foreach($this->_expressions as $id=>$expression) {
5572
+					$this->_items[$id]=$context->evaluateExpression($expression);
5573
+		}
5574
+		foreach($this->_statements as $id=>$statement) {
5575
+					$this->_items[$id]=$context->evaluateStatements($statement);
5576
+		}
5614 5577
 	}
5615 5578
 	public function dataBind()
5616 5579
 	{
5617 5580
 		$context=$this->_container===null?$this:$this->_container;
5618
-		foreach($this->_bindings as $id=>$binding)
5619
-			$this->_items[$id]=$context->evaluateExpression($binding);
5581
+		foreach($this->_bindings as $id=>$binding) {
5582
+					$this->_items[$id]=$context->evaluateExpression($binding);
5583
+		}
5620 5584
 	}
5621 5585
 	public function render($writer)
5622 5586
 	{
@@ -6678,8 +6642,9 @@  discard block
 block discarded – undo
6678 6642
 			$style->addAttributesToRender($writer);
6679 6643
 		if($this->getHasAttributes())
6680 6644
 		{
6681
-			foreach($this->getAttributes() as $name=>$value)
6682
-				$writer->addAttribute($name,$value);
6645
+			foreach($this->getAttributes() as $name=>$value) {
6646
+							$writer->addAttribute($name,$value);
6647
+			}
6683 6648
 		}
6684 6649
 	}
6685 6650
 	public function render($writer)
@@ -6739,8 +6704,7 @@  discard block
 block discarded – undo
6739 6704
 			if(!isset(self::$_template[$class]))
6740 6705
 				self::$_template[$class]=$this->loadTemplate();
6741 6706
 			return self::$_template[$class];
6742
-		}
6743
-		else
6707
+		} else
6744 6708
 			return $this->_localTemplate;
6745 6709
 	}
6746 6710
 	public function setTemplate($value)
@@ -6814,8 +6778,7 @@  discard block
 block discarded – undo
6814 6778
 			$controls=$placeholder->getParent()->getControls();
6815 6779
 			$loc=$controls->remove($placeholder);
6816 6780
 			$controls->insertAt($loc,$content);
6817
-		}
6818
-		else
6781
+		} else
6819 6782
 			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
6820 6783
 	}
6821 6784
 	protected function initRecursive($namingContainer=null)
@@ -6830,10 +6793,10 @@  discard block
 block discarded – undo
6830 6793
 			$this->getControls()->clear();
6831 6794
 			$this->getControls()->add($master);
6832 6795
 			$master->ensureChildControls();
6833
-			foreach($this->_contents as $id=>$content)
6834
-				$master->injectContent($id,$content);
6835
-		}
6836
-		else if(!empty($this->_contents))
6796
+			foreach($this->_contents as $id=>$content) {
6797
+							$master->injectContent($id,$content);
6798
+			}
6799
+		} else if(!empty($this->_contents))
6837 6800
 			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
6838 6801
 		parent::initRecursive($namingContainer);
6839 6802
 	}
@@ -6853,8 +6816,7 @@  discard block
 block discarded – undo
6853 6816
                                                 $control->Checked = (boolean) $arObj->{$key};
6854 6817
                                         elseif ($control instanceof TDatePicker)
6855 6818
                                                 $control->Date = $arObj->{$key};
6856
-                                }
6857
-                                else
6819
+                                } else
6858 6820
                                 {
6859 6821
                                         foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
6860 6822
                                         {
@@ -6876,8 +6838,7 @@  discard block
 block discarded – undo
6876 6838
                                         }
6877 6839
                                         break;
6878 6840
                                 }
6879
-                        } 
6880
-                        catch (Exception $ex)
6841
+                        } catch (Exception $ex)
6881 6842
                         {
6882 6843
                                 if ($throwExceptions)
6883 6844
                                         throw $ex;
@@ -6900,8 +6861,7 @@  discard block
 block discarded – undo
6900 6861
                                         $arObj->{$key} = $control->Checked;
6901 6862
                                 elseif ($control instanceof TDatePicker)
6902 6863
                                         $arObj->{$key} = $control->Date;
6903
-                        } 
6904
-                        catch (Exception $ex)
6864
+                        } catch (Exception $ex)
6905 6865
                         {
6906 6866
                                 if ($throwExceptions)
6907 6867
                                         throw $ex;
@@ -6952,8 +6912,7 @@  discard block
 block discarded – undo
6952 6912
  			$page->endFormRender($writer);
6953 6913
 			$cs->renderScriptFilesEnd($writer);
6954 6914
 			$cs->renderEndScripts($writer);
6955
-		}
6956
-		else
6915
+		} else
6957 6916
 		{
6958 6917
 			$cs->renderHiddenFieldsBegin($writer);
6959 6918
 			$page->beginFormRender($writer);
@@ -7059,10 +7018,11 @@  discard block
 block discarded – undo
7059 7018
 				{
7060 7019
 					foreach (self::$_pradoScripts[$p] as $dep)
7061 7020
 					{
7062
-						foreach (self::$_pradoPackages[$dep] as $script)
7063
-						if (!isset($this->_expandedPradoScripts[$script]))
7021
+						foreach (self::$_pradoPackages[$dep] as $script) {
7022
+												if (!isset($this->_expandedPradoScripts[$script]))
7064 7023
 						{
7065 7024
 							$this->_expandedPradoScripts[$script] = true;
7025
+						}
7066 7026
 							if($isDebug)
7067 7027
 							{
7068 7028
 								if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl))
@@ -7084,8 +7044,9 @@  discard block
 block discarded – undo
7084 7044
 						}
7085 7045
 					}
7086 7046
 				}
7087
-				foreach($packagesUrl as $url)
7088
-					$this->registerScriptFile($url,$url);
7047
+				foreach($packagesUrl as $url) {
7048
+									$this->registerScriptFile($url,$url);
7049
+				}
7089 7050
 			}
7090 7051
 		}
7091 7052
 	}
@@ -7111,8 +7072,7 @@  discard block
 block discarded – undo
7111 7072
 				$base = $dir;
7112 7073
 			}
7113 7074
 			return array($assets->getPublishedPath($base), $assets->publishFilePath($base));
7114
-		}
7115
-		else
7075
+		} else
7116 7076
 		{
7117 7077
 			return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base);
7118 7078
 		}
@@ -7208,9 +7168,10 @@  discard block
 block discarded – undo
7208 7168
 				return is_array($e) ? $e[0] : $e;
7209 7169
 			}, $this->_styleSheetFiles)
7210 7170
 		);
7211
-		foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url)
7212
-			if (substr($url,strlen($url)-4)=='.css')
7171
+		foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) {
7172
+					if (substr($url,strlen($url)-4)=='.css')
7213 7173
 				$stylesheets[] = $url;
7174
+		}
7214 7175
 		$stylesheets = array_unique($stylesheets);
7215 7176
 		return $stylesheets;
7216 7177
 	}
@@ -7398,10 +7359,10 @@  discard block
 block discarded – undo
7398 7359
 			$id=strtr($name,':','_');
7399 7360
 			if(is_array($value))
7400 7361
 			{
7401
-				foreach($value as $v)
7402
-					$str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
7403
-			}
7404
-			else
7362
+				foreach($value as $v) {
7363
+									$str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
7364
+				}
7365
+			} else
7405 7366
 			{
7406 7367
 				$str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
7407 7368
 			}
@@ -7510,8 +7471,7 @@  discard block
 block discarded – undo
7510 7471
 				$this->processCallbackRequest($writer);
7511 7472
 			else
7512 7473
 				$this->processPostBackRequest($writer);
7513
-		}
7514
-		else
7474
+		} else
7515 7475
 			$this->processNormalRequest($writer);
7516 7476
 		$this->_writer = null;
7517 7477
 	}
@@ -7555,8 +7515,9 @@  discard block
 block discarded – undo
7555 7515
 	{
7556 7516
 		if(is_array($data))
7557 7517
 		{
7558
-			foreach($data as $k=>$v)
7559
-				$data[$k]=self::decodeUTF8($v, $enc);
7518
+			foreach($data as $k=>$v) {
7519
+							$data[$k]=self::decodeUTF8($v, $enc);
7520
+			}
7560 7521
 			return $data;
7561 7522
 		} elseif(is_string($data)) {
7562 7523
 			return iconv('UTF-8',$enc.'//IGNORE',$data);
@@ -7574,8 +7535,9 @@  discard block
 block discarded – undo
7574 7535
             $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter);
7575 7536
                 if (($g=$this->getApplication()->getGlobalization(false))!==null &&
7576 7537
             strtoupper($enc=$g->getCharset())!='UTF-8')
7577
-                foreach ($this->_postData as $k=>$v)
7578
-                	$this->_postData[$k]=self::decodeUTF8($v, $enc);
7538
+                foreach ($this->_postData as $k=>$v) {
7539
+                                	$this->_postData[$k]=self::decodeUTF8($v, $enc);
7540
+                }
7579 7541
 		$this->onPreInit(null);
7580 7542
 		$this->initRecursive();
7581 7543
 		$this->onInitComplete(null);
@@ -7642,9 +7604,10 @@  discard block
 block discarded – undo
7642 7604
 		else
7643 7605
 		{
7644 7606
 			$list=new TList;
7645
-			foreach($this->_validators as $validator)
7646
-				if($validator->getValidationGroup()===$validationGroup)
7607
+			foreach($this->_validators as $validator) {
7608
+							if($validator->getValidationGroup()===$validationGroup)
7647 7609
 					$list->add($validator);
7610
+			}
7648 7611
 			return $list;
7649 7612
 		}
7650 7613
 	}
@@ -7655,10 +7618,10 @@  discard block
 block discarded – undo
7655 7618
 		{
7656 7619
 			if($validationGroup===null)
7657 7620
 			{
7658
-				foreach($this->_validators as $validator)
7659
-					$validator->validate();
7660
-			}
7661
-			else
7621
+				foreach($this->_validators as $validator) {
7622
+									$validator->validate();
7623
+				}
7624
+			} else
7662 7625
 			{
7663 7626
 				foreach($this->_validators as $validator)
7664 7627
 				{
@@ -7674,13 +7637,13 @@  discard block
 block discarded – undo
7674 7637
 		{
7675 7638
 			if($this->_validators && $this->_validators->getCount())
7676 7639
 			{
7677
-				foreach($this->_validators as $validator)
7678
-					if(!$validator->getIsValid())
7640
+				foreach($this->_validators as $validator) {
7641
+									if(!$validator->getIsValid())
7679 7642
 						return false;
7643
+				}
7680 7644
 			}
7681 7645
 			return true;
7682
-		}
7683
-		else
7646
+		} else
7684 7647
 			throw new TInvalidOperationException('page_isvalid_unknown');
7685 7648
 	}
7686 7649
 	public function getTheme()
@@ -7749,18 +7712,22 @@  discard block
 block discarded – undo
7749 7712
 		$theme=$this->getTheme();
7750 7713
 		if($theme instanceof ITheme)
7751 7714
 		{
7752
-			foreach($theme->getStyleSheetFiles() as $url)
7753
-				$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7754
-			foreach($theme->getJavaScriptFiles() as $url)
7755
-				$cs->registerHeadScriptFile($url,$url);
7715
+			foreach($theme->getStyleSheetFiles() as $url) {
7716
+							$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7717
+			}
7718
+			foreach($theme->getJavaScriptFiles() as $url) {
7719
+							$cs->registerHeadScriptFile($url,$url);
7720
+			}
7756 7721
 		}
7757 7722
 		$styleSheet=$this->getStyleSheetTheme();
7758 7723
 		if($styleSheet instanceof ITheme)
7759 7724
 		{
7760
-			foreach($styleSheet->getStyleSheetFiles() as $url)
7761
-				$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7762
-			foreach($styleSheet->getJavaScriptFiles() as $url)
7763
-				$cs->registerHeadScriptFile($url,$url);
7725
+			foreach($styleSheet->getStyleSheetFiles() as $url) {
7726
+							$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7727
+			}
7728
+			foreach($styleSheet->getJavaScriptFiles() as $url) {
7729
+							$cs->registerHeadScriptFile($url,$url);
7730
+			}
7764 7731
 		}
7765 7732
 		if($cs->getRequiresHead() && $this->getHead()===null)
7766 7733
 			throw new TConfigurationException('page_head_required');
@@ -7820,8 +7787,9 @@  discard block
 block discarded – undo
7820 7787
 		$id=is_string($control)?$control:$control->getUniqueID();
7821 7788
 		$this->_controlsRegisteredForPostData[$id]=true;
7822 7789
 		$params=func_get_args();
7823
-		foreach($this->getCachingStack() as $item)
7824
-			$item->registerAction('Page','registerRequiresPostData',array($id));
7790
+		foreach($this->getCachingStack() as $item) {
7791
+					$item->registerAction('Page','registerRequiresPostData',array($id));
7792
+		}
7825 7793
 	}
7826 7794
 	public function getPostBackEventTarget()
7827 7795
 	{
@@ -7865,14 +7833,12 @@  discard block
 block discarded – undo
7865 7833
 				{
7866 7834
 					if($control->loadPostData($key,$postData))
7867 7835
 						$this->_controlsPostDataChanged[]=$control;
7868
-				}
7869
-				else if($control instanceof IPostBackEventHandler &&
7836
+				} else if($control instanceof IPostBackEventHandler &&
7870 7837
 					empty($this->_postData[self::FIELD_POSTBACK_TARGET]))
7871 7838
 				{
7872 7839
 					$this->_postData->add(self::FIELD_POSTBACK_TARGET,$key);  				}
7873 7840
 				unset($this->_controlsRequiringPostData[$key]);
7874
-			}
7875
-			else if($beforeLoad)
7841
+			} else if($beforeLoad)
7876 7842
 				$this->_restPostData->add($key,$value);
7877 7843
 		}
7878 7844
 		foreach($this->_controlsRequiringPostData as $key=>$value)
@@ -7883,8 +7849,7 @@  discard block
 block discarded – undo
7883 7849
 				{
7884 7850
 					if($control->loadPostData($key,$this->_postData))
7885 7851
 						$this->_controlsPostDataChanged[]=$control;
7886
-				}
7887
-				else
7852
+				} else
7888 7853
 					throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key);
7889 7854
 				unset($this->_controlsRequiringPostData[$key]);
7890 7855
 			}
@@ -7897,8 +7862,9 @@  discard block
 block discarded – undo
7897 7862
 	}
7898 7863
 	protected function raiseChangedEvents()
7899 7864
 	{
7900
-		foreach($this->_controlsPostDataChanged as $control)
7901
-			$control->raisePostDataChangedEvent();
7865
+		foreach($this->_controlsPostDataChanged as $control) {
7866
+					$control->raisePostDataChangedEvent();
7867
+		}
7902 7868
 	}
7903 7869
 	protected function raisePostBackEvent()
7904 7870
 	{
@@ -7933,8 +7899,7 @@  discard block
 block discarded – undo
7933 7899
 			else
7934 7900
 				$focus=$this->_focus;
7935 7901
 			$this->getClientScript()->registerFocusControl($focus);
7936
-		}
7937
-		else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null)
7902
+		} else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null)
7938 7903
 			$this->getClientScript()->registerFocusControl($lastFocus);
7939 7904
 		$this->_inFormRender=false;
7940 7905
 	}
@@ -8046,8 +8011,9 @@  discard block
 block discarded – undo
8046 8011
 	{
8047 8012
 		if($this->_cachingStack)
8048 8013
 		{
8049
-			foreach($this->_cachingStack as $cache)
8050
-				$cache->registerAction($context,$funcName,$funcParams);
8014
+			foreach($this->_cachingStack as $cache) {
8015
+							$cache->registerAction($context,$funcName,$funcParams);
8016
+			}
8051 8017
 		}
8052 8018
 	}
8053 8019
 	public function getCachingStack()
@@ -8100,8 +8066,7 @@  discard block
 block discarded – undo
8100 8066
 			{
8101 8067
 				if(($str=$sm->validateData($str))!==false)
8102 8068
 					return unserialize($str);
8103
-			}
8104
-			else
8069
+			} else
8105 8070
 				return unserialize($str);
8106 8071
 		}
8107 8072
 		return null;
@@ -8142,8 +8107,7 @@  discard block
 block discarded – undo
8142 8107
 					$this->_cache=$this->getApplication()->getModule($this->_cacheModuleID);
8143 8108
 					if(!($this->_cache instanceof ICache))
8144 8109
 						throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
8145
-				}
8146
-				else
8110
+				} else
8147 8111
 					$this->_cache=$this->getApplication()->getCache();
8148 8112
 				if($this->_cache!==null)
8149 8113
 				{
@@ -8155,8 +8119,7 @@  discard block
 block discarded – undo
8155 8119
 						$param->setCacheTime(isset($data[3])?$data[3]:0);
8156 8120
 						$this->onCheckDependency($param);
8157 8121
 						$this->_dataCached=$param->getIsValid();
8158
-					}
8159
-					else
8122
+					} else
8160 8123
 						$this->_dataCached=false;
8161 8124
 					if($this->_dataCached)
8162 8125
 						list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data;
@@ -8172,8 +8135,7 @@  discard block
 block discarded – undo
8172 8135
 			$stack->push($this);
8173 8136
 			parent::initRecursive($namingContainer);
8174 8137
 			$stack->pop();
8175
-		}
8176
-		else
8138
+		} else
8177 8139
 			parent::initRecursive($namingContainer);
8178 8140
 	}
8179 8141
 	protected function loadRecursive()
@@ -8184,8 +8146,7 @@  discard block
 block discarded – undo
8184 8146
 			$stack->push($this);
8185 8147
 			parent::loadRecursive();
8186 8148
 			$stack->pop();
8187
-		}
8188
-		else
8149
+		} else
8189 8150
 		{
8190 8151
 			if($this->_dataCached)
8191 8152
 				$this->performActions();
@@ -8214,8 +8175,7 @@  discard block
 block discarded – undo
8214 8175
 			$stack->push($this);
8215 8176
 			parent::preRenderRecursive();
8216 8177
 			$stack->pop();
8217
-		}
8218
-		else
8178
+		} else
8219 8179
 			parent::preRenderRecursive();
8220 8180
 	}
8221 8181
 	protected function loadStateRecursive(&$state,$needViewState=true)
@@ -8351,8 +8311,7 @@  discard block
 block discarded – undo
8351 8311
 			$content=$textwriter->flush();
8352 8312
 			$data=array($content,$this->_state,$this->_actions,time());
8353 8313
 			$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
8354
-		}
8355
-		else
8314
+		} else
8356 8315
 			parent::render($writer);
8357 8316
 	}
8358 8317
 }
@@ -8398,13 +8357,15 @@  discard block
 block discarded – undo
8398 8357
 	}
8399 8358
 	public function write($s)
8400 8359
 	{
8401
-		foreach($this->_writers as $writer)
8402
-			$writer->write($s);
8360
+		foreach($this->_writers as $writer) {
8361
+					$writer->write($s);
8362
+		}
8403 8363
 	}
8404 8364
 	public function flush()
8405 8365
 	{
8406
-		foreach($this->_writers as $writer)
8407
-			$s = $writer->flush();
8366
+		foreach($this->_writers as $writer) {
8367
+					$s = $writer->flush();
8368
+		}
8408 8369
 		return $s;
8409 8370
 	}
8410 8371
 }
@@ -8452,13 +8413,13 @@  discard block
 block discarded – undo
8452 8413
 				$includedFiles=$template->getIncludedFiles();
8453 8414
 				$timestamps=array();
8454 8415
 				$timestamps[$fileName]=filemtime($fileName);
8455
-				foreach($includedFiles as $includedFile)
8456
-					$timestamps[$includedFile]=filemtime($includedFile);
8416
+				foreach($includedFiles as $includedFile) {
8417
+									$timestamps[$includedFile]=filemtime($includedFile);
8418
+				}
8457 8419
 				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps));
8458 8420
 				return $template;
8459 8421
 			}
8460
-		}
8461
-		else
8422
+		} else
8462 8423
 			return null;
8463 8424
 	}
8464 8425
 	protected function getLocalizedTemplate($filename)
@@ -8569,8 +8530,9 @@  discard block
 block discarded – undo
8569 8530
 					}
8570 8531
 					$component->trackViewState(false);
8571 8532
 					$component->applyStyleSheetSkin($page);
8572
-					foreach($properties as $name=>$value)
8573
-						$this->configureControl($component,$name,$value);
8533
+					foreach($properties as $name=>$value) {
8534
+											$this->configureControl($component,$name,$value);
8535
+					}
8574 8536
 					$component->trackViewState(true);
8575 8537
 					if($parent===$parentControl)
8576 8538
 						$directChildren[]=$component;
@@ -8578,8 +8540,7 @@  discard block
 block discarded – undo
8578 8540
 						$component->createdOnTemplate($parent);
8579 8541
 					if($component->getAllowChildControls())
8580 8542
 						$controls[$key]=$component;
8581
-				}
8582
-				else if($component instanceof TComponent)
8543
+				} else if($component instanceof TComponent)
8583 8544
 				{
8584 8545
 					$controls[$key]=$component;
8585 8546
 					if(isset($properties['id']))
@@ -8590,15 +8551,15 @@  discard block
 block discarded – undo
8590 8551
 						if(!$component->hasProperty('id'))
8591 8552
 							unset($properties['id']);
8592 8553
 					}
8593
-					foreach($properties as $name=>$value)
8594
-						$this->configureComponent($component,$name,$value);
8554
+					foreach($properties as $name=>$value) {
8555
+											$this->configureComponent($component,$name,$value);
8556
+					}
8595 8557
 					if($parent===$parentControl)
8596 8558
 						$directChildren[]=$component;
8597 8559
 					else
8598 8560
 						$component->createdOnTemplate($parent);
8599 8561
 				}
8600
-			}
8601
-			else
8562
+			} else
8602 8563
 			{
8603 8564
 				if($object[1] instanceof TCompositeLiteral)
8604 8565
 				{
@@ -8608,8 +8569,7 @@  discard block
 block discarded – undo
8608 8569
 						$directChildren[]=$o;
8609 8570
 					else
8610 8571
 						$parent->addParsedObject($o);
8611
-				}
8612
-				else
8572
+				} else
8613 8573
 				{
8614 8574
 					if($parent===$parentControl)
8615 8575
 						$directChildren[]=$object[1];
@@ -8680,8 +8640,7 @@  discard block
 block discarded – undo
8680 8640
 				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8681 8641
 					break;
8682 8642
 			}
8683
-		}
8684
-		else
8643
+		} else
8685 8644
 		{
8686 8645
 			if (substr($name,0,2)=='js')
8687 8646
 				if ($value and !($value instanceof TJavaScriptLiteral))
@@ -8717,8 +8676,7 @@  discard block
 block discarded – undo
8717 8676
 				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8718 8677
 					break;
8719 8678
 			}
8720
-		}
8721
-		else
8679
+		} else
8722 8680
 			$component->setSubProperty($name,$value);
8723 8681
 	}
8724 8682
 	protected function parse($input)
@@ -8755,8 +8713,7 @@  discard block
 block discarded – undo
8755 8713
 						$stack[] = $type;
8756 8714
 						$container=$c-1;
8757 8715
 					}
8758
-				}
8759
-				else if(strpos($str,'</com:')===0)					{
8716
+				} else if(strpos($str,'</com:')===0)					{
8760 8717
 					if($expectPropEnd)
8761 8718
 						continue;
8762 8719
 					if($matchStart>$textStart)
@@ -8772,8 +8729,7 @@  discard block
 block discarded – undo
8772 8729
 						throw new TConfigurationException('template_closingtag_expected',$tag);
8773 8730
 					}
8774 8731
 					$container=$tpl[$container][0];
8775
-				}
8776
-				else if(strpos($str,'<%@')===0)					{
8732
+				} else if(strpos($str,'<%@')===0)					{
8777 8733
 					if($expectPropEnd)
8778 8734
 						continue;
8779 8735
 					if($matchStart>$textStart)
@@ -8782,8 +8738,7 @@  discard block
 block discarded – undo
8782 8738
 					if(isset($tpl[0]) || $this->_directive!==null)
8783 8739
 						throw new TConfigurationException('template_directive_nonunique');
8784 8740
 					$this->_directive=$this->parseAttributes($match[4][0],$match[4][1]);
8785
-				}
8786
-				else if(strpos($str,'<%')===0)					{
8741
+				} else if(strpos($str,'<%')===0)					{
8787 8742
 					if($expectPropEnd)
8788 8743
 						continue;
8789 8744
 					if($matchStart>$textStart)
@@ -8805,8 +8760,7 @@  discard block
 block discarded – undo
8805 8760
 						$literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\"));
8806 8761
 						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"));
8807 8762
 					}
8808
-				}
8809
-				else if(strpos($str,'<prop:')===0)					{
8763
+				} else if(strpos($str,'<prop:')===0)					{
8810 8764
 					if(strrpos($str,'/>')===strlen($str)-2)  					{
8811 8765
 						if($expectPropEnd)
8812 8766
 							continue;
@@ -8816,8 +8770,9 @@  discard block
 block discarded – undo
8816 8770
 						$prop=strtolower($match[6][0]);
8817 8771
 						$attrs=$this->parseAttributes($match[7][0],$match[7][1]);
8818 8772
 						$attributes=array();
8819
-						foreach($attrs as $name=>$value)
8820
-							$attributes[$prop.'.'.$name]=$value;
8773
+						foreach($attrs as $name=>$value) {
8774
+													$attributes[$prop.'.'.$name]=$value;
8775
+						}
8821 8776
 						$type=$tpl[$container][1];
8822 8777
 						$this->validateAttributes($type,$attributes);
8823 8778
 						foreach($attributes as $name=>$value)
@@ -8826,8 +8781,7 @@  discard block
 block discarded – undo
8826 8781
 								throw new TConfigurationException('template_property_duplicated',$name);
8827 8782
 							$tpl[$container][2][$name]=$value;
8828 8783
 						}
8829
-					}
8830
-					else  					{
8784
+					} else  					{
8831 8785
 						$prop=strtolower($match[3][0]);
8832 8786
 						$stack[] = '@'.$prop;
8833 8787
 						if(!$expectPropEnd)
@@ -8838,8 +8792,7 @@  discard block
 block discarded – undo
8838 8792
 							$expectPropEnd=true;
8839 8793
 						}
8840 8794
 					}
8841
-				}
8842
-				else if(strpos($str,'</prop:')===0)					{
8795
+				} else if(strpos($str,'</prop:')===0)					{
8843 8796
 					$prop=strtolower($match[3][0]);
8844 8797
 					if(empty($stack))
8845 8798
 						throw new TConfigurationException('template_closingtag_unexpected',"</prop:$prop>");
@@ -8865,21 +8818,18 @@  discard block
 block discarded – undo
8865 8818
 								if(isset($tpl[$container][2][$prop]))
8866 8819
 									throw new TConfigurationException('template_property_duplicated',$prop);
8867 8820
 								$tpl[$container][2][$prop]=$value;
8868
-							}
8869
-							else									$this->_directive[$prop]=$value;
8821
+							} else									$this->_directive[$prop]=$value;
8870 8822
 							$textStart=$matchEnd+1;
8871 8823
 						}
8872 8824
 						$expectPropEnd=false;
8873 8825
 					}
8874
-				}
8875
-				else if(strpos($str,'<!--')===0)					{
8826
+				} else if(strpos($str,'<!--')===0)					{
8876 8827
 					if($expectPropEnd)
8877 8828
 						throw new TConfigurationException('template_comments_forbidden');
8878 8829
 					if($matchStart>$textStart)
8879 8830
 						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8880 8831
 					$textStart=$matchEnd+1;
8881
-				}
8882
-				else
8832
+				} else
8883 8833
 					throw new TConfigurationException('template_matching_unexpected',$match);
8884 8834
 			}
8885 8835
 			if(!empty($stack))
@@ -8890,8 +8840,7 @@  discard block
 block discarded – undo
8890 8840
 			}
8891 8841
 			if($textStart<strlen($input))
8892 8842
 				$tpl[$c++]=array($container,substr($input,$textStart));
8893
-		}
8894
-		catch(Exception $e)
8843
+		} catch(Exception $e)
8895 8844
 		{
8896 8845
 			if(($e instanceof TException) && ($e instanceof TTemplateException))
8897 8846
 				throw $e;
@@ -8921,14 +8870,12 @@  discard block
 block discarded – undo
8921 8870
 				{
8922 8871
 					$parent=null;
8923 8872
 					$objects[$id]=$object;
8924
-				}
8925
-				else
8873
+				} else
8926 8874
 				{
8927 8875
 					$parent=$object[0];
8928 8876
 					$merged=array($parent,array($object[1]));
8929 8877
 				}
8930
-			}
8931
-			else
8878
+			} else
8932 8879
 				$merged[1][]=$object[1];
8933 8880
 		}
8934 8881
 		if($parent!==null)
@@ -8961,8 +8908,7 @@  discard block
 block discarded – undo
8961 8908
 					$attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1);
8962 8909
 				else
8963 8910
 					$attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]);
8964
-			}
8965
-			else
8911
+			} else
8966 8912
 			{
8967 8913
 				if($value[0]==='\'' || $value[0]==='"')
8968 8914
 					$attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2));
@@ -9004,8 +8950,7 @@  discard block
 block discarded – undo
9004 8950
 				return array(self::CONFIG_DATABIND,ltrim($expr,'.'));
9005 8951
 			else
9006 8952
 				return array(self::CONFIG_EXPRESSION,ltrim($expr,'.'));
9007
-		}
9008
-		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value)
8953
+		} else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value)
9009 8954
 		{
9010 8955
 			$value=$matches[1];
9011 8956
 			if($value[2]==='~')
@@ -9018,8 +8963,7 @@  discard block
 block discarded – undo
9018 8963
 				$literal = trim(substr($value,3,strlen($value)-5));
9019 8964
 				return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
9020 8965
 			}
9021
-		}
9022
-		else
8966
+		} else
9023 8967
 			return $value;
9024 8968
 	}
9025 8969
 	protected function validateAttributes($type,$attributes)
@@ -9039,15 +8983,13 @@  discard block
 block discarded – undo
9039 8983
 										$subname=substr($name,0,$pos);
9040 8984
 					if(!$class->hasMethod('get'.$subname))
9041 8985
 						throw new TConfigurationException('template_property_unknown',$type,$subname);
9042
-				}
9043
-				else if(strncasecmp($name,'on',2)===0)
8986
+				} else if(strncasecmp($name,'on',2)===0)
9044 8987
 				{
9045 8988
 										if(!$class->hasMethod($name))
9046 8989
 						throw new TConfigurationException('template_event_unknown',$type,$name);
9047 8990
 					else if(!is_string($att))
9048 8991
 						throw new TConfigurationException('template_eventhandler_invalid',$type,$name);
9049
-				}
9050
-				else
8992
+				} else
9051 8993
 				{
9052 8994
 										if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) )
9053 8995
 					{
@@ -9055,8 +8997,7 @@  discard block
 block discarded – undo
9055 8997
 							throw new TConfigurationException('template_property_readonly',$type,$name);
9056 8998
 						else
9057 8999
 							throw new TConfigurationException('template_property_unknown',$type,$name);
9058
-					}
9059
-					else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
9000
+					} else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
9060 9001
 					{
9061 9002
 						if(strcasecmp($name,'id')===0)
9062 9003
 							throw new TConfigurationException('template_controlid_invalid',$type);
@@ -9065,8 +9006,7 @@  discard block
 block discarded – undo
9065 9006
 					}
9066 9007
 				}
9067 9008
 			}
9068
-		}
9069
-		else if(is_subclass_of($className,'TComponent') || $className==='TComponent')
9009
+		} else if(is_subclass_of($className,'TComponent') || $className==='TComponent')
9070 9010
 		{
9071 9011
 			foreach($attributes as $name=>$att)
9072 9012
 			{
@@ -9077,8 +9017,7 @@  discard block
 block discarded – undo
9077 9017
 										$subname=substr($name,0,$pos);
9078 9018
 					if(!$class->hasMethod('get'.$subname))
9079 9019
 						throw new TConfigurationException('template_property_unknown',$type,$subname);
9080
-				}
9081
-				else if(strncasecmp($name,'on',2)===0)
9020
+				} else if(strncasecmp($name,'on',2)===0)
9082 9021
 					throw new TConfigurationException('template_event_forbidden',$type,$name);
9083 9022
 				else
9084 9023
 				{
@@ -9091,8 +9030,7 @@  discard block
 block discarded – undo
9091 9030
 					}
9092 9031
 				}
9093 9032
 			}
9094
-		}
9095
-		else
9033
+		} else
9096 9034
 			throw new TConfigurationException('template_component_required',$type);
9097 9035
 	}
9098 9036
 	public function getIncludedFiles()
@@ -9112,8 +9050,7 @@  discard block
 block discarded – undo
9112 9050
 						$line=$line-$this->_includeAtLine[$i]+1;
9113 9051
 						$srcFile=$this->_includedFiles[$i];
9114 9052
 						break;
9115
-					}
9116
-					else
9053
+					} else
9117 9054
 						$line=$line-$this->_includeLines[$i]+1;
9118 9055
 				}
9119 9056
 			}
@@ -9299,8 +9236,7 @@  discard block
 block discarded – undo
9299 9236
 					closedir($dir);
9300 9237
 					if($cacheValid)
9301 9238
 						$this->_skins=$skins;
9302
-				}
9303
-				else
9239
+				} else
9304 9240
 				{
9305 9241
 					$cacheValid=true;
9306 9242
 					$this->_cssFiles=$cssFiles;
@@ -9425,19 +9361,15 @@  discard block
 block discarded – undo
9425 9361
 							{
9426 9362
 								$setter='set'.$name;
9427 9363
 								$control->$setter($value);
9428
-							}
9429
-							else
9364
+							} else
9430 9365
 								throw new TConfigurationException('theme_property_readonly',$type,$name);
9431
-						}
9432
-						else
9366
+						} else
9433 9367
 							throw new TConfigurationException('theme_property_undefined',$type,$name);
9434
-					}
9435
-					else							$control->setSubProperty($name,$value);
9368
+					} else							$control->setSubProperty($name,$value);
9436 9369
 				}
9437 9370
 			}
9438 9371
 			return true;
9439
-		}
9440
-		else
9372
+		} else
9441 9373
 			return false;
9442 9374
 	}
9443 9375
 	public function getStyleSheetFiles()
@@ -9484,8 +9416,9 @@  discard block
 block discarded – undo
9484 9416
 	protected function initPageContext($pageConfig)
9485 9417
 	{
9486 9418
 		$application=$this->getApplication();
9487
-		foreach($pageConfig->getApplicationConfigurations() as $appConfig)
9488
-			$application->applyConfiguration($appConfig);
9419
+		foreach($pageConfig->getApplicationConfigurations() as $appConfig) {
9420
+					$application->applyConfiguration($appConfig);
9421
+		}
9489 9422
 		$this->applyConfiguration($pageConfig);
9490 9423
 	}
9491 9424
 	protected function applyConfiguration($config)
@@ -9530,8 +9463,7 @@  discard block
 block discarded – undo
9530 9463
 					$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
9531 9464
 			}
9532 9465
 			$pageConfig->loadFromFiles($this->getBasePath());
9533
-		}
9534
-		else
9466
+		} else
9535 9467
 		{
9536 9468
 			$configCached=true;
9537 9469
 			$currentTimestamp=array();
@@ -9548,8 +9480,7 @@  discard block
 block discarded – undo
9548 9480
 							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
9549 9481
 							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0]))
9550 9482
 								$configCached=false;
9551
-						}
9552
-						else
9483
+						} else
9553 9484
 						{
9554 9485
 							$currentTimestamp[$fileName]=@filemtime($fileName);
9555 9486
 							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName]))
@@ -9557,8 +9488,7 @@  discard block
 block discarded – undo
9557 9488
 						}
9558 9489
 					}
9559 9490
 				}
9560
-			}
9561
-			else
9491
+			} else
9562 9492
 			{
9563 9493
 				$configCached=false;
9564 9494
 				$paths=explode('.',$pagePath);
@@ -9701,8 +9631,7 @@  discard block
 block discarded – undo
9701 9631
 			$className=basename($path);
9702 9632
 			if(!class_exists($className,false))
9703 9633
 				include_once($path.Prado::CLASS_FILE_EXT);
9704
-		}
9705
-		else
9634
+		} else
9706 9635
 		{
9707 9636
 			$className=$this->getBasePageClass();
9708 9637
 			Prado::using($className);
@@ -9719,8 +9648,9 @@  discard block
 block discarded – undo
9719 9648
 	}
9720 9649
 	protected function runPage($page,$properties)
9721 9650
 	{
9722
-		foreach($properties as $name=>$value)
9723
-			$page->setSubProperty($name,$value);
9651
+		foreach($properties as $name=>$value) {
9652
+					$page->setSubProperty($name,$value);
9653
+		}
9724 9654
 		$page->run($this->getResponse()->createHtmlWriter());
9725 9655
 	}
9726 9656
 	public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
@@ -9784,8 +9714,7 @@  discard block
 block discarded – undo
9784 9714
 		{
9785 9715
 			$fcontent = include $fname;
9786 9716
 			$this->loadFromPhp($fcontent,dirname($fname),$configPagePath);
9787
-		}
9788
-		else
9717
+		} else
9789 9718
 		{
9790 9719
 			$dom=new TXmlDocument;
9791 9720
 			if($dom->loadFromFile($fname))
@@ -10028,8 +9957,7 @@  discard block
 block discarded – undo
10028 9957
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10029 9958
 				$this->copyFile($fullpath,$dst);
10030 9959
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
10031
-		}
10032
-		else
9960
+		} else
10033 9961
 		{
10034 9962
 			$dir=$this->hash($fullpath);
10035 9963
 			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
@@ -10100,8 +10028,7 @@  discard block
 block discarded – undo
10100 10028
 						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10101 10029
 						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
10102 10030
 					}
10103
-				}
10104
-				else
10031
+				} else
10105 10032
 					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10106 10033
 			}
10107 10034
 			closedir($folder);
@@ -10230,8 +10157,7 @@  discard block
 block discarded – undo
10230 10157
 					throw new TConfigurationException('globalization_source_path_failed',
10231 10158
 						$config['source']);
10232 10159
 					chmod($config['source'], PRADO_CHMOD); 				}
10233
-			}
10234
-			else
10160
+			} else
10235 10161
 			{
10236 10162
 				throw new TConfigurationException("invalid source dir '{$config['source']}'");
10237 10163
 			}
@@ -10261,8 +10187,9 @@  discard block
 block discarded – undo
10261 10187
 		if($culture===null) $culture = $this->getCulture();
10262 10188
 		$variants = explode('_', $culture);
10263 10189
 		$result = array();
10264
-		for(; count($variants) > 0; array_pop($variants))
10265
-			$result[] = implode('_', $variants);
10190
+		for(; count($variants) > 0; array_pop($variants)) {
10191
+					$result[] = implode('_', $variants);
10192
+		}
10266 10193
 		return $result;
10267 10194
 	}
10268 10195
 	public function getLocalizedResource($file,$culture=null)
@@ -10270,11 +10197,13 @@  discard block
 block discarded – undo
10270 10197
 		$files = array();
10271 10198
 		$variants = $this->getCultureVariants($culture);
10272 10199
 		$path = pathinfo($file);
10273
-		foreach($variants as $variant)
10274
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
10200
+		foreach($variants as $variant) {
10201
+					$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
10202
+		}
10275 10203
 		$filename = substr($path['basename'],0,strrpos($path['basename'],'.'));
10276
-		foreach($variants as $variant)
10277
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
10204
+		foreach($variants as $variant) {
10205
+					$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
10206
+		}
10278 10207
 		$files[] = $file;
10279 10208
 		return $files;
10280 10209
 	}
@@ -10362,8 +10291,7 @@  discard block
 block discarded – undo
10362 10291
 		{
10363 10292
 			$configFile=$basePath;
10364 10293
 			$basePath=dirname($configFile);
10365
-		}
10366
-		else
10294
+		} else
10367 10295
 			$configFile=null;
10368 10296
 				$runtimePath=$basePath.DIRECTORY_SEPARATOR.self::RUNTIME_PATH;
10369 10297
 		if(is_writable($runtimePath))
@@ -10380,8 +10308,7 @@  discard block
 block discarded – undo
10380 10308
 			}
10381 10309
 			$this->setBasePath($basePath);
10382 10310
 			$this->setRuntimePath($runtimePath);
10383
-		}
10384
-		else
10311
+		} else
10385 10312
 			throw new TConfigurationException('application_runtimepath_invalid',$runtimePath);
10386 10313
 	}
10387 10314
 	public function run()
@@ -10402,8 +10329,7 @@  discard block
 block discarded – undo
10402 10329
 				$this->$method();
10403 10330
 				$this->_step++;
10404 10331
 			}
10405
-		}
10406
-		catch(Exception $e)
10332
+		} catch(Exception $e)
10407 10333
 		{
10408 10334
 			$this->onError($e);
10409 10335
 		}
@@ -10728,14 +10654,17 @@  discard block
 block discarded – undo
10728 10654
 	{
10729 10655
 		if($config->getIsEmpty())
10730 10656
 			return;
10731
-				foreach($config->getAliases() as $alias=>$path)
10732
-			Prado::setPathOfAlias($alias,$path);
10733
-		foreach($config->getUsings() as $using)
10734
-			Prado::using($using);
10657
+				foreach($config->getAliases() as $alias=>$path) {
10658
+							Prado::setPathOfAlias($alias,$path);
10659
+				}
10660
+		foreach($config->getUsings() as $using) {
10661
+					Prado::using($using);
10662
+		}
10735 10663
 				if(!$withinService)
10736 10664
 		{
10737
-			foreach($config->getProperties() as $name=>$value)
10738
-				$this->setSubProperty($name,$value);
10665
+			foreach($config->getProperties() as $name=>$value) {
10666
+							$this->setSubProperty($name,$value);
10667
+			}
10739 10668
 		}
10740 10669
 		if(empty($this->_services))
10741 10670
 			$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
@@ -10744,11 +10673,11 @@  discard block
 block discarded – undo
10744 10673
 			if(is_array($parameter))
10745 10674
 			{
10746 10675
 				$component=Prado::createComponent($parameter[0]);
10747
-				foreach($parameter[1] as $name=>$value)
10748
-					$component->setSubProperty($name,$value);
10676
+				foreach($parameter[1] as $name=>$value) {
10677
+									$component->setSubProperty($name,$value);
10678
+				}
10749 10679
 				$this->_parameters->add($id,$component);
10750
-			}
10751
-			else
10680
+			} else
10752 10681
 				$this->_parameters->add($id,$parameter);
10753 10682
 		}
10754 10683
 				$modules=array();
@@ -10760,10 +10689,12 @@  discard block
 block discarded – undo
10760 10689
 			if($module = $this->internalLoadModule($id))
10761 10690
 				$modules[]=$module;
10762 10691
 		}
10763
-		foreach($modules as $module)
10764
-			$module[0]->init($module[1]);
10765
-				foreach($config->getServices() as $serviceID=>$serviceConfig)
10766
-			$this->_services[$serviceID]=$serviceConfig;
10692
+		foreach($modules as $module) {
10693
+					$module[0]->init($module[1]);
10694
+		}
10695
+				foreach($config->getServices() as $serviceID=>$serviceConfig) {
10696
+							$this->_services[$serviceID]=$serviceConfig;
10697
+				}
10767 10698
 				foreach($config->getExternalConfigurations() as $filePath=>$condition)
10768 10699
 		{
10769 10700
 			if($condition!==true)
@@ -10789,8 +10720,7 @@  discard block
 block discarded – undo
10789 10720
 				$config->loadFromFile($this->_configFile);
10790 10721
 				if($this->_cacheFile!==null)
10791 10722
 					file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
10792
-			}
10793
-			else
10723
+			} else
10794 10724
 				$config=unserialize(file_get_contents($this->_cacheFile));
10795 10725
 			$this->applyConfiguration($config,false);
10796 10726
 		}
@@ -10810,8 +10740,9 @@  discard block
 block discarded – undo
10810 10740
 				throw new THttpException(500,'application_service_unavailable',$serviceClass);
10811 10741
 			$service->setID($serviceID);
10812 10742
 			$this->setService($service);
10813
-			foreach($initProperties as $name=>$value)
10814
-				$service->setSubProperty($name,$value);
10743
+			foreach($initProperties as $name=>$value) {
10744
+							$service->setSubProperty($name,$value);
10745
+			}
10815 10746
 			if($configElement!==null)
10816 10747
 			{
10817 10748
 				$config=new TApplicationConfiguration;
@@ -10822,8 +10753,7 @@  discard block
 block discarded – undo
10822 10753
 				$this->applyConfiguration($config,true);
10823 10754
 			}
10824 10755
 			$service->init($configElement);
10825
-		}
10826
-		else
10756
+		} else
10827 10757
 			throw new THttpException(500,'application_service_unknown',$serviceID);
10828 10758
 	}
10829 10759
 	public function onError($param)
@@ -10915,8 +10845,7 @@  discard block
 block discarded – undo
10915 10845
 		{
10916 10846
 			$fcontent = include $fname;
10917 10847
 			$this->loadFromPhp($fcontent,dirname($fname));
10918
-		}
10919
-		else
10848
+		} else
10920 10849
 		{
10921 10850
 			$dom=new TXmlDocument;
10922 10851
 			$dom->loadFromFile($fname);
@@ -11023,8 +10952,7 @@  discard block
 block discarded – undo
11023 10952
 						if(isset($this->_aliases[$id]))
11024 10953
 							throw new TConfigurationException('appconfig_alias_redefined',$id);
11025 10954
 						$this->_aliases[$id]=$p;
11026
-					}
11027
-					else
10955
+					} else
11028 10956
 						throw new TConfigurationException('appconfig_alias_invalid');
11029 10957
 					$this->_empty=false;
11030 10958
 					break;
@@ -11079,8 +11007,7 @@  discard block
 block discarded – undo
11079 11007
 				else
11080 11008
 					$this->_modules[$id]=array($type,$properties->toArray(),$element);
11081 11009
 				$this->_empty=false;
11082
-			}
11083
-			else
11010
+			} else
11084 11011
 				throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName());
11085 11012
 		}
11086 11013
 	}
@@ -11112,8 +11039,7 @@  discard block
 block discarded – undo
11112 11039
 				$element->setParent(null);
11113 11040
 				$this->_services[$id]=array($type,$properties->toArray(),$element);
11114 11041
 				$this->_empty=false;
11115
-			}
11116
-			else
11042
+			} else
11117 11043
 				throw new TConfigurationException('appconfig_services_invalid',$element->getTagName());
11118 11044
 		}
11119 11045
 	}
@@ -11131,8 +11057,7 @@  discard block
 block discarded – undo
11131 11057
 					$properties['id'] = $id;
11132 11058
 					$this->_parameters[$id] = array($type,$properties);
11133 11059
 				}
11134
-			}
11135
-			else
11060
+			} else
11136 11061
 			{
11137 11062
 				$this->_parameters[$id] = $parameter;
11138 11063
 			}
@@ -11153,12 +11078,10 @@  discard block
 block discarded – undo
11153 11078
 						$this->_parameters[$id]=$element;
11154 11079
 					else
11155 11080
 						$this->_parameters[$id]=$value;
11156
-				}
11157
-				else
11081
+				} else
11158 11082
 					$this->_parameters[$id]=array($type,$properties->toArray());
11159 11083
 				$this->_empty=false;
11160
-			}
11161
-			else
11084
+			} else
11162 11085
 				throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName());
11163 11086
 		}
11164 11087
 	}
Please login to merge, or discard this patch.