Completed
Push — intl ( 51e284 )
by Fabio
06:51
created
framework/Web/UI/WebControls/TTable.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -144,6 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	/**
146 146
 	 * @param string table caption
147
+	 * @param string $value
147 148
 	 */
148 149
 	public function setCaption($value)
149 150
 	{
@@ -160,6 +161,7 @@  discard block
 block discarded – undo
160 161
 
161 162
 	/**
162 163
 	 * @param TTableCaptionAlign table caption alignment.
164
+	 * @param TTableCaptionAlign $value
163 165
 	 */
164 166
 	public function setCaptionAlign($value)
165 167
 	{
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -306,8 +306,7 @@  discard block
 block discarded – undo
306 306
 					{
307 307
 						if($index===0 && $currentSection===TTableRowSection::Header)
308 308
 							$writer->renderBeginTag('thead');
309
-					}
310
-					else
309
+					} else
311 310
 					{
312 311
 						if($currentSection===TTableRowSection::Header)
313 312
 						{
@@ -318,8 +317,7 @@  discard block
 block discarded – undo
318 317
 							else
319 318
 								$writer->renderBeginTag('tfoot');
320 319
 							$currentSection=$section;
321
-						}
322
-						else if($currentSection===TTableRowSection::Body)
320
+						} else if($currentSection===TTableRowSection::Body)
323 321
 						{
324 322
 							$writer->renderEndTag();
325 323
 							if($section===TTableRowSection::Footer)
@@ -327,16 +325,14 @@  discard block
 block discarded – undo
327 325
 							else
328 326
 								throw new TConfigurationException('table_tablesection_outoforder');
329 327
 							$currentSection=$section;
330
-						}
331
-						else // Footer
328
+						} else // Footer
332 329
 							throw new TConfigurationException('table_tablesection_outoforder');
333 330
 					}
334 331
 					$row->renderControl($writer);
335 332
 					$writer->writeLine();
336 333
 				}
337 334
 				$writer->renderEndTag();
338
-			}
339
-			else
335
+			} else
340 336
 			{
341 337
 				$writer->writeLine();
342 338
 				foreach($this->getControls() as $row)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				if(($border=$this->getBorderWidth())==='')
110 110
 					$border=1;
111 111
 				else
112
-					$border=(int)$border;
112
+					$border=(int) $border;
113 113
 			}
114 114
 		}
115
-		$writer->addAttribute('border',"$border");
115
+		$writer->addAttribute('border', "$border");
116 116
 	}
117 117
 
118 118
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function getCaption()
140 140
 	{
141
-		return $this->getViewState('Caption','');
141
+		return $this->getViewState('Caption', '');
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function setCaption($value)
148 148
 	{
149
-		$this->setViewState('Caption',$value,'');
149
+		$this->setViewState('Caption', $value, '');
150 150
 	}
151 151
 
152 152
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function getCaptionAlign()
156 156
 	{
157
-		return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet);
157
+		return $this->getViewState('CaptionAlign', TTableCaptionAlign::NotSet);
158 158
 	}
159 159
 
160 160
 	/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function setCaptionAlign($value)
164 164
 	{
165
-		$this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'),TTableCaptionAlign::NotSet);
165
+		$this->setViewState('CaptionAlign', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'), TTableCaptionAlign::NotSet);
166 166
 	}
167 167
 
168 168
 	/**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		if(($caption=$this->getCaption())!=='')
272 272
 		{
273 273
 			if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet)
274
-				$writer->addAttribute('align',strtolower($align));
274
+				$writer->addAttribute('align', strtolower($align));
275 275
 			$writer->renderBeginTag('caption');
276 276
 			$writer->write($caption);
277 277
 			$writer->renderEndTag();
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 					{
311 311
 						if($currentSection===TTableRowSection::Header)
312 312
 						{
313
-							if($index>0)
313
+							if($index > 0)
314 314
 								$writer->renderEndTag();
315 315
 							if($section===TTableRowSection::Body)
316 316
 								$writer->renderBeginTag('tbody');
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTemplateColumn.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	/**
121
-	 * @return ITemplate the item template
121
+	 * @return string the item template
122 122
 	 */
123 123
 	public function getItemTemplate()
124 124
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function getItemRenderer()
55 55
 	{
56
-		return $this->getViewState('ItemRenderer','');
56
+		return $this->getViewState('ItemRenderer', '');
57 57
 	}
58 58
 
59 59
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function setItemRenderer($value)
71 71
 	{
72
-		$this->setViewState('ItemRenderer',$value,'');
72
+		$this->setViewState('ItemRenderer', $value, '');
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function getEditItemRenderer()
80 80
 	{
81
-		return $this->getViewState('EditItemRenderer','');
81
+		return $this->getViewState('EditItemRenderer', '');
82 82
 	}
83 83
 
84 84
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function setEditItemRenderer($value)
96 96
 	{
97
-		$this->setViewState('EditItemRenderer',$value,'');
97
+		$this->setViewState('EditItemRenderer', $value, '');
98 98
 	}
99 99
 
100 100
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		if($value instanceof ITemplate || $value===null)
115 115
 			$this->_editItemTemplate=$value;
116 116
 		else
117
-			throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate');
117
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate');
118 118
 	}
119 119
 
120 120
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		if($value instanceof ITemplate || $value===null)
135 135
 			$this->_itemTemplate=$value;
136 136
 		else
137
-			throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate');
137
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate');
138 138
 	}
139 139
 
140 140
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		if($value instanceof ITemplate || $value===null)
155 155
 			$this->_headerTemplate=$value;
156 156
 		else
157
-			throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate');
157
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate');
158 158
 	}
159 159
 
160 160
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		if($value instanceof ITemplate || $value===null)
175 175
 			$this->_footerTemplate=$value;
176 176
 		else
177
-			throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate');
177
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate');
178 178
 	}
179 179
 
180 180
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @param integer the index to the Columns property that the cell resides in.
187 187
 	 * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
188 188
 	 */
189
-	public function initializeCell($cell,$columnIndex,$itemType)
189
+	public function initializeCell($cell, $columnIndex, $itemType)
190 190
 	{
191 191
 		if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem)
192 192
 		{
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 					$control->setItemType($itemType);
214 214
 				}
215 215
 				if($control instanceof \Prado\IDataRenderer)
216
-					$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
216
+					$control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
217 217
 			}
218 218
 			else if($template!==null)
219 219
 				$template->instantiateIn($cell);
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 		else if($itemType===TListItemType::Header)
224 224
 		{
225 225
 			if(($classPath=$this->getHeaderRenderer())!=='')
226
-				$this->initializeHeaderCell($cell,$columnIndex);
226
+				$this->initializeHeaderCell($cell, $columnIndex);
227 227
 			else if($this->_headerTemplate!==null)
228 228
 				$this->_headerTemplate->instantiateIn($cell);
229 229
 			else
230
-				$this->initializeHeaderCell($cell,$columnIndex);
230
+				$this->initializeHeaderCell($cell, $columnIndex);
231 231
 		}
232 232
 		else if($itemType===TListItemType::Footer)
233 233
 		{
234 234
 			if(($classPath=$this->getFooterRenderer())!=='')
235
-				$this->initializeFooterCell($cell,$columnIndex);
235
+				$this->initializeFooterCell($cell, $columnIndex);
236 236
 			else if($this->_footerTemplate!==null)
237 237
 				$this->_footerTemplate->instantiateIn($cell);
238 238
 			else
239
-				$this->initializeFooterCell($cell,$columnIndex);
239
+				$this->initializeFooterCell($cell, $columnIndex);
240 240
 		}
241 241
 	}
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * This method is invoked when datagrid performs databinding.
246 246
 	 * It populates the content of the cell with the relevant data from data source.
247 247
 	 */
248
-	public function dataBindColumn($sender,$param)
248
+	public function dataBindColumn($sender, $param)
249 249
 	{
250 250
 		$item=$sender->getNamingContainer();
251 251
 		$sender->setData($item->getData());
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -197,8 +197,7 @@  discard block
 block discarded – undo
197 197
 					$classPath=$this->getItemRenderer();
198 198
 					$template=$this->_itemTemplate;
199 199
 				}
200
-			}
201
-			else
200
+			} else
202 201
 			{
203 202
 				$template=$this->_itemTemplate;
204 203
 				$classPath=$this->getItemRenderer();
@@ -214,13 +213,11 @@  discard block
 block discarded – undo
214 213
 				}
215 214
 				if($control instanceof \Prado\IDataRenderer)
216 215
 					$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
217
-			}
218
-			else if($template!==null)
216
+			} else if($template!==null)
219 217
 				$template->instantiateIn($cell);
220 218
 			else if($itemType!==TListItemType::EditItem)
221 219
 				$cell->setText(' ');
222
-		}
223
-		else if($itemType===TListItemType::Header)
220
+		} else if($itemType===TListItemType::Header)
224 221
 		{
225 222
 			if(($classPath=$this->getHeaderRenderer())!=='')
226 223
 				$this->initializeHeaderCell($cell,$columnIndex);
@@ -228,8 +225,7 @@  discard block
 block discarded – undo
228 225
 				$this->_headerTemplate->instantiateIn($cell);
229 226
 			else
230 227
 				$this->initializeHeaderCell($cell,$columnIndex);
231
-		}
232
-		else if($itemType===TListItemType::Footer)
228
+		} else if($itemType===TListItemType::Footer)
233 229
 		{
234 230
 			if(($classPath=$this->getFooterRenderer())!=='')
235 231
 				$this->initializeFooterCell($cell,$columnIndex);
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -113,6 +113,7 @@
 block discarded – undo
113 113
 
114 114
 	/**
115 115
 	 * @param string button caption
116
+	 * @param string $value
116 117
 	 */
117 118
 	public function setButtonText($value)
118 119
 	{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function getImageUrl()
91 91
 	{
92
-		return $this->_imageUrl===null?'':$this->_imageUrl;
92
+		return $this->_imageUrl===null ? '' : $this->_imageUrl;
93 93
 	}
94 94
 
95 95
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getButtonText()
107 107
 	{
108
-		return $this->_buttonText===null?'':$this->_buttonText;
108
+		return $this->_buttonText===null ? '' : $this->_buttonText;
109 109
 	}
110 110
 
111 111
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getButtonType()
123 123
 	{
124
-		return $this->_buttonType===null? TWizardNavigationButtonType::Button :$this->_buttonType;
124
+		return $this->_buttonType===null ? TWizardNavigationButtonType::Button : $this->_buttonType;
125 125
 	}
126 126
 
127 127
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function setButtonType($value)
131 131
 	{
132
-		$this->_buttonType=TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TWizardNavigationButtonType');
132
+		$this->_buttonType=TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TWizardNavigationButtonType');
133 133
 	}
134 134
 
135 135
 	/**
Please login to merge, or discard this patch.
framework/Wsat/TWsatARGenerator.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -207,6 +207,10 @@
 block discarded – undo
207 207
                 return $code;
208 208
         }
209 209
 
210
+        /**
211
+         * @param string $classname
212
+         * @param string $toString
213
+         */
210 214
         protected function generateClass($properties, $tablename, $classname, $toString)
211 215
         {
212 216
                 $props = implode("\n", $properties);
Please login to merge, or discard this patch.
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -14,206 +14,206 @@  discard block
 block discarded – undo
14 14
 class TWsatARGenerator extends TWsatBaseGenerator
15 15
 {
16 16
 
17
-        /**
18
-         * Class name prefix
19
-         */
20
-        private $_clasPrefix;
21
-
22
-        /**
23
-         * Class name sufix
24
-         */
25
-        private $_classSufix;
26
-
27
-        /**
28
-         * all table relations array
29
-         */
30
-        private $_relations;
31
-
32
-        /**
33
-         * unquote chars
34
-         * @var array
35
-         */
36
-        private $uqChars = array('[', ']', '"', '`', "'");
37
-
38
-        function __construct()
39
-        {
40
-                parent::__construct();
41
-        }
42
-
43
-        public function setClasPrefix($_clas_prefix)
44
-        {
45
-                $this->_clasPrefix = $_clas_prefix;
46
-        }
47
-
48
-        public function setClassSufix($_clas_sufix)
49
-        {
50
-                $this->_classSufix = $_clas_sufix;
51
-        }
17
+		/**
18
+		 * Class name prefix
19
+		 */
20
+		private $_clasPrefix;
21
+
22
+		/**
23
+		 * Class name sufix
24
+		 */
25
+		private $_classSufix;
26
+
27
+		/**
28
+		 * all table relations array
29
+		 */
30
+		private $_relations;
31
+
32
+		/**
33
+		 * unquote chars
34
+		 * @var array
35
+		 */
36
+		private $uqChars = array('[', ']', '"', '`', "'");
37
+
38
+		function __construct()
39
+		{
40
+				parent::__construct();
41
+		}
42
+
43
+		public function setClasPrefix($_clas_prefix)
44
+		{
45
+				$this->_clasPrefix = $_clas_prefix;
46
+		}
47
+
48
+		public function setClassSufix($_clas_sufix)
49
+		{
50
+				$this->_classSufix = $_clas_sufix;
51
+		}
52 52
 
53 53
 //-----------------------------------------------------------------------------
54
-        // <editor-fold defaultstate="collapsed" desc="Main APIs">
55
-        public function generate($tableName)
56
-        {
57
-                $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
58
-                $this->_commonGenerate($tableName, $tableInfo);
59
-        }
60
-
61
-        public function generateAll()
62
-        {
63
-                foreach ($this->getAllTableNames() as $tableName)
64
-                {
65
-                        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
-                        if (!empty($this->_relations))
67
-                        {
68
-                                // Cancel generation of M-M relationships middle table
69
-                                if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
70
-                                        continue;
71
-                        }
72
-                        $this->_commonGenerate($tableName, $tableInfo);
73
-                }
74
-        }
75
-
76
-        public function buildRelations()
77
-        {
78
-                $this->_relations = array();
79
-                foreach ($this->getAllTableNames() as $table_name)
80
-                {
81
-                        $tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
-                        $pks = $tableInfo->getPrimaryKeys();
83
-                        $fks = $tableInfo->getForeignKeys();
84
-
85
-                        if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
86
-                        {
87
-                                $table_name_mm = $fks[0]["table"];
88
-                                $table_name_mm2 = $fks[1]["table"];
89
-
90
-                                $this->_relations[$table_name_mm][] = array(
91
-                                        "prop_name" => strtolower($table_name_mm2),
92
-                                        "rel_type" => "self::MANY_TO_MANY",
93
-                                        "ref_class_name" => $this->_getProperClassName($table_name_mm2),
94
-                                        "prop_ref" => $table_name
95
-                                );
96
-
97
-                                $this->_relations[$table_name_mm2][] = array(
98
-                                        "prop_name" => strtolower($table_name_mm),
99
-                                        "rel_type" => "self::MANY_TO_MANY",
100
-                                        "ref_class_name" => $this->_getProperClassName($table_name_mm),
101
-                                        "prop_ref" => $table_name
102
-                                );
103
-                                continue;
104
-                        }
105
-                        foreach ($fks as $fk_data)//1-M relationships
106
-                        {
107
-                                $owner_table = $fk_data["table"];
108
-                                $slave_table = $table_name;
109
-                                $fk_prop = key($fk_data["keys"]);
110
-
111
-                                $this->_relations[$owner_table][] = array(
112
-                                        "prop_name" => strtolower($slave_table),
113
-                                        "rel_type" => "self::HAS_MANY",
114
-                                        "ref_class_name" => $this->_getProperClassName($slave_table),
115
-                                        "prop_ref" => $fk_prop
116
-                                );
117
-
118
-                                $this->_relations[$slave_table][] = array(
119
-                                        "prop_name" => strtolower($owner_table),
120
-                                        "rel_type" => "self::BELONGS_TO",
121
-                                        "ref_class_name" => $this->_getProperClassName($owner_table),
122
-                                        "prop_ref" => $fk_prop
123
-                                );
124
-                        }
125
-                }
126
-        }
54
+		// <editor-fold defaultstate="collapsed" desc="Main APIs">
55
+		public function generate($tableName)
56
+		{
57
+				$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
58
+				$this->_commonGenerate($tableName, $tableInfo);
59
+		}
60
+
61
+		public function generateAll()
62
+		{
63
+				foreach ($this->getAllTableNames() as $tableName)
64
+				{
65
+						$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
+						if (!empty($this->_relations))
67
+						{
68
+								// Cancel generation of M-M relationships middle table
69
+								if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
70
+										continue;
71
+						}
72
+						$this->_commonGenerate($tableName, $tableInfo);
73
+				}
74
+		}
75
+
76
+		public function buildRelations()
77
+		{
78
+				$this->_relations = array();
79
+				foreach ($this->getAllTableNames() as $table_name)
80
+				{
81
+						$tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
+						$pks = $tableInfo->getPrimaryKeys();
83
+						$fks = $tableInfo->getForeignKeys();
84
+
85
+						if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
86
+						{
87
+								$table_name_mm = $fks[0]["table"];
88
+								$table_name_mm2 = $fks[1]["table"];
89
+
90
+								$this->_relations[$table_name_mm][] = array(
91
+										"prop_name" => strtolower($table_name_mm2),
92
+										"rel_type" => "self::MANY_TO_MANY",
93
+										"ref_class_name" => $this->_getProperClassName($table_name_mm2),
94
+										"prop_ref" => $table_name
95
+								);
96
+
97
+								$this->_relations[$table_name_mm2][] = array(
98
+										"prop_name" => strtolower($table_name_mm),
99
+										"rel_type" => "self::MANY_TO_MANY",
100
+										"ref_class_name" => $this->_getProperClassName($table_name_mm),
101
+										"prop_ref" => $table_name
102
+								);
103
+								continue;
104
+						}
105
+						foreach ($fks as $fk_data)//1-M relationships
106
+						{
107
+								$owner_table = $fk_data["table"];
108
+								$slave_table = $table_name;
109
+								$fk_prop = key($fk_data["keys"]);
110
+
111
+								$this->_relations[$owner_table][] = array(
112
+										"prop_name" => strtolower($slave_table),
113
+										"rel_type" => "self::HAS_MANY",
114
+										"ref_class_name" => $this->_getProperClassName($slave_table),
115
+										"prop_ref" => $fk_prop
116
+								);
117
+
118
+								$this->_relations[$slave_table][] = array(
119
+										"prop_name" => strtolower($owner_table),
120
+										"rel_type" => "self::BELONGS_TO",
121
+										"ref_class_name" => $this->_getProperClassName($owner_table),
122
+										"prop_ref" => $fk_prop
123
+								);
124
+						}
125
+				}
126
+		}
127 127
 
128 128
 // </editor-fold>
129 129
 //-----------------------------------------------------------------------------
130
-        // <editor-fold defaultstate="collapsed" desc="Common Methods">
131
-
132
-        private function _commonGenerate($tableName, $tableInfo)
133
-        {
134
-                if (count($tableInfo->getColumns()) === 0)
135
-                        throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
136
-                else
137
-                {
138
-                        $properties = array();
139
-                        foreach ($tableInfo->getColumns() as $field => $metadata)
140
-                                $properties[] = $this->generateProperty($field, $metadata);
141
-                        $toString = $this->_buildSmartToString($tableInfo);
142
-                }
143
-
144
-                $clasName = $this->_getProperClassName($tableName);
145
-                $class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
-                $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
147
-                file_put_contents($output, $class);
148
-        }
149
-
150
-        private function _getProperClassName($tableName)
151
-        {
152
-                $table_name_words = str_replace("_", " ", strtolower($tableName));
153
-                $final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
-                return $this->_clasPrefix . $final_conversion . $this->_classSufix;
155
-        }
130
+		// <editor-fold defaultstate="collapsed" desc="Common Methods">
131
+
132
+		private function _commonGenerate($tableName, $tableInfo)
133
+		{
134
+				if (count($tableInfo->getColumns()) === 0)
135
+						throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
136
+				else
137
+				{
138
+						$properties = array();
139
+						foreach ($tableInfo->getColumns() as $field => $metadata)
140
+								$properties[] = $this->generateProperty($field, $metadata);
141
+						$toString = $this->_buildSmartToString($tableInfo);
142
+				}
143
+
144
+				$clasName = $this->_getProperClassName($tableName);
145
+				$class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
+				$output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
147
+				file_put_contents($output, $class);
148
+		}
149
+
150
+		private function _getProperClassName($tableName)
151
+		{
152
+				$table_name_words = str_replace("_", " ", strtolower($tableName));
153
+				$final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
+				return $this->_clasPrefix . $final_conversion . $this->_classSufix;
155
+		}
156 156
 
157 157
 //-----------------------------------------------------------------------------
158 158
 
159
-        protected function generateProperty($field, $metadata)
160
-        {
161
-                $prop = '';
162
-                $name = '$' . $field;
163
-
164
-                /* TODO use in version 2.0 */
165
-                // $type = $column->getPHPType();
166
-
167
-                $prop .= "\tpublic $name;";
168
-                return $prop;
169
-        }
170
-
171
-        private function _renderRelations($tablename)
172
-        {
173
-                if (!isset($this->_relations[$tablename]))
174
-                        return "";
175
-
176
-                $code = "\tpublic static \$RELATIONS = array (";
177
-                foreach ($this->_relations[$tablename] as $rel_data)
178
-                        $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
179
-
180
-                $code = substr($code, 0, -1);
181
-                $code .= "\n\t);";
182
-                return $code;
183
-        }
184
-
185
-        private function _buildSmartToString($tableInfo)
186
-        {
187
-                $code = "\tpublic function __toString() {";
188
-                $property = "throw new THttpException(500, 'Not implemented yet.');";
189
-                try
190
-                {
191
-                        foreach ($tableInfo->getColumns() as $column)
192
-                        {
193
-                                if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
195
-                                elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
196
-                                {
197
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
198
-                                        break;
199
-                                }
200
-                        }
201
-                } catch (Exception $ex)
202
-                {
203
-                        Prado::trace($ex->getMessage());
204
-                }
205
-                $code .= "\n\t\treturn \$this->$property;";
206
-                $code .= "\n\t}";
207
-                return $code;
208
-        }
209
-
210
-        protected function generateClass($properties, $tablename, $classname, $toString)
211
-        {
212
-                $props = implode("\n", $properties);
213
-                $relations = $this->_renderRelations($tablename);
214
-                $date = date('Y-m-d h:i:s');
215
-                $env_user = getenv("username");
216
-                return <<<EOD
159
+		protected function generateProperty($field, $metadata)
160
+		{
161
+				$prop = '';
162
+				$name = '$' . $field;
163
+
164
+				/* TODO use in version 2.0 */
165
+				// $type = $column->getPHPType();
166
+
167
+				$prop .= "\tpublic $name;";
168
+				return $prop;
169
+		}
170
+
171
+		private function _renderRelations($tablename)
172
+		{
173
+				if (!isset($this->_relations[$tablename]))
174
+						return "";
175
+
176
+				$code = "\tpublic static \$RELATIONS = array (";
177
+				foreach ($this->_relations[$tablename] as $rel_data)
178
+						$code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
179
+
180
+				$code = substr($code, 0, -1);
181
+				$code .= "\n\t);";
182
+				return $code;
183
+		}
184
+
185
+		private function _buildSmartToString($tableInfo)
186
+		{
187
+				$code = "\tpublic function __toString() {";
188
+				$property = "throw new THttpException(500, 'Not implemented yet.');";
189
+				try
190
+				{
191
+						foreach ($tableInfo->getColumns() as $column)
192
+						{
193
+								if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
+										$property = str_replace($this->uqChars, "", $column->ColumnName);
195
+								elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
196
+								{
197
+										$property = str_replace($this->uqChars, "", $column->ColumnName);
198
+										break;
199
+								}
200
+						}
201
+				} catch (Exception $ex)
202
+				{
203
+						Prado::trace($ex->getMessage());
204
+				}
205
+				$code .= "\n\t\treturn \$this->$property;";
206
+				$code .= "\n\t}";
207
+				return $code;
208
+		}
209
+
210
+		protected function generateClass($properties, $tablename, $classname, $toString)
211
+		{
212
+				$props = implode("\n", $properties);
213
+				$relations = $this->_renderRelations($tablename);
214
+				$date = date('Y-m-d h:i:s');
215
+				$env_user = getenv("username");
216
+				return <<<EOD
217 217
 <?php
218 218
 /**
219 219
  * Auto generated by PRADO - WSAT on $date.
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 $toString
235 235
 }
236 236
 EOD;
237
-        }
237
+		}
238 238
 
239 239
 // </editor-fold>
240 240
 }
241 241
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
          * unquote chars
34 34
          * @var array
35 35
          */
36
-        private $uqChars = array('[', ']', '"', '`', "'");
36
+        private $uqChars=array('[', ']', '"', '`', "'");
37 37
 
38 38
         function __construct()
39 39
         {
@@ -42,31 +42,31 @@  discard block
 block discarded – undo
42 42
 
43 43
         public function setClasPrefix($_clas_prefix)
44 44
         {
45
-                $this->_clasPrefix = $_clas_prefix;
45
+                $this->_clasPrefix=$_clas_prefix;
46 46
         }
47 47
 
48 48
         public function setClassSufix($_clas_sufix)
49 49
         {
50
-                $this->_classSufix = $_clas_sufix;
50
+                $this->_classSufix=$_clas_sufix;
51 51
         }
52 52
 
53 53
 //-----------------------------------------------------------------------------
54 54
         // <editor-fold defaultstate="collapsed" desc="Main APIs">
55 55
         public function generate($tableName)
56 56
         {
57
-                $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
57
+                $tableInfo=$this->_dbMetaData->getTableInfo($tableName);
58 58
                 $this->_commonGenerate($tableName, $tableInfo);
59 59
         }
60 60
 
61 61
         public function generateAll()
62 62
         {
63
-                foreach ($this->getAllTableNames() as $tableName)
63
+                foreach($this->getAllTableNames() as $tableName)
64 64
                 {
65
-                        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
-                        if (!empty($this->_relations))
65
+                        $tableInfo=$this->_dbMetaData->getTableInfo($tableName);
66
+                        if(!empty($this->_relations))
67 67
                         {
68 68
                                 // Cancel generation of M-M relationships middle table
69
-                                if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
69
+                                if(count($tableInfo->getPrimaryKeys())===2 && count($tableInfo->getColumns())===2)//M-M relationships
70 70
                                         continue;
71 71
                         }
72 72
                         $this->_commonGenerate($tableName, $tableInfo);
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
 
76 76
         public function buildRelations()
77 77
         {
78
-                $this->_relations = array();
79
-                foreach ($this->getAllTableNames() as $table_name)
78
+                $this->_relations=array();
79
+                foreach($this->getAllTableNames() as $table_name)
80 80
                 {
81
-                        $tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
-                        $pks = $tableInfo->getPrimaryKeys();
83
-                        $fks = $tableInfo->getForeignKeys();
81
+                        $tableInfo=$this->_dbMetaData->getTableInfo($table_name);
82
+                        $pks=$tableInfo->getPrimaryKeys();
83
+                        $fks=$tableInfo->getForeignKeys();
84 84
 
85
-                        if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
85
+                        if(count($pks)===2 && count($tableInfo->getColumns())===2)//M-M relationships
86 86
                         {
87
-                                $table_name_mm = $fks[0]["table"];
88
-                                $table_name_mm2 = $fks[1]["table"];
87
+                                $table_name_mm=$fks[0]["table"];
88
+                                $table_name_mm2=$fks[1]["table"];
89 89
 
90
-                                $this->_relations[$table_name_mm][] = array(
90
+                                $this->_relations[$table_name_mm][]=array(
91 91
                                         "prop_name" => strtolower($table_name_mm2),
92 92
                                         "rel_type" => "self::MANY_TO_MANY",
93 93
                                         "ref_class_name" => $this->_getProperClassName($table_name_mm2),
94 94
                                         "prop_ref" => $table_name
95 95
                                 );
96 96
 
97
-                                $this->_relations[$table_name_mm2][] = array(
97
+                                $this->_relations[$table_name_mm2][]=array(
98 98
                                         "prop_name" => strtolower($table_name_mm),
99 99
                                         "rel_type" => "self::MANY_TO_MANY",
100 100
                                         "ref_class_name" => $this->_getProperClassName($table_name_mm),
@@ -102,20 +102,20 @@  discard block
 block discarded – undo
102 102
                                 );
103 103
                                 continue;
104 104
                         }
105
-                        foreach ($fks as $fk_data)//1-M relationships
105
+                        foreach($fks as $fk_data)//1-M relationships
106 106
                         {
107
-                                $owner_table = $fk_data["table"];
108
-                                $slave_table = $table_name;
109
-                                $fk_prop = key($fk_data["keys"]);
107
+                                $owner_table=$fk_data["table"];
108
+                                $slave_table=$table_name;
109
+                                $fk_prop=key($fk_data["keys"]);
110 110
 
111
-                                $this->_relations[$owner_table][] = array(
111
+                                $this->_relations[$owner_table][]=array(
112 112
                                         "prop_name" => strtolower($slave_table),
113 113
                                         "rel_type" => "self::HAS_MANY",
114 114
                                         "ref_class_name" => $this->_getProperClassName($slave_table),
115 115
                                         "prop_ref" => $fk_prop
116 116
                                 );
117 117
 
118
-                                $this->_relations[$slave_table][] = array(
118
+                                $this->_relations[$slave_table][]=array(
119 119
                                         "prop_name" => strtolower($owner_table),
120 120
                                         "rel_type" => "self::BELONGS_TO",
121 121
                                         "ref_class_name" => $this->_getProperClassName($owner_table),
@@ -131,88 +131,88 @@  discard block
 block discarded – undo
131 131
 
132 132
         private function _commonGenerate($tableName, $tableInfo)
133 133
         {
134
-                if (count($tableInfo->getColumns()) === 0)
135
-                        throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
134
+                if(count($tableInfo->getColumns())===0)
135
+                        throw new Exception("Unable to find table or view $tableName in ".$this->_dbMetaData->getDbConnection()->getConnectionString().".");
136 136
                 else
137 137
                 {
138
-                        $properties = array();
139
-                        foreach ($tableInfo->getColumns() as $field => $metadata)
140
-                                $properties[] = $this->generateProperty($field, $metadata);
141
-                        $toString = $this->_buildSmartToString($tableInfo);
138
+                        $properties=array();
139
+                        foreach($tableInfo->getColumns() as $field => $metadata)
140
+                                $properties[]=$this->generateProperty($field, $metadata);
141
+                        $toString=$this->_buildSmartToString($tableInfo);
142 142
                 }
143 143
 
144
-                $clasName = $this->_getProperClassName($tableName);
145
-                $class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
-                $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
144
+                $clasName=$this->_getProperClassName($tableName);
145
+                $class=$this->generateClass($properties, $tableName, $clasName, $toString);
146
+                $output=$this->_opFile.DIRECTORY_SEPARATOR.$clasName.".php";
147 147
                 file_put_contents($output, $class);
148 148
         }
149 149
 
150 150
         private function _getProperClassName($tableName)
151 151
         {
152
-                $table_name_words = str_replace("_", " ", strtolower($tableName));
153
-                $final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
-                return $this->_clasPrefix . $final_conversion . $this->_classSufix;
152
+                $table_name_words=str_replace("_", " ", strtolower($tableName));
153
+                $final_conversion=str_replace(" ", "", ucwords($table_name_words));
154
+                return $this->_clasPrefix.$final_conversion.$this->_classSufix;
155 155
         }
156 156
 
157 157
 //-----------------------------------------------------------------------------
158 158
 
159 159
         protected function generateProperty($field, $metadata)
160 160
         {
161
-                $prop = '';
162
-                $name = '$' . $field;
161
+                $prop='';
162
+                $name='$'.$field;
163 163
 
164 164
                 /* TODO use in version 2.0 */
165 165
                 // $type = $column->getPHPType();
166 166
 
167
-                $prop .= "\tpublic $name;";
167
+                $prop.="\tpublic $name;";
168 168
                 return $prop;
169 169
         }
170 170
 
171 171
         private function _renderRelations($tablename)
172 172
         {
173
-                if (!isset($this->_relations[$tablename]))
173
+                if(!isset($this->_relations[$tablename]))
174 174
                         return "";
175 175
 
176
-                $code = "\tpublic static \$RELATIONS = array (";
177
-                foreach ($this->_relations[$tablename] as $rel_data)
178
-                        $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
176
+                $code="\tpublic static \$RELATIONS = array (";
177
+                foreach($this->_relations[$tablename] as $rel_data)
178
+                        $code.="\n\t\t'".$rel_data["prop_name"]."' => array(".$rel_data["rel_type"].", '".$rel_data["ref_class_name"]."', '".$rel_data["prop_ref"]."'),";
179 179
 
180
-                $code = substr($code, 0, -1);
181
-                $code .= "\n\t);";
180
+                $code=substr($code, 0, -1);
181
+                $code.="\n\t);";
182 182
                 return $code;
183 183
         }
184 184
 
185 185
         private function _buildSmartToString($tableInfo)
186 186
         {
187
-                $code = "\tpublic function __toString() {";
188
-                $property = "throw new THttpException(500, 'Not implemented yet.');";
187
+                $code="\tpublic function __toString() {";
188
+                $property="throw new THttpException(500, 'Not implemented yet.');";
189 189
                 try
190 190
                 {
191
-                        foreach ($tableInfo->getColumns() as $column)
191
+                        foreach($tableInfo->getColumns() as $column)
192 192
                         {
193
-                                if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
195
-                                elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
193
+                                if(isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
+                                        $property=str_replace($this->uqChars, "", $column->ColumnName);
195
+                                elseif($column->PdoType==PDO::PARAM_STR && $column->DBType!="date")
196 196
                                 {
197
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
197
+                                        $property=str_replace($this->uqChars, "", $column->ColumnName);
198 198
                                         break;
199 199
                                 }
200 200
                         }
201
-                } catch (Exception $ex)
201
+                } catch(Exception $ex)
202 202
                 {
203 203
                         Prado::trace($ex->getMessage());
204 204
                 }
205
-                $code .= "\n\t\treturn \$this->$property;";
206
-                $code .= "\n\t}";
205
+                $code.="\n\t\treturn \$this->$property;";
206
+                $code.="\n\t}";
207 207
                 return $code;
208 208
         }
209 209
 
210 210
         protected function generateClass($properties, $tablename, $classname, $toString)
211 211
         {
212
-                $props = implode("\n", $properties);
213
-                $relations = $this->_renderRelations($tablename);
214
-                $date = date('Y-m-d h:i:s');
215
-                $env_user = getenv("username");
212
+                $props=implode("\n", $properties);
213
+                $relations=$this->_renderRelations($tablename);
214
+                $date=date('Y-m-d h:i:s');
215
+                $env_user=getenv("username");
216 216
                 return <<<EOD
217 217
 <?php
218 218
 /**
Please login to merge, or discard this patch.
framework/Wsat/TWsatScaffoldingGenerator.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -44,6 +44,10 @@  discard block
 block discarded – undo
44 44
 
45 45
     //---------------------------------------------------------------------
46 46
     // <editor-fold defaultstate="collapsed" desc="Page Generation">
47
+
48
+    /**
49
+     * @param integer $viewType
50
+     */
47 51
     public function generate($tableName, $viewType)
48 52
     {
49 53
         switch ($viewType)
@@ -141,6 +145,10 @@  discard block
 block discarded – undo
141 145
 // </editor-fold>
142 146
     //---------------------------------------------------------------------
143 147
     // <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
148
+
149
+    /**
150
+     * @param string $classname
151
+     */
144 152
     private function generateClass($classname)
145 153
     {
146 154
         $date = date('Y-m-d h:i:s');
Please login to merge, or discard this patch.
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -14,138 +14,138 @@  discard block
 block discarded – undo
14 14
 class TWsatScaffoldingGenerator extends TWsatBaseGenerator
15 15
 {
16 16
 
17
-    /**
18
-     * Const View Types for generation
19
-     */
20
-    const LIST_TYPE = 0;
21
-    const ADD_TYPE = 1;
22
-    const SHOW_TYPE = 2;
23
-
24
-    /**
25
-     * Bootstrap option
26
-     */
27
-    private $_bootstrap;
28
-
29
-    function __construct()
30
-    {
31
-        parent::__construct();
32
-    }
33
-
34
-    /**
35
-     * Generates CRUD Operations for a single DB table
36
-     * @param type $tableName
37
-     */
38
-    public function generateCRUD($tableName)
39
-    {
40
-        $this->generate($tableName, self::ADD_TYPE);
41
-        $this->generate($tableName, self::LIST_TYPE);
42
-        $this->generate($tableName, self::SHOW_TYPE);
43
-    }
44
-
45
-    //---------------------------------------------------------------------
46
-    // <editor-fold defaultstate="collapsed" desc="Page Generation">
47
-    public function generate($tableName, $viewType)
48
-    {
49
-        switch ($viewType)
50
-        {
51
-            default:
52
-            case self::LIST_TYPE:
53
-                $unitName = "list" . ucfirst($tableName);
54
-                break;
55
-
56
-            case self::ADD_TYPE:
57
-                $unitName = "add" . ucfirst($tableName);
58
-                break;
59
-
60
-            case self::SHOW_TYPE:
61
-                $unitName = "show" . ucfirst($tableName);
62
-                break;
63
-        }
64
-
65
-        $class = $this->generateClass($unitName);
66
-        $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php";
67
-        file_put_contents($outputClass, $class);
68
-
69
-        $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page";
70
-        $page = $this->generatePage($tableName, $viewType);
71
-        file_put_contents($outputPage, $page);
72
-    }
73
-
74
-    private function generatePage($tableName, $type, $tContentId = "Content")
75
-    {
76
-        $pageContent = $this->getPageContent($tableName, $type);
77
-        return <<<EOD
17
+	/**
18
+	 * Const View Types for generation
19
+	 */
20
+	const LIST_TYPE = 0;
21
+	const ADD_TYPE = 1;
22
+	const SHOW_TYPE = 2;
23
+
24
+	/**
25
+	 * Bootstrap option
26
+	 */
27
+	private $_bootstrap;
28
+
29
+	function __construct()
30
+	{
31
+		parent::__construct();
32
+	}
33
+
34
+	/**
35
+	 * Generates CRUD Operations for a single DB table
36
+	 * @param type $tableName
37
+	 */
38
+	public function generateCRUD($tableName)
39
+	{
40
+		$this->generate($tableName, self::ADD_TYPE);
41
+		$this->generate($tableName, self::LIST_TYPE);
42
+		$this->generate($tableName, self::SHOW_TYPE);
43
+	}
44
+
45
+	//---------------------------------------------------------------------
46
+	// <editor-fold defaultstate="collapsed" desc="Page Generation">
47
+	public function generate($tableName, $viewType)
48
+	{
49
+		switch ($viewType)
50
+		{
51
+			default:
52
+			case self::LIST_TYPE:
53
+				$unitName = "list" . ucfirst($tableName);
54
+				break;
55
+
56
+			case self::ADD_TYPE:
57
+				$unitName = "add" . ucfirst($tableName);
58
+				break;
59
+
60
+			case self::SHOW_TYPE:
61
+				$unitName = "show" . ucfirst($tableName);
62
+				break;
63
+		}
64
+
65
+		$class = $this->generateClass($unitName);
66
+		$outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php";
67
+		file_put_contents($outputClass, $class);
68
+
69
+		$outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page";
70
+		$page = $this->generatePage($tableName, $viewType);
71
+		file_put_contents($outputPage, $page);
72
+	}
73
+
74
+	private function generatePage($tableName, $type, $tContentId = "Content")
75
+	{
76
+		$pageContent = $this->getPageContent($tableName, $type);
77
+		return <<<EOD
78 78
 <com:TContent ID="$tContentId">   
79 79
                      
80 80
        $pageContent
81 81
                
82 82
 </com:TContent>
83 83
 EOD;
84
-    }
85
-
86
-    private function getPageContent($tableName, $type)
87
-    {
88
-        $code = "";
89
-        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
90
-        switch ($type)
91
-        {
92
-            case self::LIST_TYPE:
93
-                break;
94
-            case self::ADD_TYPE:
95
-                foreach ($tableInfo->getColumns() as $colField => $colMetadata)
96
-                {
97
-                    if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
98
-                    {
99
-                        $code .= $this->generateControl($colMetadata);
100
-                        $code .= $this->generateValidators($colMetadata);
101
-                        $code .= "\n";
102
-                    }
103
-                }
104
-                foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata)
105
-                {
106
-                    $colField = $this->eq($colMetadata["table"]);
107
-                    $code .= "\t<com:TTextBox ID=$colField />\n";
108
-                    $code .= "\n";
109
-                    //  TWsatBaseGenerator::pr($tableInfo);
110
-                }
111
-                $code .= "\t<com:TButton Text=\"Accept\" />\n";
112
-
113
-            case self::SHOW_TYPE:
114
-                break;
115
-        }
116
-        return $code;
117
-    }
118
-
119
-    private function generateControl($colMetadata)
120
-    {
121
-        $controlType = "TTextBox";
122
-        switch ($colMetadata->DbType)
123
-        {
84
+	}
85
+
86
+	private function getPageContent($tableName, $type)
87
+	{
88
+		$code = "";
89
+		$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
90
+		switch ($type)
91
+		{
92
+			case self::LIST_TYPE:
93
+				break;
94
+			case self::ADD_TYPE:
95
+				foreach ($tableInfo->getColumns() as $colField => $colMetadata)
96
+				{
97
+					if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
98
+					{
99
+						$code .= $this->generateControl($colMetadata);
100
+						$code .= $this->generateValidators($colMetadata);
101
+						$code .= "\n";
102
+					}
103
+				}
104
+				foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata)
105
+				{
106
+					$colField = $this->eq($colMetadata["table"]);
107
+					$code .= "\t<com:TTextBox ID=$colField />\n";
108
+					$code .= "\n";
109
+					//  TWsatBaseGenerator::pr($tableInfo);
110
+				}
111
+				$code .= "\t<com:TButton Text=\"Accept\" />\n";
112
+
113
+			case self::SHOW_TYPE:
114
+				break;
115
+		}
116
+		return $code;
117
+	}
118
+
119
+	private function generateControl($colMetadata)
120
+	{
121
+		$controlType = "TTextBox";
122
+		switch ($colMetadata->DbType)
123
+		{
124 124
             
125
-        }
126
-        $controlId = $colMetadata->ColumnId;
127
-        return "\t<com:$controlType ID=\"$controlId\" />\n";
128
-    }
129
-
130
-    private function generateValidators($colMetadata)
131
-    {
132
-        $controlId = $colMetadata->ColumnId;
133
-        $code = "";
134
-        if (!$colMetadata->AllowNull)
135
-        {
136
-            $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
137
-        }
138
-        return $code;
139
-    }
125
+		}
126
+		$controlId = $colMetadata->ColumnId;
127
+		return "\t<com:$controlType ID=\"$controlId\" />\n";
128
+	}
129
+
130
+	private function generateValidators($colMetadata)
131
+	{
132
+		$controlId = $colMetadata->ColumnId;
133
+		$code = "";
134
+		if (!$colMetadata->AllowNull)
135
+		{
136
+			$code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
137
+		}
138
+		return $code;
139
+	}
140 140
 
141 141
 // </editor-fold>
142
-    //---------------------------------------------------------------------
143
-    // <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
144
-    private function generateClass($classname)
145
-    {
146
-        $date = date('Y-m-d h:i:s');
147
-        $env_user = getenv("username");
148
-        return <<<EOD
142
+	//---------------------------------------------------------------------
143
+	// <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
144
+	private function generateClass($classname)
145
+	{
146
+		$date = date('Y-m-d h:i:s');
147
+		$env_user = getenv("username");
148
+		return <<<EOD
149 149
 <?php
150 150
 /**
151 151
  * Auto generated by PRADO - WSAT on $date.
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 }
158 158
 EOD;
159
-    }
159
+	}
160 160
 
161 161
 // </editor-fold>
162 162
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * Const View Types for generation
19 19
      */
20
-    const LIST_TYPE = 0;
21
-    const ADD_TYPE = 1;
22
-    const SHOW_TYPE = 2;
20
+    const LIST_TYPE=0;
21
+    const ADD_TYPE=1;
22
+    const SHOW_TYPE=2;
23 23
 
24 24
     /**
25 25
      * Bootstrap option
@@ -46,34 +46,34 @@  discard block
 block discarded – undo
46 46
     // <editor-fold defaultstate="collapsed" desc="Page Generation">
47 47
     public function generate($tableName, $viewType)
48 48
     {
49
-        switch ($viewType)
49
+        switch($viewType)
50 50
         {
51 51
             default:
52 52
             case self::LIST_TYPE:
53
-                $unitName = "list" . ucfirst($tableName);
53
+                $unitName="list".ucfirst($tableName);
54 54
                 break;
55 55
 
56 56
             case self::ADD_TYPE:
57
-                $unitName = "add" . ucfirst($tableName);
57
+                $unitName="add".ucfirst($tableName);
58 58
                 break;
59 59
 
60 60
             case self::SHOW_TYPE:
61
-                $unitName = "show" . ucfirst($tableName);
61
+                $unitName="show".ucfirst($tableName);
62 62
                 break;
63 63
         }
64 64
 
65
-        $class = $this->generateClass($unitName);
66
-        $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php";
65
+        $class=$this->generateClass($unitName);
66
+        $outputClass=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".php";
67 67
         file_put_contents($outputClass, $class);
68 68
 
69
-        $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page";
70
-        $page = $this->generatePage($tableName, $viewType);
69
+        $outputPage=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".page";
70
+        $page=$this->generatePage($tableName, $viewType);
71 71
         file_put_contents($outputPage, $page);
72 72
     }
73 73
 
74
-    private function generatePage($tableName, $type, $tContentId = "Content")
74
+    private function generatePage($tableName, $type, $tContentId="Content")
75 75
     {
76
-        $pageContent = $this->getPageContent($tableName, $type);
76
+        $pageContent=$this->getPageContent($tableName, $type);
77 77
         return <<<EOD
78 78
 <com:TContent ID="$tContentId">   
79 79
                      
@@ -85,30 +85,30 @@  discard block
 block discarded – undo
85 85
 
86 86
     private function getPageContent($tableName, $type)
87 87
     {
88
-        $code = "";
89
-        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
90
-        switch ($type)
88
+        $code="";
89
+        $tableInfo=$this->_dbMetaData->getTableInfo($tableName);
90
+        switch($type)
91 91
         {
92 92
             case self::LIST_TYPE:
93 93
                 break;
94 94
             case self::ADD_TYPE:
95
-                foreach ($tableInfo->getColumns() as $colField => $colMetadata)
95
+                foreach($tableInfo->getColumns() as $colField => $colMetadata)
96 96
                 {
97
-                    if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
97
+                    if(!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
98 98
                     {
99
-                        $code .= $this->generateControl($colMetadata);
100
-                        $code .= $this->generateValidators($colMetadata);
101
-                        $code .= "\n";
99
+                        $code.=$this->generateControl($colMetadata);
100
+                        $code.=$this->generateValidators($colMetadata);
101
+                        $code.="\n";
102 102
                     }
103 103
                 }
104
-                foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata)
104
+                foreach($tableInfo->getForeignKeys() as $colField => $colMetadata)
105 105
                 {
106
-                    $colField = $this->eq($colMetadata["table"]);
107
-                    $code .= "\t<com:TTextBox ID=$colField />\n";
108
-                    $code .= "\n";
106
+                    $colField=$this->eq($colMetadata["table"]);
107
+                    $code.="\t<com:TTextBox ID=$colField />\n";
108
+                    $code.="\n";
109 109
                     //  TWsatBaseGenerator::pr($tableInfo);
110 110
                 }
111
-                $code .= "\t<com:TButton Text=\"Accept\" />\n";
111
+                $code.="\t<com:TButton Text=\"Accept\" />\n";
112 112
 
113 113
             case self::SHOW_TYPE:
114 114
                 break;
@@ -118,22 +118,22 @@  discard block
 block discarded – undo
118 118
 
119 119
     private function generateControl($colMetadata)
120 120
     {
121
-        $controlType = "TTextBox";
122
-        switch ($colMetadata->DbType)
121
+        $controlType="TTextBox";
122
+        switch($colMetadata->DbType)
123 123
         {
124 124
             
125 125
         }
126
-        $controlId = $colMetadata->ColumnId;
126
+        $controlId=$colMetadata->ColumnId;
127 127
         return "\t<com:$controlType ID=\"$controlId\" />\n";
128 128
     }
129 129
 
130 130
     private function generateValidators($colMetadata)
131 131
     {
132
-        $controlId = $colMetadata->ColumnId;
133
-        $code = "";
134
-        if (!$colMetadata->AllowNull)
132
+        $controlId=$colMetadata->ColumnId;
133
+        $code="";
134
+        if(!$colMetadata->AllowNull)
135 135
         {
136
-            $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
136
+            $code.="\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
137 137
         }
138 138
         return $code;
139 139
     }
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
     // <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
144 144
     private function generateClass($classname)
145 145
     {
146
-        $date = date('Y-m-d h:i:s');
147
-        $env_user = getenv("username");
146
+        $date=date('Y-m-d h:i:s');
147
+        $env_user=getenv("username");
148 148
         return <<<EOD
149 149
 <?php
150 150
 /**
Please login to merge, or discard this patch.
framework/Security/TAuthManager.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -289,7 +289,7 @@
 block discarded – undo
289 289
 
290 290
 		// check for authentication expiration
291 291
 		$isAuthExpired = $this->_authExpire>0 && !$user->getIsGuest() &&
292
-        ($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime<time();
292
+		($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime<time();
293 293
 
294 294
 		// try authenticating through cookie if possible
295 295
 		if($this->getAllowAutoLogin() && ($user->getIsGuest() || $isAuthExpired))
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 		if(is_string($this->_userManager))
95 95
 		{
96 96
 			if(($users=$application->getModule($this->_userManager))===null)
97
-				throw new TConfigurationException('authmanager_usermanager_inexistent',$this->_userManager);
97
+				throw new TConfigurationException('authmanager_usermanager_inexistent', $this->_userManager);
98 98
 			if(!($users instanceof IUserManager))
99
-				throw new TConfigurationException('authmanager_usermanager_invalid',$this->_userManager);
99
+				throw new TConfigurationException('authmanager_usermanager_invalid', $this->_userManager);
100 100
 			$this->_userManager=$users;
101 101
 		}
102
-		$application->attachEventHandler('OnAuthentication',array($this,'doAuthentication'));
103
-		$application->attachEventHandler('OnEndRequest',array($this,'leave'));
104
-		$application->attachEventHandler('OnAuthorization',array($this,'doAuthorization'));
102
+		$application->attachEventHandler('OnAuthentication', array($this, 'doAuthentication'));
103
+		$application->attachEventHandler('OnEndRequest', array($this, 'leave'));
104
+		$application->attachEventHandler('OnAuthorization', array($this, 'doAuthorization'));
105 105
 		$this->_initialized=true;
106 106
 	}
107 107
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		if($this->_initialized)
123 123
 			throw new TInvalidOperationException('authmanager_usermanager_unchangeable');
124 124
 		if(!is_string($provider) && !($provider instanceof IUserManager))
125
-			throw new TConfigurationException('authmanager_usermanager_invalid',$this->_userManager);
125
+			throw new TConfigurationException('authmanager_usermanager_invalid', $this->_userManager);
126 126
 		$this->_userManager=$provider;
127 127
 	}
128 128
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param mixed sender of the Authentication event
153 153
 	 * @param mixed event parameter
154 154
 	 */
155
-	public function doAuthentication($sender,$param)
155
+	public function doAuthentication($sender, $param)
156 156
 	{
157 157
 		$this->onAuthenticate($param);
158 158
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param mixed sender of the Authorization event
169 169
 	 * @param mixed event parameter
170 170
 	 */
171
-	public function doAuthorization($sender,$param)
171
+	public function doAuthorization($sender, $param)
172 172
 	{
173 173
 		if(!$this->_skipAuthorization)
174 174
 		{
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @param mixed sender of the event
184 184
 	 * @param mixed event parameter
185 185
 	 */
186
-	public function leave($sender,$param)
186
+	public function leave($sender, $param)
187 187
 	{
188 188
 		$application=$this->getApplication();
189 189
 		if($application->getResponse()->getStatusCode()===401)
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function setReturnUrl($value)
231 231
 	{
232
-		$this->getSession()->add($this->getReturnUrlVarName(),$value);
232
+		$this->getSession()->add($this->getReturnUrlVarName(), $value);
233 233
 	}
234 234
 
235 235
 	/**
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 		$user=$this->_userManager->getUser(null)->loadFromString($sessionInfo);
289 289
 
290 290
 		// check for authentication expiration
291
-		$isAuthExpired = $this->_authExpire>0 && !$user->getIsGuest() &&
292
-        ($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime<time();
291
+		$isAuthExpired=$this->_authExpire > 0 && !$user->getIsGuest() &&
292
+        ($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime < time();
293 293
 
294 294
 		// try authenticating through cookie if possible
295 295
 		if($this->getAllowAutoLogin() && ($user->getIsGuest() || $isAuthExpired))
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 					$user=$user2;
303 303
 					$this->updateSessionUser($user);
304 304
 					// user is restored from cookie, auth may not expire
305
-					$isAuthExpired = false;
305
+					$isAuthExpired=false;
306 306
 				}
307 307
 			}
308 308
 		}
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
 		// event handler gets a chance to do further auth work
319 319
 		if($this->hasEventHandler('OnAuthenticate'))
320
-			$this->raiseEvent('OnAuthenticate',$this,$application);
320
+			$this->raiseEvent('OnAuthenticate', $this, $application);
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	{
330 330
 		$this->logout();
331 331
 		if($this->hasEventHandler('OnAuthExpire'))
332
-			$this->raiseEvent('OnAuthExpire',$this,$param);
332
+			$this->raiseEvent('OnAuthExpire', $this, $param);
333 333
 	}
334 334
 
335 335
 	/**
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 	{
344 344
 		$application=$this->getApplication();
345 345
 		if($this->hasEventHandler('OnAuthorize'))
346
-			$this->raiseEvent('OnAuthorize',$this,$application);
347
-		if(!$application->getAuthorizationRules()->isUserAllowed($application->getUser(),$application->getRequest()->getRequestType(),$application->getRequest()->getUserHostAddress()))
346
+			$this->raiseEvent('OnAuthorize', $this, $application);
347
+		if(!$application->getAuthorizationRules()->isUserAllowed($application->getUser(), $application->getRequest()->getRequestType(), $application->getRequest()->getUserHostAddress()))
348 348
 		{
349 349
 			$application->getResponse()->setStatusCode(401);
350 350
 			$application->completeRequest();
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			if(($session=$this->getSession())===null)
384 384
 				throw new TConfigurationException('authmanager_session_required');
385 385
 			else
386
-				$session->add($this->getUserKey(),$user->saveToString());
386
+				$session->add($this->getUserKey(), $user->saveToString());
387 387
 		}
388 388
 	}
389 389
 
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 	 * @param integer number of seconds that automatic login will remain effective. If 0, it means user logs out when session ends. This parameter is added since 3.1.1.
412 412
 	 * @return boolean if login is successful
413 413
 	 */
414
-	public function login($username,$password,$expire=0)
414
+	public function login($username, $password, $expire=0)
415 415
 	{
416
-		if($this->_userManager->validateUser($username,$password))
416
+		if($this->_userManager->validateUser($username, $password))
417 417
 		{
418 418
 			if(($user=$this->_userManager->getUser($username))===null)
419 419
 				return false;
420 420
 			$this->updateSessionUser($user);
421 421
 			$this->getApplication()->setUser($user);
422 422
 
423
-			if($expire>0)
423
+			if($expire > 0)
424 424
 			{
425
-				$cookie=new THttpCookie($this->getUserKey(),'');
426
-				$cookie->setExpire(time()+$expire);
425
+				$cookie=new THttpCookie($this->getUserKey(), '');
426
+				$cookie->setExpire(time() + $expire);
427 427
 				$this->_userManager->saveUserToCookie($cookie);
428 428
 				$this->getResponse()->getCookies()->add($cookie);
429 429
 			}
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 		$session->destroy();
447 447
 		if($this->getAllowAutoLogin())
448 448
 		{
449
-			$cookie=new THttpCookie($this->getUserKey(),'');
449
+			$cookie=new THttpCookie($this->getUserKey(), '');
450 450
 			$this->getResponse()->getCookies()->add($cookie);
451 451
 		}
452 452
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -228,6 +228,7 @@  discard block
 block discarded – undo
228 228
 	/**
229 229
 	 * Sets the URL that the browser should be redirected to when login succeeds.
230 230
 	 * @param string the URL to be redirected to.
231
+	 * @param string $value
231 232
 	 */
232 233
 	public function setReturnUrl($value)
233 234
 	{
@@ -376,6 +377,7 @@  discard block
 block discarded – undo
376 377
 	/**
377 378
 	 * Updates the user data stored in session.
378 379
 	 * @param IUser user object
380
+	 * @param TUser $user
379 381
 	 * @throws new TConfigurationException if session module is not loaded.
380 382
 	 */
381 383
 	public function updateSessionUser($user)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -430,8 +430,7 @@
 block discarded – undo
430 430
 				$this->getResponse()->getCookies()->add($cookie);
431 431
 			}
432 432
 			return true;
433
-		}
434
-		else
433
+		} else
435 434
 			return false;
436 435
 	}
437 436
 
Please login to merge, or discard this patch.
framework/I18N/core/DateFormat.php 4 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
 	/**
81 81
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
82
- 	 * @var DateTimeFormatInfo
82
+	 * @var DateTimeFormatInfo
83 83
 	 */
84 84
 	protected $formatInfo;
85 85
 
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 
309 309
 	/**
310 310
 	 * Get the year.
311
- 	 * "yy" will return the last two digits of year.
312
- 	 * "yyyy" will return the full integer year.
311
+	 * "yy" will return the last two digits of year.
312
+	 * "yyyy" will return the full integer year.
313 313
 	 * @param array getdate format.
314 314
 	 * @param string a pattern.
315 315
 	 * @return string year
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 
331 331
 	/**
332 332
 	 * Get the month.
333
- 	 * "M" will return integer 1 through 12
334
- 	 * "MM" will return the narrow month name, e.g. "J"
335
- 	 * "MMM" will return the abrreviated month name, e.g. "Jan"
336
- 	 * "MMMM" will return the month name, e.g. "January"
333
+	 * "M" will return integer 1 through 12
334
+	 * "MM" will return the narrow month name, e.g. "J"
335
+	 * "MMM" will return the abrreviated month name, e.g. "Jan"
336
+	 * "MMMM" will return the month name, e.g. "January"
337 337
 	 * @param array getdate format.
338 338
 	 * @param string a pattern.
339 339
 	 * @return string month name
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 
362 362
 	/**
363 363
 	 * Get the day of the week.
364
- 	 * "E" will return integer 0 (for Sunday) through 6 (for Saturday).
365
- 	 * "EE" will return the narrow day of the week, e.g. "M"
366
- 	 * "EEE" will return the abrreviated day of the week, e.g. "Mon"
367
- 	 * "EEEE" will return the day of the week, e.g. "Monday"
364
+	 * "E" will return integer 0 (for Sunday) through 6 (for Saturday).
365
+	 * "EE" will return the narrow day of the week, e.g. "M"
366
+	 * "EEE" will return the abrreviated day of the week, e.g. "Mon"
367
+	 * "EEEE" will return the day of the week, e.g. "Monday"
368 368
 	 * @param array getdate format.
369 369
 	 * @param string a pattern.
370 370
 	 * @return string day of the week.
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
 	/**
396 396
 	 * Get the day of the month.
397
- 	 * "d" for non-padding, "dd" will always return 2 characters.
397
+	 * "d" for non-padding, "dd" will always return 2 characters.
398 398
 	 * @param array getdate format.
399 399
 	 * @param string a pattern.
400 400
 	 * @return string day of the month
@@ -581,14 +581,14 @@  discard block
 block discarded – undo
581 581
 	protected function getDayInMonth($date, $pattern='FF')
582 582
 	{
583 583
 		switch ($pattern) {
584
-		    case 'F':
585
-		      return @date('j', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
586
-		      break;
587
-		    case 'FF':
588
-		      return @date('d', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
589
-		      break;
590
-		    default:
591
-		      throw new Exception('The pattern for day in month is "F" or "FF".');
584
+			case 'F':
585
+			  return @date('j', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
586
+			  break;
587
+			case 'FF':
588
+			  return @date('d', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
589
+			  break;
590
+			default:
591
+			  throw new Exception('The pattern for day in month is "F" or "FF".');
592 592
 		}
593 593
 	}
594 594
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -87,6 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * Initialize a new DateFormat.
88 88
 	 * @param mixed either, null, a CultureInfo instance,
89 89
 	 * a DateTimeFormatInfo instance, or a locale.
90
+	 * @param string $formatInfo
90 91
 	 * @return DateFormat instance
91 92
 	 */
92 93
 	function __construct($formatInfo=null)
@@ -106,6 +107,7 @@  discard block
 block discarded – undo
106 107
 	/**
107 108
 	 * Format a date according to the pattern.
108 109
 	 * @param mixed the time as integer or string in strtotime format.
110
+	 * @param string $time
109 111
 	 * @return string formatted date time.
110 112
 	 */
111 113
 	public function format($time, $pattern='F', $charset='UTF-8')
@@ -179,6 +181,7 @@  discard block
 block discarded – undo
179 181
 	 * DateTimeFormatInfo::formatDateTime
180 182
 	 * See the tutorial documentation for futher details on the patterns.
181 183
 	 * @param mixed a pattern.
184
+	 * @param string $pattern
182 185
 	 * @return string a pattern.
183 186
 	 * @see DateTimeFormatInfo::formatDateTime()
184 187
 	 */
@@ -269,6 +272,7 @@  discard block
 block discarded – undo
269 272
 	 * Any substrings, starting and ending with a single quote (')
270 273
 	 * will be treated as a single token.
271 274
 	 * @param string pattern.
275
+	 * @param string $pattern
272 276
 	 * @return array string tokens in an array.
273 277
 	 */
274 278
 	protected function getTokens($pattern)
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -134,12 +134,10 @@  discard block
 block discarded – undo
134 134
 			{
135 135
 				$sub = preg_replace('/(^\')|(\'$)/','',$pattern);
136 136
 				$tokens[$i] =  str_replace('``````','\'',$sub);
137
-			}
138
-			else if($pattern == '``````')
137
+			} else if($pattern == '``````')
139 138
 			{
140 139
 				$tokens[$i] = '\'';
141
-			}
142
-			else
140
+			} else
143 141
 			{
144 142
 				$function = $this->getFunctionName($pattern);
145 143
 				if($function != null)
@@ -149,8 +147,7 @@  discard block
 block discarded – undo
149 147
 					{
150 148
 						$rs = $this->$fName($date, $pattern);
151 149
 						$tokens[$i] = $rs;
152
-					}
153
-					else
150
+					} else
154 151
 						throw new
155 152
 						Exception('function '.$function.' not found.');
156 153
 				}
@@ -285,8 +282,7 @@  discard block
 block discarded – undo
285 282
 			if($char==null || $pattern{$i} == $char || $text)
286 283
 			{
287 284
 				$token .= $pattern{$i};
288
-			}
289
-			else
285
+			} else
290 286
 			{
291 287
 				$tokens[] = str_replace("","'",$token);
292 288
 				$token = $pattern{$i};
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * A list of tokens and their function call.
52 52
 	 * @var array
53 53
 	 */
54
-	protected $tokens = array(
54
+	protected $tokens=array(
55 55
 			'G'=>'Era',
56 56
 			'y'=>'Year',
57 57
 			'M'=>'Month',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * A list of methods, to be used by the token function calls.
76 76
 	 * @var array
77 77
 	 */
78
-	protected $methods = array();
78
+	protected $methods=array();
79 79
 
80 80
 	/**
81 81
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	function __construct($formatInfo=null)
93 93
 	{
94
-		if($formatInfo === null)
95
-			$this->formatInfo = DateTimeFormatInfo::getInvariantInfo();
94
+		if($formatInfo===null)
95
+			$this->formatInfo=DateTimeFormatInfo::getInvariantInfo();
96 96
 		else if($formatInfo instanceof CultureInfo)
97
-			$this->formatInfo = $formatInfo->DateTimeFormat;
97
+			$this->formatInfo=$formatInfo->DateTimeFormat;
98 98
 		else if($formatInfo instanceof DateTimeFormatInfo)
99
-			$this->formatInfo = $formatInfo;
99
+			$this->formatInfo=$formatInfo;
100 100
 		else
101
-			$this->formatInfo = DateTimeFormatInfo::getInstance($formatInfo);
101
+			$this->formatInfo=DateTimeFormatInfo::getInstance($formatInfo);
102 102
 
103
-		$this->methods = get_class_methods($this);
103
+		$this->methods=get_class_methods($this);
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,45 +110,45 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function format($time, $pattern='F', $charset='UTF-8')
112 112
 	{
113
-		if (is_numeric($time)) //assumes unix epoch
114
-			$time = floatval($time);
113
+		if(is_numeric($time)) //assumes unix epoch
114
+			$time=floatval($time);
115 115
 		else if(is_string($time))
116
-			$time = @strtotime($time);
116
+			$time=@strtotime($time);
117 117
 
118
-		if($pattern === null)
119
-			$pattern = 'F';
118
+		if($pattern===null)
119
+			$pattern='F';
120 120
 
121
-		$s = Prado::createComponent('System.Util.TDateTimeStamp');
121
+		$s=Prado::createComponent('System.Util.TDateTimeStamp');
122 122
 
123
-		$date = $s->getDate($time);
123
+		$date=$s->getDate($time);
124 124
 
125
-		$pattern = $this->getPattern($pattern);
125
+		$pattern=$this->getPattern($pattern);
126 126
 
127
-		$tokens = $this->getTokens($pattern);
127
+		$tokens=$this->getTokens($pattern);
128 128
 
129
-		for($i = 0, $k = count($tokens); $i<$k; ++$i)
129
+		for($i=0, $k=count($tokens); $i < $k; ++$i)
130 130
 		{
131
-			$pattern = $tokens[$i];
132
-			if($pattern{0} == "'"
133
-				&& $pattern{strlen($pattern)-1} == "'")
131
+			$pattern=$tokens[$i];
132
+			if($pattern{0}=="'"
133
+				&& $pattern{strlen($pattern) - 1}=="'")
134 134
 			{
135
-				$sub = preg_replace('/(^\')|(\'$)/','',$pattern);
136
-				$tokens[$i] =  str_replace('``````','\'',$sub);
135
+				$sub=preg_replace('/(^\')|(\'$)/', '', $pattern);
136
+				$tokens[$i]=str_replace('``````', '\'', $sub);
137 137
 			}
138
-			else if($pattern == '``````')
138
+			else if($pattern=='``````')
139 139
 			{
140
-				$tokens[$i] = '\'';
140
+				$tokens[$i]='\'';
141 141
 			}
142 142
 			else
143 143
 			{
144
-				$function = $this->getFunctionName($pattern);
145
-				if($function != null)
144
+				$function=$this->getFunctionName($pattern);
145
+				if($function!=null)
146 146
 				{
147
-					$fName = 'get'.$function;
147
+					$fName='get'.$function;
148 148
 					if(in_array($fName, $this->methods))
149 149
 					{
150
-						$rs = $this->$fName($date, $pattern);
151
-						$tokens[$i] = $rs;
150
+						$rs=$this->$fName($date, $pattern);
151
+						$tokens[$i]=$rs;
152 152
 					}
153 153
 					else
154 154
 						throw new
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			}			
158 158
 		}
159 159
 
160
-		return I18N_toEncoding(implode('',$tokens), $charset);
160
+		return I18N_toEncoding(implode('', $tokens), $charset);
161 161
 	}
162 162
 
163 163
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function getPattern($pattern)
186 186
 	{
187
-		if(is_array($pattern) && count($pattern) == 2)
187
+		if(is_array($pattern) && count($pattern)==2)
188 188
 		{
189 189
 			return $this->formatInfo->formatDateTime(
190 190
 							$this->getPattern($pattern[0]),
@@ -273,36 +273,36 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	protected function getTokens($pattern)
275 275
 	{
276
-		$char = null;
277
-		$tokens = array();
278
-		$token = null;
276
+		$char=null;
277
+		$tokens=array();
278
+		$token=null;
279 279
 
280
-		$text = false;
281
-		$pattern = preg_replace("/''/", '``````', $pattern);
280
+		$text=false;
281
+		$pattern=preg_replace("/''/", '``````', $pattern);
282 282
 
283
-		for($i = 0; $i < strlen($pattern); $i++)
283
+		for($i=0; $i < strlen($pattern); $i++)
284 284
 		{
285
-			if($char==null || $pattern{$i} == $char || $text)
285
+			if($char==null || $pattern{$i}==$char || $text)
286 286
 			{
287
-				$token .= $pattern{$i};
287
+				$token.=$pattern{$i};
288 288
 			}
289 289
 			else
290 290
 			{
291
-				$tokens[] = str_replace("","'",$token);
292
-				$token = $pattern{$i};
291
+				$tokens[]=str_replace("", "'", $token);
292
+				$token=$pattern{$i};
293 293
 			}
294 294
 
295
-			if($pattern{$i} == "'" && $text == false)
296
-				$text = true;
297
-			else if($text && $pattern{$i} == "'" && $char == "'")
298
-				$text = true;
299
-			else if($text && $char != "'" && $pattern{$i} == "'")
300
-				$text = false;
295
+			if($pattern{$i}=="'" && $text==false)
296
+				$text=true;
297
+			else if($text && $pattern{$i}=="'" && $char=="'")
298
+				$text=true;
299
+			else if($text && $char!="'" && $pattern{$i}=="'")
300
+				$text=false;
301 301
 
302
-			$char = $pattern{$i};
302
+			$char=$pattern{$i};
303 303
 
304 304
 		}
305
-		$tokens[] = $token;
305
+		$tokens[]=$token;
306 306
 		return $tokens;
307 307
 	}
308 308
 
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	protected function getYear($date, $pattern='yyyy')
318 318
 	{
319
-		$year = $date['year'];
319
+		$year=$date['year'];
320 320
 		switch($pattern)
321 321
 		{
322 322
 			case 'yy':
323
-				return substr($year,2);
323
+				return substr($year, 2);
324 324
 			case 'yyyy':
325 325
 				return $year;
326 326
 			default:
@@ -340,19 +340,19 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	protected function getMonth($date, $pattern='M')
342 342
 	{
343
-		$month = $date['mon'];
343
+		$month=$date['mon'];
344 344
 
345 345
 		switch($pattern)
346 346
 		{
347 347
 			case 'M':
348 348
 				return $month;
349 349
 			case 'MM':
350
-				return str_pad($month, 2,'0',STR_PAD_LEFT);
350
+				return str_pad($month, 2, '0', STR_PAD_LEFT);
351 351
 			case 'MMM':
352
-				return $this->formatInfo->AbbreviatedMonthNames[$month-1];
352
+				return $this->formatInfo->AbbreviatedMonthNames[$month - 1];
353 353
 				break;
354 354
 			case 'MMMM':
355
-				return $this->formatInfo->MonthNames[$month-1];
355
+				return $this->formatInfo->MonthNames[$month - 1];
356 356
 			default:
357 357
 				throw new Exception('The pattern for month '.
358 358
 						'is "M", "MM", "MMM", or "MMMM".');
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	protected function getDayInWeek($date, $pattern='EEEE')
373 373
 	{
374
-		$day = $date['wday'];
374
+		$day=$date['wday'];
375 375
 
376 376
 		switch($pattern)
377 377
 		{
@@ -401,14 +401,14 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	protected function getDay($date, $pattern='d')
403 403
 	{
404
-		$day = $date['mday'];
404
+		$day=$date['mday'];
405 405
 
406 406
 		switch($pattern)
407 407
 		{
408 408
 			case 'd':
409 409
 				return $day;
410 410
 			case 'dd':
411
-				return str_pad($day, 2,'0',STR_PAD_LEFT);
411
+				return str_pad($day, 2, '0', STR_PAD_LEFT);
412 412
 			default:
413 413
 				throw new Exception('The pattern for day of '.
414 414
 						'the month is "d" or "dd".');
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	protected function getEra($date, $pattern='G')
427 427
 	{
428 428
 
429
-		if($pattern != 'G')
429
+		if($pattern!='G')
430 430
 			throw new Exception('The pattern for era is "G".');
431 431
 
432
-		$year = $date['year'];
432
+		$year=$date['year'];
433 433
 		if($year > 0)
434 434
 			return $this->formatInfo->getEra(1);
435 435
 		else
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	protected function getHour24($date, $pattern='H')
447 447
 	{
448
-		$hour = $date['hours'];
448
+		$hour=$date['hours'];
449 449
 
450 450
 		switch($pattern)
451 451
 		{
452 452
 			case 'H':
453 453
 				return $hour;
454 454
 			case 'HH':
455
-				return str_pad($hour, 2,'0',STR_PAD_LEFT);
455
+				return str_pad($hour, 2, '0', STR_PAD_LEFT);
456 456
 			default:
457 457
 				throw new Exception('The pattern for 24 hour '.
458 458
 						'format is "H" or "HH".');
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 	 */
468 468
 	protected function getAMPM($date, $pattern='a')
469 469
 	{
470
-		if($pattern != 'a')
470
+		if($pattern!='a')
471 471
 			throw new Exception('The pattern for AM/PM marker is "a".');
472 472
 
473
-		$hour = $date['hours'];
474
-		$ampm = (int)($hour/12);
473
+		$hour=$date['hours'];
474
+		$ampm=(int) ($hour / 12);
475 475
 		return $this->formatInfo->AMPMMarkers[$ampm];
476 476
 	}
477 477
 
@@ -484,15 +484,15 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	protected function getHour12($date, $pattern='h')
486 486
 	{
487
-		$hour = $date['hours'];
488
-		$hour = ($hour==12|$hour==0)?12:($hour)%12;
487
+		$hour=$date['hours'];
488
+		$hour=($hour==12 | $hour==0) ? 12 : ($hour) % 12;
489 489
 
490 490
 		switch($pattern)
491 491
 		{
492 492
 			case 'h':
493 493
 				return $hour;
494 494
 			case 'hh':
495
-				return str_pad($hour, 2,'0',STR_PAD_LEFT);
495
+				return str_pad($hour, 2, '0', STR_PAD_LEFT);
496 496
 			default:
497 497
 				throw new Exception('The pattern for 24 hour '.
498 498
 						'format is "H" or "HH".');
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 	 */
509 509
 	protected function getMinutes($date, $pattern='m')
510 510
 	{
511
-		$minutes = $date['minutes'];
511
+		$minutes=$date['minutes'];
512 512
 
513 513
 		switch($pattern)
514 514
 		{
515 515
 			case 'm':
516 516
 				return $minutes;
517 517
 			case 'mm':
518
-				return str_pad($minutes, 2,'0',STR_PAD_LEFT);
518
+				return str_pad($minutes, 2, '0', STR_PAD_LEFT);
519 519
 			default:
520 520
 			throw new Exception('The pattern for minutes is "m" or "mm".');
521 521
 		}
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	protected function getSeconds($date, $pattern='s')
532 532
 	{
533
-		$seconds = $date['seconds'];
533
+		$seconds=$date['seconds'];
534 534
 
535 535
 		switch($pattern)
536 536
 		{
537 537
 			case 's':
538 538
 				return $seconds;
539 539
 			case 'ss':
540
-				return str_pad($seconds, 2,'0',STR_PAD_LEFT);
540
+				return str_pad($seconds, 2, '0', STR_PAD_LEFT);
541 541
 			default:
542 542
 			throw new Exception('The pattern for seconds is "s" or "ss".');
543 543
 		}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 */
553 553
 	protected function getTimeZone($date, $pattern='z')
554 554
 	{
555
-		if($pattern != 'z')
555
+		if($pattern!='z')
556 556
 			throw new Exception('The pattern for time zone is "z".');
557 557
 
558 558
 		return @date('T', @mktime($date['hours'], $date['minutes'], $date['seconds'], $date['mon'], $date['mday'], $date['year']));
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	protected function getDayInYear($date, $pattern='D')
568 568
 	{
569
-		if($pattern != 'D')
569
+		if($pattern!='D')
570 570
 			throw new Exception('The pattern for day in year is "D".');
571 571
 
572 572
 		return $date['yday'];
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	protected function getDayInMonth($date, $pattern='FF')
582 582
 	{
583
-		switch ($pattern) {
583
+		switch($pattern) {
584 584
 		    case 'F':
585 585
 		      return @date('j', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
586 586
 		      break;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	protected function getWeekInYear($date, $pattern='w')
602 602
 	{
603
-		if($pattern != 'w')
603
+		if($pattern!='w')
604 604
 			throw new Exception('The pattern for week in year is "w".');
605 605
 
606 606
 		return @date('W', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	protected function getWeekInMonth($date, $pattern='W')
615 615
 	{
616
-		if($pattern != 'W')
616
+		if($pattern!='W')
617 617
 			throw new Exception('The pattern for week in month is "W".');
618 618
 
619 619
 		return @date('W', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year'])) - date('W', mktime(0, 0, 0, $date['mon'], 1, $date['year']));
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 	 */
628 628
 	protected function getHourInDay($date, $pattern='k')
629 629
 	{
630
-		if($pattern != 'k')
630
+		if($pattern!='k')
631 631
 			throw new Exception('The pattern for hour in day is "k".');
632 632
 
633
-		return $date['hours']+1;
633
+		return $date['hours'] + 1;
634 634
 	}
635 635
 
636 636
 	/**
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	 */
642 642
 	protected function getHourInAMPM($date, $pattern='K')
643 643
 	{
644
-		if($pattern != 'K')
644
+		if($pattern!='K')
645 645
 			throw new Exception('The pattern for hour in AM/PM is "K".');
646 646
 
647
-		return ($date['hours']+1)%12;
647
+		return ($date['hours'] + 1) % 12;
648 648
 	}
649 649
 
650 650
 }
Please login to merge, or discard this patch.
framework/I18N/core/NumberFormat.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	/**
78 78
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
79
- 	 * @var DateTimeFormatInfo
79
+	 * @var DateTimeFormatInfo
80 80
 	 */
81 81
 	protected $formatInfo;
82 82
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	function format($number, $pattern='d', $currency='USD', $charset='UTF-8')
117 117
 	{
118 118
 		$oldLocale=setLocale(LC_NUMERIC, '0');
119
-	    setlocale(LC_NUMERIC, 'C');
119
+		setlocale(LC_NUMERIC, 'C');
120 120
 
121 121
 		$this->setPattern($pattern);
122 122
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,6 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * a CultureInfo or NumberFormatInfo instance will instantiated a instance
87 87
 	 * for that particular culture.
88 88
 	 * @param mixed either null, a CultureInfo, a NumberFormatInfo, or string
89
+	 * @param string $formatInfo
89 90
 	 * @return NumberFormat
90 91
 	 */
91 92
 	function __construct($formatInfo=null)
@@ -111,6 +112,7 @@  discard block
 block discarded – undo
111 112
 	 * 3 decimal places.
112 113
 	 * @param string 3-letter ISO 4217 code. For example, the code
113 114
 	 * "USD" represents the US Dollar and "EUR" represents the Euro currency.
115
+	 * @param string $number
114 116
 	 * @return string formatted number string
115 117
 	 */
116 118
 	function format($number, $pattern='d', $currency='USD', $charset='UTF-8')
@@ -232,7 +234,7 @@  discard block
 block discarded – undo
232 234
 
233 235
 	/**
234 236
 	 * Format the decimal places.
235
-	 * @param string the decimal number in string form.
237
+	 * @param string string decimal number in string form.
236 238
 	 * @return string formatted decimal places.
237 239
 	 */
238 240
 	protected function formatDecimal($string)
@@ -280,6 +282,7 @@  discard block
 block discarded – undo
280 282
 	 * Set the pattern to format against. The default patterns
281 283
 	 * are retrieved from the NumberFormatInfo instance.
282 284
 	 * @param string the requested patterns.
285
+	 * @param string $pattern
283 286
 	 * @return string a number format pattern.
284 287
 	 */
285 288
 	protected function setPattern($pattern)
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -203,16 +203,14 @@  discard block
 block discarded – undo
203 203
 						$integer = $groupSeparator . $integer;
204 204
 						$count++;
205 205
 					}
206
-				}
207
-				else if($multiGroup && $count >= 1)
206
+				} else if($multiGroup && $count >= 1)
208 207
 				{
209 208
 					if($i != 0 && ($i-$groupSize[0])%$groupSize[1] == 0)
210 209
 					{
211 210
 						$integer = $groupSeparator . $integer;
212 211
 						$count++;
213 212
 					}
214
-				}
215
-				else
213
+				} else
216 214
 				{
217 215
 					if($i != 0 && $i%$groupSize[0] == 0)
218 216
 					{
@@ -223,8 +221,7 @@  discard block
 block discarded – undo
223 221
 
224 222
 				$integer = $char . $integer;
225 223
 			}
226
-		}
227
-		else
224
+		} else
228 225
 			$integer = $string;
229 226
 
230 227
 		return $integer;
@@ -250,27 +247,23 @@  discard block
 block discarded – undo
250 247
 			if($decimalDigits == -1)
251 248
 			{
252 249
 				$decimal = substr($string, $dp+1);
253
-			}
254
-			else if(is_int($decimalDigits))
250
+			} else if(is_int($decimalDigits))
255 251
 			{
256 252
 				$float = round((float)$string, $decimalDigits);
257 253
 				if(strpos((string)$float, '.') === false)
258 254
 				{
259 255
 					$decimal = str_pad($decimal,$decimalDigits,'0');
260
-				}
261
-				else
256
+				} else
262 257
 				{
263 258
 					$decimal = substr($float, strpos($float,'.')+1);
264 259
 					if(strlen($decimal)<$decimalDigits)
265 260
 						$decimal = str_pad($decimal,$decimalDigits,'0');
266 261
 				}
267
-			}
268
-			else
262
+			} else
269 263
 				return $decimal;
270 264
 
271 265
 			return $decimalSeparator.$decimal;
272
-		}
273
-		else if ($decimalDigits > 0)
266
+		} else if ($decimalDigits > 0)
274 267
 			return $decimalSeparator.str_pad($decimal,$decimalDigits,'0');
275 268
 
276 269
 		return $decimal;
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	function __construct($formatInfo=null)
92 92
 	{
93
-		if($formatInfo === null)
94
-			$this->formatInfo = NumberFormatInfo::getInvariantInfo();
93
+		if($formatInfo===null)
94
+			$this->formatInfo=NumberFormatInfo::getInvariantInfo();
95 95
 		else if($formatInfo instanceof CultureInfo)
96
-			$this->formatInfo = $formatInfo->NumberFormat;
96
+			$this->formatInfo=$formatInfo->NumberFormat;
97 97
 		else if($formatInfo instanceof NumberFormatInfo)
98
-			$this->formatInfo = $formatInfo;
98
+			$this->formatInfo=$formatInfo;
99 99
 		else
100
-			$this->formatInfo =
100
+			$this->formatInfo=
101 101
 				NumberFormatInfo::getInstance($formatInfo);
102 102
 	}
103 103
 
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
 
121 121
 		$this->setPattern($pattern);
122 122
 
123
-		if(strtolower($pattern) == 'p')
124
-			$number = $number * 100;
123
+		if(strtolower($pattern)=='p')
124
+			$number=$number * 100;
125 125
 
126
-		$string = (string)$number;
126
+		$string=(string) $number;
127 127
 
128
-		$decimal = $this->formatDecimal($string);
129
-		$integer = $this->formatInteger(abs($number));
128
+		$decimal=$this->formatDecimal($string);
129
+		$integer=$this->formatInteger(abs($number));
130 130
 
131
-		if(strlen($decimal)>0)
132
-			$result = $integer.$decimal;
131
+		if(strlen($decimal) > 0)
132
+			$result=$integer.$decimal;
133 133
 		else
134
-			$result = $integer;
134
+			$result=$integer;
135 135
 
136 136
 		//get the suffix
137 137
 		if($number >= 0)
138
-			$suffix = $this->formatInfo->PositivePattern;
138
+			$suffix=$this->formatInfo->PositivePattern;
139 139
 		else if($number < 0)
140
-			$suffix = $this->formatInfo->NegativePattern;
140
+			$suffix=$this->formatInfo->NegativePattern;
141 141
 		else
142
-			$suffix = array("","");
142
+			$suffix=array("", "");
143 143
 
144 144
 		//append and prepend suffix
145
-		$result = $suffix[0].$result.$suffix[1];
145
+		$result=$suffix[0].$result.$suffix[1];
146 146
 
147 147
 		//replace currency sign
148
-		$symbol = @$this->formatInfo->getCurrencySymbol($currency);
149
-		if($symbol === null) {
150
-			$symbol = $currency;
148
+		$symbol=@$this->formatInfo->getCurrencySymbol($currency);
149
+		if($symbol===null) {
150
+			$symbol=$currency;
151 151
 		}
152 152
 
153
-		$result = str_replace('¤',$symbol, $result);
153
+		$result=str_replace('¤', $symbol, $result);
154 154
 
155 155
 		setlocale(LC_NUMERIC, $oldLocale);
156 156
 
@@ -164,68 +164,68 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	protected function formatInteger($string)
166 166
 	{
167
-		$string = (string)$string;
167
+		$string=(string) $string;
168 168
 
169
-		$decimalDigits = $this->formatInfo->DecimalDigits;
169
+		$decimalDigits=$this->formatInfo->DecimalDigits;
170 170
 		//if not decimal digits, assume 0 decimal points.
171 171
 		if(is_int($decimalDigits) && $decimalDigits > 0)
172
-			$string = (string)round(floatval($string),$decimalDigits);
173
-		$dp = strpos($string, '.');
172
+			$string=(string) round(floatval($string), $decimalDigits);
173
+		$dp=strpos($string, '.');
174 174
 		if(is_int($dp))
175
-			$string = substr($string, 0, $dp);
176
-		$integer = '';
175
+			$string=substr($string, 0, $dp);
176
+		$integer='';
177 177
 
178
-		$digitSize = $this->formatInfo->getDigitSize();
178
+		$digitSize=$this->formatInfo->getDigitSize();
179 179
 
180
-		$string = str_pad($string, $digitSize, '0',STR_PAD_LEFT);
180
+		$string=str_pad($string, $digitSize, '0', STR_PAD_LEFT);
181 181
 
182
-		$len = strlen($string);
182
+		$len=strlen($string);
183 183
 
184
-		$groupSeparator = $this->formatInfo->GroupSeparator;
185
-		$groupSize = $this->formatInfo->GroupSizes;
184
+		$groupSeparator=$this->formatInfo->GroupSeparator;
185
+		$groupSize=$this->formatInfo->GroupSizes;
186 186
 
187 187
 
188
-		$firstGroup = true;
189
-		$multiGroup = is_int($groupSize[1]);
190
-		$count = 0;
188
+		$firstGroup=true;
189
+		$multiGroup=is_int($groupSize[1]);
190
+		$count=0;
191 191
 
192 192
 		if(is_int($groupSize[0]))
193 193
 		{
194 194
 			//now for the integer groupings
195
-			for($i=0; $i<$len; $i++)
195
+			for($i=0; $i < $len; $i++)
196 196
 			{
197
-				$char = $string{$len-$i-1};
197
+				$char=$string{$len - $i - 1};
198 198
 
199
-				if($multiGroup && $count == 0)
199
+				if($multiGroup && $count==0)
200 200
 				{
201
-					if($i != 0 && $i%$groupSize[0] == 0)
201
+					if($i!=0 && $i % $groupSize[0]==0)
202 202
 					{
203
-						$integer = $groupSeparator . $integer;
203
+						$integer=$groupSeparator.$integer;
204 204
 						$count++;
205 205
 					}
206 206
 				}
207 207
 				else if($multiGroup && $count >= 1)
208 208
 				{
209
-					if($i != 0 && ($i-$groupSize[0])%$groupSize[1] == 0)
209
+					if($i!=0 && ($i - $groupSize[0]) % $groupSize[1]==0)
210 210
 					{
211
-						$integer = $groupSeparator . $integer;
211
+						$integer=$groupSeparator.$integer;
212 212
 						$count++;
213 213
 					}
214 214
 				}
215 215
 				else
216 216
 				{
217
-					if($i != 0 && $i%$groupSize[0] == 0)
217
+					if($i!=0 && $i % $groupSize[0]==0)
218 218
 					{
219
-						$integer = $groupSeparator . $integer;
219
+						$integer=$groupSeparator.$integer;
220 220
 						$count++;
221 221
 					}
222 222
 				}
223 223
 
224
-				$integer = $char . $integer;
224
+				$integer=$char.$integer;
225 225
 			}
226 226
 		}
227 227
 		else
228
-			$integer = $string;
228
+			$integer=$string;
229 229
 
230 230
 		return $integer;
231 231
 	}
@@ -237,32 +237,32 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	protected function formatDecimal($string)
239 239
 	{
240
-		$dp = strpos($string, '.');
241
-		$decimal = '';
240
+		$dp=strpos($string, '.');
241
+		$decimal='';
242 242
 
243
-		$decimalDigits = $this->formatInfo->DecimalDigits;
244
-		$decimalSeparator = $this->formatInfo->DecimalSeparator;
243
+		$decimalDigits=$this->formatInfo->DecimalDigits;
244
+		$decimalSeparator=$this->formatInfo->DecimalSeparator;
245 245
 
246 246
 		//do the correct rounding here
247 247
 		//$string = round(floatval($string), $decimalDigits);
248 248
 		if(is_int($dp))
249 249
 		{
250
-			if($decimalDigits == -1)
250
+			if($decimalDigits==-1)
251 251
 			{
252
-				$decimal = substr($string, $dp+1);
252
+				$decimal=substr($string, $dp + 1);
253 253
 			}
254 254
 			else if(is_int($decimalDigits))
255 255
 			{
256
-				$float = round((float)$string, $decimalDigits);
257
-				if(strpos((string)$float, '.') === false)
256
+				$float=round((float) $string, $decimalDigits);
257
+				if(strpos((string) $float, '.')===false)
258 258
 				{
259
-					$decimal = str_pad($decimal,$decimalDigits,'0');
259
+					$decimal=str_pad($decimal, $decimalDigits, '0');
260 260
 				}
261 261
 				else
262 262
 				{
263
-					$decimal = substr($float, strpos($float,'.')+1);
264
-					if(strlen($decimal)<$decimalDigits)
265
-						$decimal = str_pad($decimal,$decimalDigits,'0');
263
+					$decimal=substr($float, strpos($float, '.') + 1);
264
+					if(strlen($decimal) < $decimalDigits)
265
+						$decimal=str_pad($decimal, $decimalDigits, '0');
266 266
 				}
267 267
 			}
268 268
 			else
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 
271 271
 			return $decimalSeparator.$decimal;
272 272
 		}
273
-		else if ($decimalDigits > 0)
274
-			return $decimalSeparator.str_pad($decimal,$decimalDigits,'0');
273
+		else if($decimalDigits > 0)
274
+			return $decimalSeparator.str_pad($decimal, $decimalDigits, '0');
275 275
 
276 276
 		return $decimal;
277 277
 	}
Please login to merge, or discard this patch.
framework/I18N/core/CultureInfo.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -199,9 +199,9 @@
 block discarded – undo
199 199
 	}
200 200
 
201 201
 	/**
202
-	* Gets the CultureInfo that for this culture string
203
-	* @return CultureInfo invariant culture info is "en".
204
-	*/
202
+	 * Gets the CultureInfo that for this culture string
203
+	 * @return CultureInfo invariant culture info is "en".
204
+	 */
205 205
 	public static function getInstance($culture)
206 206
 	{
207 207
 		static $instances = array();
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,6 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 	/**
185 185
 	* Gets the CultureInfo that for this culture string
186
+	* @param string $culture
186 187
 	* @return CultureInfo invariant culture info is "en".
187 188
 	*/
188 189
 	public static function getInstance($culture)
@@ -208,6 +209,7 @@  discard block
 block discarded – undo
208 209
 	 * Set the culture for the current instance. The culture indentifier
209 210
 	 * must be of the form "<language>_(country/region)".
210 211
 	 * @param string culture identifier, e.g. "fr_FR".
212
+	 * @param string $culture
211 213
 	 */
212 214
 	protected function setCulture($culture)
213 215
 	{
@@ -223,6 +225,7 @@  discard block
 block discarded – undo
223 225
 	/**
224 226
 	 * Load the ICU culture data resource bundles for the specific culture identifier.
225 227
 	 * @param string the culture identifier.
228
+	 * @param string $cultureName
226 229
 	 */
227 230
 	protected function loadCultureData($cultureName)
228 231
 	{
@@ -266,6 +269,7 @@  discard block
 block discarded – undo
266 269
 	 * currency for "en_AU", you need to use findInfo("Currencies,true);.
267 270
 	 * @param string the data you want to find.
268 271
 	 * @param boolean merge the data from its parents.
272
+	 * @param string $key
269 273
 	 * @return mixed the specific ICU data.
270 274
 	 */
271 275
 	public function findInfo($path='/', $merge=false, $key = null)
@@ -358,6 +362,7 @@  discard block
 block discarded – undo
358 362
 	/**
359 363
 	 * Set the date time format information.
360 364
 	 * @param DateTimeFormatInfo the new date time format info.
365
+	 * @param DateTimeFormatInfo $dateTimeFormat
361 366
 	 */
362 367
 	public function setDateTimeFormat($dateTimeFormat)
363 368
 	{
@@ -457,6 +462,7 @@  discard block
 block discarded – undo
457 462
 	/**
458 463
 	 * Set the number format information.
459 464
 	 * @param NumberFormatInfo the new number format info.
465
+	 * @param NumberFormatInfo $numberFormat
460 466
 	 */
461 467
 	public function setNumberFormat($numberFormat)
462 468
 	{
@@ -595,7 +601,7 @@  discard block
 block discarded – undo
595 601
 
596 602
 	/**
597 603
 	 * Get a list of timezones in the language of the localized version.
598
-	 * @return array list of localized timezones.
604
+	 * @return string[] list of localized timezones.
599 605
 	 */
600 606
 	public function getTimeZones()
601 607
 	{
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * The ICU data array.
57 57
 	 * @var array
58 58
 	 */
59
-	private $data = array();
59
+	private $data=array();
60 60
 
61 61
 	/**
62 62
 	 * The current culture.
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 	 * A list of CLDR resource bundles loaded
69 69
 	 * @var array
70 70
 	 */
71
-	private $resourceBundles = array();
71
+	private $resourceBundles=array();
72 72
 
73 73
 	/**
74 74
 	 * A list of resource bundles keys
75 75
 	 * @var array
76 76
 	 */
77
-	protected static $bundleNames = array(
77
+	protected static $bundleNames=array(
78 78
 		'Core' => null,
79 79
 		'Currencies' => 'ICUDATA-curr',
80 80
 		'Languages' => 'ICUDATA-lang',
@@ -98,28 +98,28 @@  discard block
 block discarded – undo
98 98
 	 * A list of properties that are accessable/writable.
99 99
 	 * @var array
100 100
 	 */
101
-	protected $properties = array();
101
+	protected $properties=array();
102 102
 
103 103
 	/**
104 104
 	 * Culture type, all.
105 105
 	 * @see getCultures()
106 106
 	 * @var int
107 107
 	 */
108
-	const ALL = 0;
108
+	const ALL=0;
109 109
 
110 110
 	/**
111 111
 	 * Culture type, neutral.
112 112
 	 * @see getCultures()
113 113
 	 * @var int
114 114
 	 */
115
-	const NEUTRAL = 1;
115
+	const NEUTRAL=1;
116 116
 
117 117
 	/**
118 118
 	 * Culture type, specific.
119 119
 	 * @see getCultures()
120 120
 	 * @var int
121 121
 	 */
122
-	const SPECIFIC = 2;
122
+	const SPECIFIC=2;
123 123
 
124 124
 	/**
125 125
 	 * Display the culture name.
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	function __get($name)
141 141
 	{
142
-		$getProperty = 'get'.$name;
142
+		$getProperty='get'.$name;
143 143
 		if(in_array($getProperty, $this->properties))
144 144
 			return $this->$getProperty();
145 145
 		else
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	function __set($name, $value)
154 154
 	{
155
-		$setProperty = 'set'.$name;
155
+		$setProperty='set'.$name;
156 156
 		if(in_array($setProperty, $this->properties))
157 157
 			$this->$setProperty($value);
158 158
 		else
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	function __construct($culture='en')
172 172
 	{
173
-		$this->properties = get_class_methods($this);
173
+		$this->properties=get_class_methods($this);
174 174
 
175 175
 		if(empty($culture))
176
-			$culture = 'en';
176
+			$culture='en';
177 177
 
178 178
 		$this->setCulture($culture);
179 179
 
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 	*/
188 188
 	public static function getInstance($culture)
189 189
 	{
190
-		static $instances = array();
190
+		static $instances=array();
191 191
 		if(!isset($instances[$culture]))
192
-			$instances[$culture] = new CultureInfo($culture);
192
+			$instances[$culture]=new CultureInfo($culture);
193 193
 		return $instances[$culture];
194 194
 	}
195 195
 
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	{
214 214
 		if(!empty($culture))
215 215
 		{
216
-			if (!preg_match('/^[_\\w]+$/', $culture))
217
-				throw new Exception('Invalid culture supplied: ' . $culture);
216
+			if(!preg_match('/^[_\\w]+$/', $culture))
217
+				throw new Exception('Invalid culture supplied: '.$culture);
218 218
 		}
219 219
 
220
-		$this->culture = $culture;
220
+		$this->culture=$culture;
221 221
 	}
222 222
 
223 223
 	/**
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function loadCultureData($cultureName)
228 228
 	{
229
-		$culture_parts = explode('_', $cultureName);
230
-		$current_part = $culture_parts[0];
229
+		$culture_parts=explode('_', $cultureName);
230
+		$current_part=$culture_parts[0];
231 231
 
232
-		$culturesToLoad = array($current_part);
233
-		for($i = 1, $k = count($culture_parts); $i < $k; ++$i)
232
+		$culturesToLoad=array($current_part);
233
+		for($i=1, $k=count($culture_parts); $i < $k; ++$i)
234 234
 		{
235
-			$current_part .= '_'.$culture_parts[$i];
236
-			$culturesToLoad[] = $current_part;
235
+			$current_part.='_'.$culture_parts[$i];
236
+			$culturesToLoad[]=$current_part;
237 237
 		}
238 238
 
239 239
 		foreach(self::$bundleNames as $key => $bundleName)
240 240
 		{
241 241
 			if(!array_key_exists($key, $this->data))
242
-				$this->data[$key] = array();
242
+				$this->data[$key]=array();
243 243
 		}
244 244
 		foreach($culturesToLoad as $culture)
245 245
 		{
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			array_unshift($this->resourceBundles, $culture);
250 250
 			foreach(self::$bundleNames as $key => $bundleName)
251 251
 			{
252
-				$this->data[$key][$culture] = \ResourceBundle::create($culture, $bundleName, false);
252
+				$this->data[$key][$culture]=\ResourceBundle::create($culture, $bundleName, false);
253 253
 			}
254 254
 		}
255 255
 	}
@@ -268,19 +268,19 @@  discard block
 block discarded – undo
268 268
 	 * @param boolean merge the data from its parents.
269 269
 	 * @return mixed the specific ICU data.
270 270
 	 */
271
-	public function findInfo($path='/', $merge=false, $key = null)
271
+	public function findInfo($path='/', $merge=false, $key=null)
272 272
 	{
273
-		$result = array();
273
+		$result=array();
274 274
 
275
-		if($key === null)
275
+		if($key===null)
276 276
 		{
277 277
 			// try to guess the bundle from the path. Always defaults to "Core".
278
-			$key = 'Core';
278
+			$key='Core';
279 279
 			foreach(self::$bundleNames as $bundleName => $icuBundleName)
280 280
 			{
281
-				if(strpos($path, $bundleName) === 0)
281
+				if(strpos($path, $bundleName)===0)
282 282
 				{
283
-					$key = $bundleName;
283
+					$key=$bundleName;
284 284
 					break;
285 285
 				}
286 286
 			}
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 			return $result;
291 291
 		foreach($this->resourceBundles as $culture)
292 292
 		{
293
-			$res = $this->data[$key][$culture];
294
-			if($res === null)
293
+			$res=$this->data[$key][$culture];
294
+			if($res===null)
295 295
 				continue;
296
-			$info = $this->searchResources($res, $path);
296
+			$info=$this->searchResources($res, $path);
297 297
 			if($info)
298 298
 			{
299 299
 				if($merge)
300
-					$result = array_merge($result, $info);
300
+					$result=array_merge($result, $info);
301 301
 				else
302 302
 					return $info;
303 303
 			}
@@ -316,14 +316,14 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	private function searchResources($info, $path='/')
318 318
 	{
319
-		$index = explode('/',$path);
319
+		$index=explode('/', $path);
320 320
 
321
-		$resource = $info;
322
-		for($i = 0, $k = count($index); $i < $k; ++$i)
321
+		$resource=$info;
322
+		for($i=0, $k=count($index); $i < $k; ++$i)
323 323
 		{
324 324
 
325
-			$resource = $resource->get($index[$i], false);
326
-			if($resource === null)
325
+			$resource=$resource->get($index[$i], false);
326
+			if($resource===null)
327 327
 				return null;
328 328
 		}
329 329
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public function getDateTimeFormat()
349 349
 	{
350
-		if($this->dateTimeFormat === null)
350
+		if($this->dateTimeFormat===null)
351 351
 		{
352 352
 			$this->setDateTimeFormat(new DateTimeFormatInfo($this));
353 353
 		}
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	public function setDateTimeFormat($dateTimeFormat)
363 363
 	{
364
-		$this->dateTimeFormat = $dateTimeFormat;
364
+		$this->dateTimeFormat=$dateTimeFormat;
365 365
 	}
366 366
 
367 367
 	/**
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	public function getNativeName()
383 383
 	{
384
-		$lang = substr($this->culture,0,2);
385
-		$reg = substr($this->culture,3,2);
386
-		$language = $this->findInfo("Languages/{$lang}");
387
-		$region = $this->findInfo("Countries/{$reg}");
384
+		$lang=substr($this->culture, 0, 2);
385
+		$reg=substr($this->culture, 3, 2);
386
+		$language=$this->findInfo("Languages/{$lang}");
387
+		$region=$this->findInfo("Countries/{$reg}");
388 388
 		if($region)
389 389
 			return $language.' ('.$region.')';
390 390
 		else
@@ -399,15 +399,15 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	public function getEnglishName()
401 401
 	{
402
-		$lang = substr($this->culture,0,2);
403
-		$reg = substr($this->culture,3,2);
404
-		$culture = $this->getInvariantCulture();
402
+		$lang=substr($this->culture, 0, 2);
403
+		$reg=substr($this->culture, 3, 2);
404
+		$culture=$this->getInvariantCulture();
405 405
 
406
-		$language = $culture->findInfo("Languages/{$lang}");
407
-		if(count($language) == 0)
406
+		$language=$culture->findInfo("Languages/{$lang}");
407
+		if(count($language)==0)
408 408
 			return $this->culture;
409 409
 
410
-		$region = $culture->findInfo("Countries/{$reg}");
410
+		$region=$culture->findInfo("Countries/{$reg}");
411 411
 		if($region)
412 412
 			return $language.' ('.$region.')';
413 413
 		else
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	static public function getInvariantCulture()
425 425
 	{
426 426
 		static $invariant;
427
-		if($invariant === null)
428
-			$invariant = new CultureInfo();
427
+		if($invariant===null)
428
+			$invariant=new CultureInfo();
429 429
 		return $invariant;
430 430
 	}
431 431
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	public function getIsNeutralCulture()
439 439
 	{
440
-		return strlen($this->culture) == 2;
440
+		return strlen($this->culture)==2;
441 441
 	}
442 442
 
443 443
 	/**
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function getNumberFormat()
449 449
 	{
450
-		if($this->numberFormat === null)
450
+		if($this->numberFormat===null)
451 451
 		{
452 452
 			$this->setNumberFormat(new NumberFormatInfo($this));
453 453
 		}
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	public function setNumberFormat($numberFormat)
462 462
 	{
463
-		$this->numberFormat = $numberFormat;
463
+		$this->numberFormat=$numberFormat;
464 464
 	}
465 465
 
466 466
 	/**
@@ -479,10 +479,10 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	public function getParent()
481 481
 	{
482
-		if(strlen($this->culture) == 2)
482
+		if(strlen($this->culture)==2)
483 483
 			return $this->getInvariantCulture();
484 484
 
485
-		$lang = substr($this->culture,0,2);
485
+		$lang=substr($this->culture, 0, 2);
486 486
 			return new CultureInfo($lang);
487 487
 	}
488 488
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 */
498 498
 	static public function getCultures($type=CultureInfo::ALL)
499 499
 	{
500
-		$all = \ResourceBundle::getLocales('');
500
+		$all=\ResourceBundle::getLocales('');
501 501
 
502 502
 		switch($type)
503 503
 		{
@@ -506,14 +506,14 @@  discard block
 block discarded – undo
506 506
 			case CultureInfo::NEUTRAL :
507 507
 				foreach($all as $key => $culture)
508 508
 				{
509
-					if(strlen($culture) != 2)
509
+					if(strlen($culture)!=2)
510 510
 						unset($all[$key]);
511 511
 				}
512 512
 				return $all;
513 513
 			case CultureInfo::SPECIFIC :
514 514
 				foreach($all as $key => $culture)
515 515
 				{
516
-					if(strlen($culture) == 2)
516
+					if(strlen($culture)==2)
517 517
 						unset($all[$key]);
518 518
 				}
519 519
 				return $all;
@@ -532,19 +532,19 @@  discard block
 block discarded – undo
532 532
 		if(is_scalar($obj)) {
533 533
 			return $obj;
534 534
 		} elseif($obj instanceof \ResourceBundle) {
535
-			$array = array();
535
+			$array=array();
536 536
 			foreach($obj as $k => $v)
537
-				$array[$k] = $v;
537
+				$array[$k]=$v;
538 538
 		} else {
539
-			$array = $obj;
539
+			$array=$obj;
540 540
 		}
541 541
 
542
-		for($i = 0, $k = count($array); $i<$k; ++$i)
542
+		for($i=0, $k=count($array); $i < $k; ++$i)
543 543
 		{
544
-			$key = key($array);
544
+			$key=key($array);
545 545
 			if(is_array($array[$key])
546
-				&& count($array[$key]) == 1)
547
-				$array[$key] = $array[$key][0];
546
+				&& count($array[$key])==1)
547
+				$array[$key]=$array[$key][0];
548 548
 			next($array);
549 549
 		}
550 550
 		return $array;
@@ -566,11 +566,11 @@  discard block
 block discarded – undo
566 566
 	public function getCurrencies()
567 567
 	{
568 568
 		static $arr;
569
-		if($arr === null)
569
+		if($arr===null)
570 570
 		{
571
-			$arr = $this->findInfo('Currencies', true, 'Currencies');
571
+			$arr=$this->findInfo('Currencies', true, 'Currencies');
572 572
 			foreach($arr as $k => $v)
573
-				$arr[$k] = $this->simplify($v);
573
+				$arr[$k]=$this->simplify($v);
574 574
 		}
575 575
 		return $arr;
576 576
 	}
@@ -600,17 +600,17 @@  discard block
 block discarded – undo
600 600
 	public function getTimeZones()
601 601
 	{
602 602
 		static $arr;
603
-		if($arr === null)
603
+		if($arr===null)
604 604
 		{
605
-			$validPrefixes = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Etc', 'Europe', 'Indian', 'Pacific');
606
-			$tmp = $this->findInfo('zoneStrings', true, 'zoneStrings');
605
+			$validPrefixes=array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Etc', 'Europe', 'Indian', 'Pacific');
606
+			$tmp=$this->findInfo('zoneStrings', true, 'zoneStrings');
607 607
 			foreach($tmp as $k => $v)
608 608
 			{
609 609
 				foreach($validPrefixes as $prefix)
610 610
 				{
611
-					if(strpos($k, $prefix) === 0)
611
+					if(strpos($k, $prefix)===0)
612 612
 					{
613
-						$arr[] = str_replace(':', '/', $k);
613
+						$arr[]=str_replace(':', '/', $k);
614 614
 						break;
615 615
 					}
616 616
 				}
Please login to merge, or discard this patch.