Completed
Push — prado4-sauce ( 31ba42...77d75b )
by Fabio
16:20 queued 08:27
created
framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php 4 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@  discard block
 block discarded – undo
115 115
 			$columns = $this->getTableInfo()->getColumns();
116 116
 			$this->getInputRepeater()->setDataSource($columns);
117 117
 			$this->getInputRepeater()->dataBind();
118
-		}
119
-		else
118
+		} else
120 119
 		{
121 120
 			if($this->_editRenderer===null)
122 121
 				$this->createEditRenderer($record, $classPath);
@@ -140,8 +139,7 @@  discard block
 block discarded – undo
140 139
 			$index = $this->getControls()->remove($this->getInputRepeater());
141 140
 			$this->getControls()->insertAt($index,$this->_editRenderer);
142 141
 			$this->_editRenderer->setData($record);
143
-		}
144
-		else
142
+		} else
145 143
 		{
146 144
 			throw new TConfigurationException(
147 145
 				'scaffold_invalid_edit_renderer', $this->getID(), get_class($record));
@@ -204,15 +202,13 @@  discard block
 block discarded – undo
204 202
 					$column = $table->getColumn($item->getCustomData());
205 203
 					$builder->loadScaffoldInput($this, $item, $column, $record);
206 204
 				}
207
-			}
208
-			else
205
+			} else
209 206
 			{
210 207
 				$this->_editRenderer->updateRecord($record);
211 208
 			}
212 209
 			$record->save();
213 210
 			return true;
214
-		}
215
-		else if($this->_editRenderer!==null)
211
+		} else if($this->_editRenderer!==null)
216 212
 		{
217 213
 			//preserve the form data.
218 214
 			$this->_editRenderer->updateRecord($this->getCurrentRecord());
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function setRecordPk($value)
84 84
 	{
85 85
 		$this->clearRecordObject();
86
-		$val = TPropertyValue::ensureArray($value);
86
+		$val=TPropertyValue::ensureArray($value);
87 87
 		$this->setViewState('PK', count($val) > 0 ? $val : null);
88 88
 	}
89 89
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function initializeEditForm()
110 110
 	{
111
-		$record = $this->getCurrentRecord();
112
-		$classPath = $this->getEditRenderer();
113
-		if($classPath === '')
111
+		$record=$this->getCurrentRecord();
112
+		$classPath=$this->getEditRenderer();
113
+		if($classPath==='')
114 114
 		{
115
-			$columns = $this->getTableInfo()->getColumns();
115
+			$columns=$this->getTableInfo()->getColumns();
116 116
 			$this->getInputRepeater()->setDataSource($columns);
117 117
 			$this->getInputRepeater()->dataBind();
118 118
 		}
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function createEditRenderer($record, $classPath)
136 136
 	{
137
-		$this->_editRenderer = Prado::createComponent($classPath);
137
+		$this->_editRenderer=Prado::createComponent($classPath);
138 138
 		if($this->_editRenderer instanceof IScaffoldEditRenderer)
139 139
 		{
140
-			$index = $this->getControls()->remove($this->getInputRepeater());
141
-			$this->getControls()->insertAt($index,$this->_editRenderer);
140
+			$index=$this->getControls()->remove($this->getInputRepeater());
141
+			$this->getControls()->insertAt($index, $this->_editRenderer);
142 142
 			$this->_editRenderer->setData($record);
143 143
 		}
144 144
 		else
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	protected function createRepeaterEditItem($sender, $param)
155 155
 	{
156
-		$type = $param->getItem()->getItemType();
156
+		$type=$param->getItem()->getItemType();
157 157
 		if($type==TListItemType::Item || $type==TListItemType::AlternatingItem)
158 158
 		{
159
-			$item = $param->getItem();
160
-			$column = $item->getDataItem();
159
+			$item=$param->getItem();
160
+			$column=$item->getDataItem();
161 161
 			if($column===null)
162 162
 				return;
163 163
 
164
-			$record = $this->getCurrentRecord();
165
-			$builder = $this->getScaffoldInputBuilder($record);
164
+			$record=$this->getCurrentRecord();
165
+			$builder=$this->getScaffoldInputBuilder($record);
166 166
 			$builder->createScaffoldInput($this, $item, $column, $record);
167 167
 		}
168 168
 	}
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 	{
195 195
 		if($this->getPage()->getIsValid())
196 196
 		{
197
-			$record = $this->getCurrentRecord();
197
+			$record=$this->getCurrentRecord();
198 198
 			if($this->_editRenderer===null)
199 199
 			{
200
-				$table = $this->getTableInfo();
201
-				$builder = $this->getScaffoldInputBuilder($record);
200
+				$table=$this->getTableInfo();
201
+				$builder=$this->getScaffoldInputBuilder($record);
202 202
 				foreach($this->getInputRepeater()->getItems() as $item)
203 203
 				{
204
-					$column = $table->getColumn($item->getCustomData());
204
+					$column=$table->getColumn($item->getCustomData());
205 205
 					$builder->loadScaffoldInput($this, $item, $column, $record);
206 206
 				}
207 207
 			}
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 	protected function getScaffoldInputBuilder($record)
266 266
 	{
267 267
 		static $_builders=array();
268
-		$class = get_class($record);
268
+		$class=get_class($record);
269 269
 		if(!isset($_builders[$class]))
270 270
 		{
271 271
 			Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputBase');
272
-			$_builders[$class] = TScaffoldInputBase::createInputBuilder($record);
272
+			$_builders[$class]=TScaffoldInputBase::createInputBuilder($record);
273 273
 		}
274 274
 		return $_builders[$class];
275 275
 	}
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 
105 105
 	/**
106
-	 * @return TActiveRecord current Active Record instance
106
+	 * @return \Prado\Data\ActiveRecord\TActiveRecord current Active Record instance
107 107
 	 */
108 108
 	protected function getCurrentRecord()
109 109
 	{
@@ -136,6 +136,8 @@  discard block
 block discarded – undo
136 136
 	 * Instantiate the external edit renderer.
137 137
 	 * @param TActiveRecord record to be edited
138 138
 	 * @param string external edit renderer class name.
139
+	 * @param \Prado\Data\ActiveRecord\TActiveRecord $record
140
+	 * @param string $classPath
139 141
 	 * @throws TConfigurationException raised when renderer is not an
140 142
 	 * instance of IScaffoldEditRenderer.
141 143
 	 */
@@ -267,6 +269,7 @@  discard block
 block discarded – undo
267 269
 	/**
268 270
 	 * Create the default scaffold editor control factory.
269 271
 	 * @param TActiveRecord record instance.
272
+	 * @param \Prado\Data\ActiveRecord\TActiveRecord $record
270 273
 	 * @return TScaffoldInputBase scaffold editor control factory.
271 274
 	 */
272 275
 	protected function getScaffoldInputBuilder($record)
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
  * xxx is the property name).
50 50
  *
51 51
  * @author Wei Zhuo <weizho[at]gmail[dot]com>
52
-  * @package Prado\Data\ActiveRecord\Scaffold
52
+ * @package Prado\Data\ActiveRecord\Scaffold
53 53
  * @since 3.1
54 54
  */
55 55
 class TScaffoldEditView extends TScaffoldBase
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordGateway.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,16 +67,14 @@
 block discarded – undo
67 67
 				throw new TActiveRecordException('ar_invalid_tablename_property',
68 68
 					get_class($record),self::TABLE_CONST);
69 69
 			return $value;
70
-		}
71
-		elseif ($class->hasMethod(self::TABLE_METHOD))
70
+		} elseif ($class->hasMethod(self::TABLE_METHOD))
72 71
 		{
73 72
 			$value = $record->{self::TABLE_METHOD}();
74 73
 			if(empty($value))
75 74
 				throw new TActiveRecordException('ar_invalid_tablename_method',
76 75
 					get_class($record),self::TABLE_METHOD);
77 76
 			return $value;
78
-		}
79
-		else
77
+		} else
80 78
 			return strtolower(get_class($record));
81 79
 	}
82 80
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -236,6 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * Return record data from sql query.
237 237
 	 * @param TActiveRecord active record finder instance.
238 238
 	 * @param TActiveRecordCriteria sql query
239
+	 * @param TSqlCriteria $criteria
239 240
 	 * @return array result.
240 241
 	 */
241 242
 	public function findRecordBySql(TActiveRecord $record, $criteria)
@@ -247,6 +248,7 @@  discard block
 block discarded – undo
247 248
 	 * Return record data from sql query.
248 249
 	 * @param TActiveRecord active record finder instance.
249 250
 	 * @param TActiveRecordCriteria sql query
251
+	 * @param TSqlCriteria $criteria
250 252
 	 * @return TDbDataReader result iterator.
251 253
 	 */
252 254
 	public function findRecordsBySql(TActiveRecord $record, $criteria)
@@ -288,6 +290,7 @@  discard block
 block discarded – undo
288 290
 	/**
289 291
 	 * Sets the last insert ID to the corresponding property of the record if available.
290 292
 	 * @param TActiveRecord record for insertion
293
+	 * @param TActiveRecord $record
291 294
 	 */
292 295
 	protected function updatePostInsert($record)
293 296
 	{
@@ -405,6 +408,7 @@  discard block
 block discarded – undo
405 408
 	 * Delete multiple records by criteria.
406 409
 	 * @param TActiveRecord active record finder instance.
407 410
 	 * @param TActiveRecordCriteria search criteria
411
+	 * @param TSqlCriteria $criteria
408 412
 	 * @return int number of records.
409 413
 	 */
410 414
 	public function deleteRecordsByCriteria(TActiveRecord $record, $criteria)
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	protected function getRecordTableName(TActiveRecord $record)
72 72
 	{
73
-		$class = new ReflectionClass($record);
73
+		$class=new ReflectionClass($record);
74 74
 		if($class->hasConstant(self::TABLE_CONST))
75 75
 		{
76
-			$value = $class->getConstant(self::TABLE_CONST);
76
+			$value=$class->getConstant(self::TABLE_CONST);
77 77
 			if(empty($value))
78 78
 				throw new TActiveRecordException('ar_invalid_tablename_property',
79
-					get_class($record),self::TABLE_CONST);
79
+					get_class($record), self::TABLE_CONST);
80 80
 			return $value;
81 81
 		}
82
-		elseif ($class->hasMethod(self::TABLE_METHOD))
82
+		elseif($class->hasMethod(self::TABLE_METHOD))
83 83
 		{
84
-			$value = $record->{self::TABLE_METHOD}();
84
+			$value=$record->{self::TABLE_METHOD}();
85 85
 			if(empty($value))
86 86
 				throw new TActiveRecordException('ar_invalid_tablename_method',
87
-					get_class($record),self::TABLE_METHOD);
87
+					get_class($record), self::TABLE_METHOD);
88 88
 			return $value;
89 89
 		}
90 90
 		else
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function getRecordTableInfo(TActiveRecord $record)
100 100
 	{
101
-		$tableName = $this->getRecordTableName($record);
101
+		$tableName=$this->getRecordTableName($record);
102 102
 		return $this->getTableInfo($record->getDbConnection(), $tableName);
103 103
 	}
104 104
 
@@ -110,27 +110,27 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function getTableInfo(TDbConnection $connection, $tableName)
112 112
 	{
113
-		$connStr = $connection->getConnectionString();
114
-		$key = $connStr.$tableName;
113
+		$connStr=$connection->getConnectionString();
114
+		$key=$connStr.$tableName;
115 115
 		if(!isset($this->_tables[$key]))
116 116
 		{
117 117
 			//call this first to ensure that unserializing the cache
118 118
 			//will find the correct driver dependent classes.
119 119
 			if(!isset($this->_meta[$connStr]))
120 120
 			{
121
-				$this->_meta[$connStr] = TDbMetaData::getInstance($connection);
121
+				$this->_meta[$connStr]=TDbMetaData::getInstance($connection);
122 122
 			}
123 123
 
124
-			$tableInfo = null;
124
+			$tableInfo=null;
125 125
 			if(($cache=$this->getManager()->getCache())!==null)
126
-				$tableInfo = $cache->get($key);
126
+				$tableInfo=$cache->get($key);
127 127
 			if(empty($tableInfo))
128 128
 			{
129
-				$tableInfo = $this->_meta[$connStr]->getTableInfo($tableName);
129
+				$tableInfo=$this->_meta[$connStr]->getTableInfo($tableName);
130 130
 				if($cache!==null)
131 131
 					$cache->set($key, $tableInfo);
132 132
 			}
133
-			$this->_tables[$key] = $tableInfo;
133
+			$this->_tables[$key]=$tableInfo;
134 134
 		}
135 135
 		return $this->_tables[$key];
136 136
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function getCommand(TActiveRecord $record)
143 143
 	{
144
-		$conn = $record->getDbConnection();
145
-		$connStr = $conn->getConnectionString();
146
-		$tableInfo = $this->getRecordTableInfo($record);
144
+		$conn=$record->getDbConnection();
145
+		$connStr=$conn->getConnectionString();
146
+		$tableInfo=$this->getRecordTableInfo($record);
147 147
 		if(!isset($this->_commandBuilders[$connStr]))
148 148
 		{
149
-			$builder = $tableInfo->createCommandBuilder($record->getDbConnection());
150
-			$command = new TDataGatewayCommand($builder);
151
-			$command->OnCreateCommand[] = array($this, 'onCreateCommand');
152
-			$command->OnExecuteCommand[] = array($this, 'onExecuteCommand');
153
-			$this->_commandBuilders[$connStr] = $command;
149
+			$builder=$tableInfo->createCommandBuilder($record->getDbConnection());
150
+			$command=new TDataGatewayCommand($builder);
151
+			$command->OnCreateCommand[]=array($this, 'onCreateCommand');
152
+			$command->OnExecuteCommand[]=array($this, 'onExecuteCommand');
153
+			$this->_commandBuilders[$connStr]=$command;
154 154
 
155 155
 		}
156 156
 		$this->_commandBuilders[$connStr]->getBuilder()->setTableInfo($tableInfo);
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param array primary name value pairs
201 201
 	 * @return array record data
202 202
 	 */
203
-	public function findRecordByPK(TActiveRecord $record,$keys)
203
+	public function findRecordByPK(TActiveRecord $record, $keys)
204 204
 	{
205
-		$command = $this->getCommand($record);
205
+		$command=$this->getCommand($record);
206 206
 		return $command->findByPk($keys);
207 207
 	}
208 208
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function findRecordsByCriteria(TActiveRecord $record, $criteria, $iterator=false)
230 230
 	{
231
-		$command = $this->getCommand($record);
231
+		$command=$this->getCommand($record);
232 232
 		return $iterator ? $command->findAll($criteria) : $command->find($criteria);
233 233
 	}
234 234
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 	public function findRecordsByIndex(TActiveRecord $record, $criteria, $fields, $values)
258 258
 	{
259
-		return $this->getCommand($record)->findAllByIndex($criteria,$fields,$values);
259
+		return $this->getCommand($record)->findAllByIndex($criteria, $fields, $values);
260 260
 	}
261 261
 
262 262
 	/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	public function insert(TActiveRecord $record)
279 279
 	{
280 280
 		//$this->updateAssociatedRecords($record,true);
281
-		$result = $this->getCommand($record)->insert($this->getInsertValues($record));
281
+		$result=$this->getCommand($record)->insert($this->getInsertValues($record));
282 282
 		if($result)
283 283
 			$this->updatePostInsert($record);
284 284
 		//$this->updateAssociatedRecords($record);
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	protected function updatePostInsert($record)
293 293
 	{
294
-		$command = $this->getCommand($record);
295
-		$tableInfo = $command->getTableInfo();
294
+		$command=$this->getCommand($record);
295
+		$tableInfo=$command->getTableInfo();
296 296
 		foreach($tableInfo->getColumns() as $name => $column)
297 297
 		{
298 298
 			if($column->hasSequence())
299
-				$record->setColumnValue($name,$command->getLastInsertID($column->getSequenceName()));
299
+				$record->setColumnValue($name, $command->getLastInsertID($column->getSequenceName()));
300 300
 		}
301 301
 	}
302 302
 
@@ -307,20 +307,20 @@  discard block
 block discarded – undo
307 307
 	protected function getInsertValues(TActiveRecord $record)
308 308
 	{
309 309
 		$values=array();
310
-		$tableInfo = $this->getCommand($record)->getTableInfo();
310
+		$tableInfo=$this->getCommand($record)->getTableInfo();
311 311
 		foreach($tableInfo->getColumns() as $name=>$column)
312 312
 		{
313 313
 			if($column->getIsExcluded())
314 314
 				continue;
315
-			$value = $record->getColumnValue($name);
316
-			if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
315
+			$value=$record->getColumnValue($name);
316
+			if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue()===TDbTableColumn::UNDEFINED_VALUE))
317 317
 			{
318 318
 				throw new TActiveRecordException(
319 319
 					'ar_value_must_not_be_null', get_class($record),
320 320
 					$tableInfo->getTableFullName(), $name);
321 321
 			}
322 322
 			if($value!==null)
323
-				$values[$name] = $value;
323
+				$values[$name]=$value;
324 324
 		}
325 325
 		return $values;
326 326
 	}
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	public function update(TActiveRecord $record)
334 334
 	{
335 335
 		//$this->updateAssociatedRecords($record,true);
336
-		list($data, $keys) = $this->getUpdateValues($record);
337
-		$result = $this->getCommand($record)->updateByPk($data, $keys);
336
+		list($data, $keys)=$this->getUpdateValues($record);
337
+		$result=$this->getCommand($record)->updateByPk($data, $keys);
338 338
 		//$this->updateAssociatedRecords($record);
339 339
 		return $result;
340 340
 	}
@@ -342,30 +342,30 @@  discard block
 block discarded – undo
342 342
 	protected function getUpdateValues(TActiveRecord $record)
343 343
 	{
344 344
 		$values=array();
345
-		$tableInfo = $this->getCommand($record)->getTableInfo();
345
+		$tableInfo=$this->getCommand($record)->getTableInfo();
346 346
 		$primary=array();
347 347
 		foreach($tableInfo->getColumns() as $name=>$column)
348 348
 		{
349 349
 			if($column->getIsExcluded())
350 350
 				continue;
351
-			$value = $record->getColumnValue($name);
352
-			if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
351
+			$value=$record->getColumnValue($name);
352
+			if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue()===TDbTableColumn::UNDEFINED_VALUE))
353 353
 			{
354 354
 				throw new TActiveRecordException(
355 355
 					'ar_value_must_not_be_null', get_class($record),
356 356
 					$tableInfo->getTableFullName(), $name);
357 357
 			}
358 358
 			if($column->getIsPrimaryKey())
359
-				$primary[$name] = $value;
359
+				$primary[$name]=$value;
360 360
 			else
361
-				$values[$name] = $value;
361
+				$values[$name]=$value;
362 362
 		}
363
-		return array($values,$primary);
363
+		return array($values, $primary);
364 364
 	}
365 365
 
366
-	protected function updateAssociatedRecords(TActiveRecord $record,$updateBelongsTo=false)
366
+	protected function updateAssociatedRecords(TActiveRecord $record, $updateBelongsTo=false)
367 367
 	{
368
-		$context = new TActiveRecordRelationContext($record);
368
+		$context=new TActiveRecordRelationContext($record);
369 369
 		return $context->updateAssociatedRecords($updateBelongsTo);
370 370
 	}
371 371
 
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 
382 382
 	protected function getPrimaryKeyValues(TActiveRecord $record)
383 383
 	{
384
-		$tableInfo = $this->getCommand($record)->getTableInfo();
384
+		$tableInfo=$this->getCommand($record)->getTableInfo();
385 385
 		$primary=array();
386 386
 		foreach($tableInfo->getColumns() as $name=>$column)
387 387
 		{
388 388
 			if($column->getIsPrimaryKey())
389
-				$primary[$name] = $record->getColumnValue($name);
389
+				$primary[$name]=$record->getColumnValue($name);
390 390
 		}
391 391
 		return $primary;
392 392
 	}
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
 	 * @param TActiveRecord active record
420 420
 	 * @param TActiveRecordCriteria data for the command.
421 421
 	 */
422
-	protected function raiseCommandEvent($event,$command,$record,$criteria)
422
+	protected function raiseCommandEvent($event, $command, $record, $criteria)
423 423
 	{
424 424
 		if(!($criteria instanceof TSqlCriteria))
425
-			$criteria = new TActiveRecordCriteria(null,$criteria);
426
-		$param = new TActiveRecordEventParameter($command,$record,$criteria);
427
-		$manager = $record->getRecordManager();
425
+			$criteria=new TActiveRecordCriteria(null, $criteria);
426
+		$param=new TActiveRecordEventParameter($command, $record, $criteria);
427
+		$manager=$record->getRecordManager();
428 428
 		$manager->{$event}($param);
429 429
 		$record->{$event}($param);
430 430
 	}
Please login to merge, or discard this patch.
framework/Data/TDbDataReader.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	public function bindColumn($column, &$value, $dataType=null)
64 64
 	{
65 65
 		if($dataType===null)
66
-			$this->_statement->bindColumn($column,$value);
66
+			$this->_statement->bindColumn($column, $value);
67 67
 		else
68
-			$this->_statement->bindColumn($column,$value,$dataType);
68
+			$this->_statement->bindColumn($column, $value, $dataType);
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	public function setFetchMode($mode)
75 75
 	{
76 76
 		$params=func_get_args();
77
-		call_user_func_array(array($this->_statement,'setFetchMode'),$params);
77
+		call_user_func_array(array($this->_statement, 'setFetchMode'), $params);
78 78
 	}
79 79
 
80 80
 	/**
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 * @param array list of column names whose values are to be passed as parameters in the constructor of the class being created
103 103
 	 * @return mixed|false the populated object, false if no more row of data available
104 104
 	 */
105
-	public function readObject($className,$fields)
105
+	public function readObject($className, $fields)
106 106
 	{
107
-		return $this->_statement->fetchObject($className,$fields);
107
+		return $this->_statement->fetchObject($className, $fields);
108 108
 	}
109 109
 
110 110
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function rewind()
173 173
 	{
174
-		if($this->_index<0)
174
+		if($this->_index < 0)
175 175
 		{
176 176
 			$this->_row=$this->_statement->fetch();
177 177
 			$this->_index=0;
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TPropertyAccess.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
 					$object = $object[$prop];
62 62
 				else
63 63
 					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
64
-			}
65
-			else if(is_object($object))
64
+			} else if(is_object($object))
66 65
 			{
67 66
 				$getter = 'get'.$prop;
68 67
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
@@ -73,8 +72,7 @@  discard block
 block discarded – undo
73 72
 					$object = $object->{$prop};
74 73
 				else
75 74
 					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
76
-			}
77
-			else
75
+			} else
78 76
 				throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
79 77
 		}
80 78
 		return $object;
@@ -98,8 +96,7 @@  discard block
 block discarded – undo
98 96
 					$object = $object[$prop];
99 97
 				else
100 98
 					return false;
101
-			}
102
-			else if(is_object($object))
99
+			} else if(is_object($object))
103 100
 			{
104 101
 				$getter = 'get'.$prop;
105 102
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
@@ -110,8 +107,7 @@  discard block
 block discarded – undo
110 107
 					$object = $object->{$prop};
111 108
 				else
112 109
 					return false;
113
-			}
114
-			else
110
+			} else
115 111
 				return false;
116 112
 		}
117 113
 		return true;
@@ -136,16 +132,14 @@  discard block
 block discarded – undo
136 132
 		if(is_array($object) || $object instanceof ArrayAccess)
137 133
 		{
138 134
 			$object[$prop] = $value;
139
-		}
140
-		else if(is_object($object))
135
+		} else if(is_object($object))
141 136
 		{
142 137
 			$setter = 'set'.$prop;
143 138
 			if (method_exists($object, $setter) && is_callable(array($object, $setter)))
144 139
 				$object->{$setter}($value);
145 140
 			else
146 141
 				$object->{$prop} = $value;
147
-		}
148
-		else
142
+		} else
149 143
 			throw new TInvalidPropertyException('sqlmap_invalid_property_type',$path);
150 144
 	}
151 145
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -48,34 +48,34 @@  discard block
 block discarded – undo
48 48
 	 * @return mixed property value.
49 49
 	 * @throws TInvalidDataValueException if property path is invalid.
50 50
 	 */
51
-	public static function get($object,$path)
51
+	public static function get($object, $path)
52 52
 	{
53 53
 		if(!is_array($object) && !is_object($object))
54 54
 			return $object;
55
-		$properties = explode('.', $path);
55
+		$properties=explode('.', $path);
56 56
 		foreach($properties as $prop)
57 57
 		{
58 58
 			if(is_array($object) || $object instanceof ArrayAccess)
59 59
 			{
60 60
 				if(array_key_exists($prop, $object))
61
-					$object = $object[$prop];
61
+					$object=$object[$prop];
62 62
 				else
63
-					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
63
+					throw new TInvalidPropertyException('sqlmap_invalid_property', $path);
64 64
 			}
65 65
 			else if(is_object($object))
66 66
 			{
67
-				$getter = 'get'.$prop;
67
+				$getter='get'.$prop;
68 68
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
69
-					$object = $object->{$getter}();
69
+					$object=$object->{$getter}();
70 70
 				else if(in_array($prop, array_keys(get_object_vars($object))))
71
-					$object = $object->{$prop};
71
+					$object=$object->{$prop};
72 72
 				elseif(method_exists($object, '__get') && is_callable(array($object, '__get')))
73
-					$object = $object->{$prop};
73
+					$object=$object->{$prop};
74 74
 				else
75
-					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
75
+					throw new TInvalidPropertyException('sqlmap_invalid_property', $path);
76 76
 			}
77 77
 			else
78
-				throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
78
+				throw new TInvalidPropertyException('sqlmap_invalid_property', $path);
79 79
 		}
80 80
 		return $object;
81 81
 	}
@@ -89,25 +89,25 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		if(!is_array($object) && !is_object($object))
91 91
 			return false;
92
-		$properties = explode('.', $path);
92
+		$properties=explode('.', $path);
93 93
 		foreach($properties as $prop)
94 94
 		{
95 95
 			if(is_array($object) || $object instanceof ArrayAccess)
96 96
 			{
97 97
 				if(array_key_exists($prop, $object))
98
-					$object = $object[$prop];
98
+					$object=$object[$prop];
99 99
 				else
100 100
 					return false;
101 101
 			}
102 102
 			else if(is_object($object))
103 103
 			{
104
-				$getter = 'get'.$prop;
104
+				$getter='get'.$prop;
105 105
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
106
-					$object = $object->{$getter}();
106
+					$object=$object->{$getter}();
107 107
 				else if(in_array($prop, array_keys(get_object_vars($object))))
108
-					$object = $object->{$prop};
108
+					$object=$object->{$prop};
109 109
 				elseif(method_exists($object, '__get') && is_callable(array($object, '__get')))
110
-					$object = $object->{$prop};
110
+					$object=$object->{$prop};
111 111
 				else
112 112
 					return false;
113 113
 			}
@@ -126,27 +126,27 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public static function set(&$originalObject, $path, $value)
128 128
 	{
129
-		$properties = explode('.', $path);
130
-		$prop = array_pop($properties);
129
+		$properties=explode('.', $path);
130
+		$prop=array_pop($properties);
131 131
 		if(count($properties) > 0)
132
-			$object = self::get($originalObject, implode('.',$properties));
132
+			$object=self::get($originalObject, implode('.', $properties));
133 133
 		else
134
-			$object = &$originalObject;
134
+			$object=&$originalObject;
135 135
 
136 136
 		if(is_array($object) || $object instanceof ArrayAccess)
137 137
 		{
138
-			$object[$prop] = $value;
138
+			$object[$prop]=$value;
139 139
 		}
140 140
 		else if(is_object($object))
141 141
 		{
142
-			$setter = 'set'.$prop;
143
-			if (method_exists($object, $setter) && is_callable(array($object, $setter)))
142
+			$setter='set'.$prop;
143
+			if(method_exists($object, $setter) && is_callable(array($object, $setter)))
144 144
 				$object->{$setter}($value);
145 145
 			else
146
-				$object->{$prop} = $value;
146
+				$object->{$prop}=$value;
147 147
 		}
148 148
 		else
149
-			throw new TInvalidPropertyException('sqlmap_invalid_property_type',$path);
149
+			throw new TInvalidPropertyException('sqlmap_invalid_property_type', $path);
150 150
 	}
151 151
 
152 152
 }
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TResultMap.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,8 +164,7 @@
 block discarded – undo
164 164
 				return $handler->createNewInstance();
165 165
 			else
166 166
 				return $registry->createInstanceOf($this->getClass());
167
-		}
168
-		catch (TSqlMapException $e)
167
+		} catch (TSqlMapException $e)
169 168
 		{
170 169
 			throw new TSqlMapException(
171 170
 				'sqlmap_unable_to_create_new_instance',
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function setClass($value)
83 83
 	{
84
-		$this->_class = $value;
84
+		$this->_class=$value;
85 85
 	}
86 86
 
87 87
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function setExtends($value)
107 107
 	{
108
-		$this->_extends = $value;
108
+		$this->_extends=$value;
109 109
 	}
110 110
 
111 111
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function setGroupBy($value)
123 123
 	{
124
-		$this->_groupBy = $value;
124
+		$this->_groupBy=$value;
125 125
 	}
126 126
 
127 127
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public function setDiscriminator(TDiscriminator $value)
139 139
 	{
140
-		$this->_discriminator = $value;
140
+		$this->_discriminator=$value;
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function addResultProperty(TResultProperty $property)
148 148
 	{
149
-		$this->_columns[$property->getProperty()] = $property;
149
+		$this->_columns[$property->getProperty()]=$property;
150 150
 	}
151 151
 
152 152
 	/**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function createInstanceOfResult($registry)
159 159
 	{
160
-		$handler = $registry->getTypeHandler($this->getClass());
160
+		$handler=$registry->getTypeHandler($this->getClass());
161 161
 		try
162 162
 		{
163 163
 			if($handler!==null)
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			else
166 166
 				return $registry->createInstanceOf($this->getClass());
167 167
 		}
168
-		catch (TSqlMapException $e)
168
+		catch(TSqlMapException $e)
169 169
 		{
170 170
 			throw new TSqlMapException(
171 171
 				'sqlmap_unable_to_create_new_instance',
@@ -179,18 +179,18 @@  discard block
 block discarded – undo
179 179
 	 * @param array row data.
180 180
 	 * @return TResultMap result sub-map.
181 181
 	 */
182
-	public function resolveSubMap($registry,$row)
182
+	public function resolveSubMap($registry, $row)
183 183
 	{
184
-		$subMap = $this;
185
-		if(($disc = $this->getDiscriminator())!==null)
184
+		$subMap=$this;
185
+		if(($disc=$this->getDiscriminator())!==null)
186 186
 		{
187
-			$value = $disc->getMapping()->getPropertyValue($registry,$row);
188
-			$subMap = $disc->getSubMap((string)$value);
187
+			$value=$disc->getMapping()->getPropertyValue($registry, $row);
188
+			$subMap=$disc->getSubMap((string) $value);
189 189
 
190 190
 			if($subMap===null)
191
-				$subMap = $this;
192
-			else if($subMap !== $this)
193
-				$subMap = $subMap->resolveSubMap($registry,$row);
191
+				$subMap=$this;
192
+			else if($subMap!==$this)
193
+				$subMap=$subMap->resolveSubMap($registry, $row);
194 194
 		}
195 195
 		return $subMap;
196 196
 	}
Please login to merge, or discard this patch.
framework/Data/Common/Sqlite/TSqliteCommandBuilder.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
 	 */
31 31
 	public function applyLimitOffset($sql, $limit=-1, $offset=-1)
32 32
 	{
33
-		$limit = $limit!==null ? intval($limit) : -1;
34
-		$offset = $offset!==null ? intval($offset) : -1;
33
+		$limit=$limit!==null ? intval($limit) : -1;
34
+		$offset=$offset!==null ? intval($offset) : -1;
35 35
 		if($limit > 0 || $offset > 0)
36 36
 		{
37
-			$limitStr = ' LIMIT '.$limit;
38
-			$offsetStr = $offset >= 0 ? ' OFFSET '.$offset : '';
37
+			$limitStr=' LIMIT '.$limit;
38
+			$offsetStr=$offset >= 0 ? ' OFFSET '.$offset : '';
39 39
 			return $sql.$limitStr.$offsetStr;
40 40
 		}
41 41
 		else
Please login to merge, or discard this patch.
framework/Exceptions/TErrorHandler.php 3 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -219,8 +219,7 @@  discard block
 block discarded – undo
219 219
 			echo "<body><h1>Recursive Error</h1>\n";
220 220
 			echo "<pre>".$exception->__toString()."</pre>\n";
221 221
 			echo "</body></html>";
222
-		}
223
-		else
222
+		} else
224 223
 		{
225 224
 			error_log("Error happened while processing an existing error:\n".$exception->__toString());
226 225
 			header('HTTP/1.0 500 Internal Error');
@@ -251,15 +250,13 @@  discard block
 block discarded – undo
251 250
 			if($fileName==='')
252 251
 				$fileName='---embedded template---';
253 252
 			$errorLine=$exception->getLineNumber();
254
-		}
255
-		else
253
+		} else
256 254
 		{
257 255
 			if(($trace=$this->getExactTrace($exception))!==null)
258 256
 			{
259 257
 				$fileName=$trace['file'];
260 258
 				$errorLine=$trace['line'];
261
-			}
262
-			else
259
+			} else
263 260
 			{
264 261
 				$fileName=$exception->getFile();
265 262
 				$errorLine=$exception->getLine();
@@ -350,8 +347,7 @@  discard block
 block discarded – undo
350 347
 				$result=$trace[0];
351 348
 			elseif(isset($trace[1]))
352 349
 				$result=$trace[1];
353
-		}
354
-		else if($exception instanceof TInvalidOperationException)
350
+		} else if($exception instanceof TInvalidOperationException)
355 351
 		{
356 352
 			// in case of getter or setter error, find out the exact file and row
357 353
 			if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null)
@@ -388,8 +384,7 @@  discard block
 block discarded – undo
388 384
 			{
389 385
 				$line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
390 386
 				$source.="<div class=\"error\">".$line."</div>";
391
-			}
392
-			else
387
+			} else
393 388
 				$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
394 389
 		}
395 390
 		return $source;
Please login to merge, or discard this patch.
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -113,6 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * It terminates the application immediately after the error is displayed.
114 114
 	 * @param mixed sender of the event
115 115
 	 * @param mixed event parameter (if the event is raised by TApplication, it refers to the exception instance)
116
+	 * @param null|\Prado\TApplication $sender
116 117
 	 */
117 118
 	public function handleError($sender,$param)
118 119
 	{
@@ -175,6 +176,7 @@  discard block
 block discarded – undo
175 176
 	 * mode will be displayed to the client user.
176 177
 	 * @param integer response status code
177 178
 	 * @param Exception exception instance
179
+	 * @param integer $statusCode
178 180
 	 */
179 181
 	protected function handleExternalError($statusCode,$exception)
180 182
 	{
@@ -367,6 +369,9 @@  discard block
 block discarded – undo
367 369
 		return $result;
368 370
 	}
369 371
 
372
+	/**
373
+	 * @param string $pattern
374
+	 */
370 375
 	private function getPropertyAccessTrace($trace,$pattern)
371 376
 	{
372 377
 		$result=null;
@@ -399,6 +404,9 @@  discard block
 block discarded – undo
399 404
 		return $source;
400 405
 	}
401 406
 
407
+	/**
408
+	 * @param string $message
409
+	 */
402 410
 	private function addLink($message)
403 411
 	{
404 412
 		$baseUrl='http://pradosoft.github.io/docs/manual/class-';
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		if(($templatePath=Prado::getPathOfNamespace($value))!==null && is_dir($templatePath))
103 103
 			$this->_templatePath=$templatePath;
104 104
 		else
105
-			throw new TConfigurationException('errorhandler_errortemplatepath_invalid',$value);
105
+			throw new TConfigurationException('errorhandler_errortemplatepath_invalid', $value);
106 106
 	}
107 107
 
108 108
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @param mixed sender of the event
115 115
 	 * @param mixed event parameter (if the event is raised by TApplication, it refers to the exception instance)
116 116
 	 */
117
-	public function handleError($sender,$param)
117
+	public function handleError($sender, $param)
118 118
 	{
119 119
 		static $handling=false;
120 120
 		// We need to restore error and exception handlers,
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 			if(!headers_sent())
134 134
 				header('Content-Type: text/html; charset=UTF-8');
135 135
 			if($param instanceof THttpException)
136
-				$this->handleExternalError($param->getStatusCode(),$param);
136
+				$this->handleExternalError($param->getStatusCode(), $param);
137 137
 			else if($this->getApplication()->getMode()===TApplicationMode::Debug)
138 138
 				$this->displayException($param);
139 139
 			else
140
-				$this->handleExternalError(500,$param);
140
+				$this->handleExternalError(500, $param);
141 141
 		}
142 142
 	}
143 143
 
@@ -150,21 +150,21 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	protected static function hideSecurityRelated($value, $exception=null)
152 152
 	{
153
-		$aRpl = array();
154
-		if($exception !== null && $exception instanceof \Exception)
153
+		$aRpl=array();
154
+		if($exception!==null && $exception instanceof \Exception)
155 155
 		{
156
-			$aTrace = $exception->getTrace();
156
+			$aTrace=$exception->getTrace();
157 157
 			foreach($aTrace as $item)
158 158
 			{
159 159
 				if(isset($item['file']))
160
-					$aRpl[dirname($item['file']) . DIRECTORY_SEPARATOR] = '<hidden>' . DIRECTORY_SEPARATOR;
160
+					$aRpl[dirname($item['file']).DIRECTORY_SEPARATOR]='<hidden>'.DIRECTORY_SEPARATOR;
161 161
 			}
162 162
 		}
163
-		$aRpl[$_SERVER['DOCUMENT_ROOT']] = '${DocumentRoot}';
164
-		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])] = '${DocumentRoot}';
165
-		$aRpl[PRADO_DIR . DIRECTORY_SEPARATOR] = '${PradoFramework}' . DIRECTORY_SEPARATOR;
163
+		$aRpl[$_SERVER['DOCUMENT_ROOT']]='${DocumentRoot}';
164
+		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])]='${DocumentRoot}';
165
+		$aRpl[PRADO_DIR.DIRECTORY_SEPARATOR]='${PradoFramework}'.DIRECTORY_SEPARATOR;
166 166
 		if(isset($aRpl[DIRECTORY_SEPARATOR])) unset($aRpl[DIRECTORY_SEPARATOR]);
167
-		$aRpl = array_reverse($aRpl, true);
167
+		$aRpl=array_reverse($aRpl, true);
168 168
 
169 169
 		return str_replace(array_keys($aRpl), $aRpl, $value);
170 170
 	}
@@ -176,36 +176,36 @@  discard block
 block discarded – undo
176 176
 	 * @param integer response status code
177 177
 	 * @param Exception exception instance
178 178
 	 */
179
-	protected function handleExternalError($statusCode,$exception)
179
+	protected function handleExternalError($statusCode, $exception)
180 180
 	{
181 181
 		if(!($exception instanceof THttpException))
182 182
 			error_log($exception->__toString());
183 183
 
184
-		$content=$this->getErrorTemplate($statusCode,$exception);
184
+		$content=$this->getErrorTemplate($statusCode, $exception);
185 185
 
186
-		$serverAdmin=isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:'';
186
+		$serverAdmin=isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : '';
187 187
 
188
-		$isDebug = $this->getApplication()->getMode()===TApplicationMode::Debug;
188
+		$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
189 189
 
190
-		$errorMessage = $exception->getMessage();
190
+		$errorMessage=$exception->getMessage();
191 191
 		if($isDebug)
192 192
 			$version=$_SERVER['SERVER_SOFTWARE'].' <a href="https://github.com/pradosoft/prado">PRADO</a>/'.Prado::getVersion();
193 193
 		else
194 194
 		{
195 195
 			$version='';
196
-			$errorMessage = self::hideSecurityRelated($errorMessage, $exception);
196
+			$errorMessage=self::hideSecurityRelated($errorMessage, $exception);
197 197
 		}
198 198
 		$tokens=array(
199 199
 			'%%StatusCode%%' => "$statusCode",
200 200
 			'%%ErrorMessage%%' => htmlspecialchars($errorMessage),
201 201
 			'%%ServerAdmin%%' => $serverAdmin,
202 202
 			'%%Version%%' => $version,
203
-			'%%Time%%' => @strftime('%Y-%m-%d %H:%M',time())
203
+			'%%Time%%' => @strftime('%Y-%m-%d %H:%M', time())
204 204
 		);
205 205
 
206 206
 		$this->getApplication()->getResponse()->setStatusCode($statusCode, $isDebug ? $exception->getMessage() : null);
207 207
 
208
-		echo strtr($content,$tokens);
208
+		echo strtr($content, $tokens);
209 209
 	}
210 210
 
211 211
 	/**
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 		if($exception instanceof TTemplateException)
251 251
 		{
252 252
 			$fileName=$exception->getTemplateFile();
253
-			$lines=empty($fileName)?explode("\n",$exception->getTemplateSource()):@file($fileName);
254
-			$source=$this->getSourceCode($lines,$exception->getLineNumber());
253
+			$lines=empty($fileName) ? explode("\n", $exception->getTemplateSource()) : @file($fileName);
254
+			$source=$this->getSourceCode($lines, $exception->getLineNumber());
255 255
 			if($fileName==='')
256 256
 				$fileName='---embedded template---';
257 257
 			$errorLine=$exception->getLineNumber();
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				$fileName=$exception->getFile();
269 269
 				$errorLine=$exception->getLine();
270 270
 			}
271
-			$source=$this->getSourceCode(@file($fileName),$errorLine);
271
+			$source=$this->getSourceCode(@file($fileName), $errorLine);
272 272
 		}
273 273
 
274 274
 		if($this->getApplication()->getMode()===TApplicationMode::Debug)
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 			'%%SourceCode%%' => $source,
284 284
 			'%%StackTrace%%' => htmlspecialchars($exception->getTraceAsString()),
285 285
 			'%%Version%%' => $version,
286
-			'%%Time%%' => @strftime('%Y-%m-%d %H:%M',time())
286
+			'%%Time%%' => @strftime('%Y-%m-%d %H:%M', time())
287 287
 		);
288 288
 
289 289
 		$content=$this->getExceptionTemplate($exception);
290 290
 
291
-		echo strtr($content,$tokens);
291
+		echo strtr($content, $tokens);
292 292
 	}
293 293
 
294 294
 	/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * @param Exception the exception to be displayed
326 326
 	 * @return string the template content
327 327
 	 */
328
-	protected function getErrorTemplate($statusCode,$exception)
328
+	protected function getErrorTemplate($statusCode, $exception)
329 329
 	{
330 330
 		$base=$this->getErrorTemplatePath().DIRECTORY_SEPARATOR.self::ERROR_FILE_NAME;
331 331
 		$lang=Prado::getPreferredLanguage();
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
 		else if($exception instanceof TInvalidOperationException)
359 359
 		{
360 360
 			// in case of getter or setter error, find out the exact file and row
361
-			if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null)
362
-				$result=$this->getPropertyAccessTrace($trace,'__set');
361
+			if(($result=$this->getPropertyAccessTrace($trace, '__get'))===null)
362
+				$result=$this->getPropertyAccessTrace($trace, '__set');
363 363
 		}
364
-		if($result!==null && strpos($result['file'],': eval()\'d code')!==false)
364
+		if($result!==null && strpos($result['file'], ': eval()\'d code')!==false)
365 365
 			return null;
366 366
 
367 367
 		return $result;
368 368
 	}
369 369
 
370
-	private function getPropertyAccessTrace($trace,$pattern)
370
+	private function getPropertyAccessTrace($trace, $pattern)
371 371
 	{
372 372
 		$result=null;
373 373
 		foreach($trace as $t)
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 		return $result;
381 381
 	}
382 382
 
383
-	private function getSourceCode($lines,$errorLine)
383
+	private function getSourceCode($lines, $errorLine)
384 384
 	{
385
-		$beginLine=$errorLine-self::SOURCE_LINES>=0?$errorLine-self::SOURCE_LINES:0;
386
-		$endLine=$errorLine+self::SOURCE_LINES<=count($lines)?$errorLine+self::SOURCE_LINES:count($lines);
385
+		$beginLine=$errorLine - self::SOURCE_LINES >= 0 ? $errorLine - self::SOURCE_LINES : 0;
386
+		$endLine=$errorLine + self::SOURCE_LINES <= count($lines) ? $errorLine + self::SOURCE_LINES : count($lines);
387 387
 
388 388
 		$source='';
389
-		for($i=$beginLine;$i<$endLine;++$i)
389
+		for($i=$beginLine; $i < $endLine; ++$i)
390 390
 		{
391
-			if($i===$errorLine-1)
391
+			if($i===$errorLine - 1)
392 392
 			{
393
-				$line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
393
+				$line=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
394 394
 				$source.="<div class=\"error\">".$line."</div>";
395 395
 			}
396 396
 			else
397
-				$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
397
+				$source.=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
398 398
 		}
399 399
 		return $source;
400 400
 	}
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	private function addLink($message)
403 403
 	{
404 404
 		$baseUrl='http://pradosoft.github.io/docs/manual/class-';
405
-		return preg_replace('/\b(T[A-Z]\w+)\b/',"<a href=\"$baseUrl\${1}\" target=\"_blank\">\${1}</a>",$message);
405
+		return preg_replace('/\b(T[A-Z]\w+)\b/', "<a href=\"$baseUrl\${1}\" target=\"_blank\">\${1}</a>", $message);
406 406
 	}
407 407
 }
408 408
 
Please login to merge, or discard this patch.
framework/Security/TUserManager.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -113,8 +113,7 @@  discard block
 block discarded – undo
113 113
 			{
114 114
 				$userFile = include $this->_userFile;
115 115
 				$this->loadUserDataFromPhp($userFile);
116
-			}
117
-			else
116
+			} else
118 117
 			{
119 118
 				$dom=new TXmlDocument;
120 119
 				$dom->loadFromFile($this->_userFile);
@@ -310,8 +309,7 @@  discard block
 block discarded – undo
310 309
 			$user=new TUser($this);
311 310
 			$user->setIsGuest(true);
312 311
 			return $user;
313
-		}
314
-		else
312
+		} else
315 313
 		{
316 314
 			$username=strtolower($username);
317 315
 			if(isset($this->_users[$username]))
@@ -322,8 +320,7 @@  discard block
 block discarded – undo
322 320
 				if(isset($this->_roles[$username]))
323 321
 					$user->setRoles($this->_roles[$username]);
324 322
 				return $user;
325
-			}
326
-			else
323
+			} else
327 324
 				return null;
328 325
 		}
329 326
 	}
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		{
115 115
 			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
116 116
 			{
117
-				$userFile = include $this->_userFile;
117
+				$userFile=include $this->_userFile;
118 118
 				$this->loadUserDataFromPhp($userFile);
119 119
 			}
120 120
 			else
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 		{
150 150
 			foreach($config['users'] as $user)
151 151
 			{
152
-				$name = trim(strtolower(isset($user['name'])?$user['name']:''));
153
-				$password = isset($user['password'])?$user['password']:'';
154
-				$this->_users[$name] = $password;
155
-				$roles = isset($user['roles'])?$user['roles']:'';
152
+				$name=trim(strtolower(isset($user['name']) ? $user['name'] : ''));
153
+				$password=isset($user['password']) ? $user['password'] : '';
154
+				$this->_users[$name]=$password;
155
+				$roles=isset($user['roles']) ? $user['roles'] : '';
156 156
 				if($roles!=='')
157 157
 				{
158
-					foreach(explode(',',$roles) as $role)
158
+					foreach(explode(',', $roles) as $role)
159 159
 					{
160 160
 						if(($role=trim($role))!=='')
161 161
 							$this->_roles[$name][]=$role;
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 		{
168 168
 			foreach($config['roles'] as $role)
169 169
 			{
170
-				$name = isset($role['name'])?$role['name']:'';
171
-				$users = isset($role['users'])?$role['users']:'';
172
-				foreach(explode(',',$users) as $user)
170
+				$name=isset($role['name']) ? $role['name'] : '';
171
+				$users=isset($role['users']) ? $role['users'] : '';
172
+				foreach(explode(',', $users) as $user)
173 173
 				{
174 174
 					if(($user=trim($user))!=='')
175 175
 						$this->_roles[strtolower($user)][]=$name;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			$this->_users[$name]=$node->getAttribute('password');
191 191
 			if(($roles=trim($node->getAttribute('roles')))!=='')
192 192
 			{
193
-				foreach(explode(',',$roles) as $role)
193
+				foreach(explode(',', $roles) as $role)
194 194
 				{
195 195
 					if(($role=trim($role))!=='')
196 196
 						$this->_roles[$name][]=$role;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 		foreach($xmlNode->getElementsByTagName('role') as $node)
201 201
 		{
202
-			foreach(explode(',',$node->getAttribute('users')) as $user)
202
+			foreach(explode(',', $node->getAttribute('users')) as $user)
203 203
 			{
204 204
 				if(($user=trim($user))!=='')
205 205
 					$this->_roles[strtolower($user)][]=$node->getAttribute('name');
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 	{
250 250
 		if($this->_initialized)
251 251
 			throw new TInvalidOperationException('usermanager_userfile_unchangeable');
252
-		else if(($this->_userFile=Prado::getPathOfNamespace($value,self::USER_FILE_EXT))===null || !is_file($this->_userFile))
253
-			throw new TConfigurationException('usermanager_userfile_invalid',$value);
252
+		else if(($this->_userFile=Prado::getPathOfNamespace($value, self::USER_FILE_EXT))===null || !is_file($this->_userFile))
253
+			throw new TConfigurationException('usermanager_userfile_invalid', $value);
254 254
 	}
255 255
 
256 256
 	/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public function setPasswordMode($value)
284 284
 	{
285
-		$this->_passwordMode=TPropertyValue::ensureEnum($value,'Prado\\Security\\TUserManagerPasswordMode');
285
+		$this->_passwordMode=TPropertyValue::ensureEnum($value, 'Prado\\Security\\TUserManagerPasswordMode');
286 286
 	}
287 287
 
288 288
 	/**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @param string password
292 292
 	 * @return boolean true if validation is successful, false otherwise.
293 293
 	 */
294
-	public function validateUser($username,$password)
294
+	public function validateUser($username, $password)
295 295
 	{
296 296
 		if($this->_passwordMode===TUserManagerPasswordMode::MD5)
297 297
 			$password=md5($password);
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			$data=unserialize($data);
345 345
 			if(is_array($data) && count($data)===2)
346 346
 			{
347
-				list($username,$token)=$data;
347
+				list($username, $token)=$data;
348 348
 				if(isset($this->_users[$username]) && $token===md5($username.$this->_users[$username]))
349 349
 					return $this->getUser($username);
350 350
 			}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		$username=strtolower($user->getName());
364 364
 		if(isset($this->_users[$username]))
365 365
 		{
366
-			$data=array($username,md5($username.$this->_users[$username]));
366
+			$data=array($username, md5($username.$this->_users[$username]));
367 367
 			$cookie->setValue(serialize($data));
368 368
 		}
369 369
 	}
Please login to merge, or discard this patch.
framework/I18N/TDateFormat.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,8 +112,7 @@
 block discarded – undo
112 112
 			&& strlen($datetime[1]) == 1)
113 113
 		{
114 114
 			$pattern = $datetime;
115
-		}
116
-		else //no subpattern, try the presets
115
+		} else //no subpattern, try the presets
117 116
 			$pattern = $this->getPreset($string);
118 117
 
119 118
 		//no presets found, use the string as the pattern
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 * A set of pattern presets and their respective formatting shorthand.
71 71
 	 * @var array
72 72
 	 */
73
-	static private $_patternPresets = array(
74
-			'fulldate'=>'P','full'=>'P',
75
-			'longdate'=>'D','long'=>'d',
76
-			'mediumdate'=>'p','medium'=>'p',
77
-			'shortdate'=>'d','short'=>'d',
73
+	static private $_patternPresets=array(
74
+			'fulldate'=>'P', 'full'=>'P',
75
+			'longdate'=>'D', 'long'=>'d',
76
+			'mediumdate'=>'p', 'medium'=>'p',
77
+			'shortdate'=>'d', 'short'=>'d',
78 78
 			'fulltime'=>'Q', 'longtime'=>'T',
79 79
 			'mediumtime'=>'q', 'shorttime'=>'t');
80 80
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function setPattern($value)
86 86
 	{
87
-		$this->setViewState('Pattern',$value,'');
87
+		$this->setViewState('Pattern', $value, '');
88 88
 	}
89 89
 
90 90
 	/**
@@ -93,35 +93,35 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function getPattern()
95 95
 	{
96
-		$string = $this->getViewState('Pattern','');
96
+		$string=$this->getViewState('Pattern', '');
97 97
 
98
-		$pattern = null;
98
+		$pattern=null;
99 99
 
100 100
 		//try the subpattern of "date time" presets
101
-		$subpatterns = explode(' ',$string,2);
102
-		$datetime = array();
101
+		$subpatterns=explode(' ', $string, 2);
102
+		$datetime=array();
103 103
 		if(count($subpatterns)==2)
104 104
 		{
105
-			$datetime[] = $this->getPreset($subpatterns[0]);
106
-			$datetime[] = $this->getPreset($subpatterns[1]);
105
+			$datetime[]=$this->getPreset($subpatterns[0]);
106
+			$datetime[]=$this->getPreset($subpatterns[1]);
107 107
 		}
108 108
 
109 109
 		//we have a good subpattern
110
-		if(count($datetime) == 2
111
-			&& strlen($datetime[0]) == 1
112
-			&& strlen($datetime[1]) == 1)
110
+		if(count($datetime)==2
111
+			&& strlen($datetime[0])==1
112
+			&& strlen($datetime[1])==1)
113 113
 		{
114
-			$pattern = $datetime;
114
+			$pattern=$datetime;
115 115
 		}
116 116
 		else //no subpattern, try the presets
117
-			$pattern = $this->getPreset($string);
117
+			$pattern=$this->getPreset($string);
118 118
 
119 119
 		//no presets found, use the string as the pattern
120 120
 		//and let the DateFormat handle it.
121 121
 		if($pattern===null)
122
-			$pattern = $string;
123
-		if (!is_array($pattern) && strlen($pattern) == 0)
124
-			$pattern = null;
122
+			$pattern=$string;
123
+		if(!is_array($pattern) && strlen($pattern)==0)
124
+			$pattern=null;
125 125
 		return $pattern;
126 126
 	}
127 127
 
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	protected function getPreset($string)
134 134
 	{
135
-		$string = strtolower($string);
135
+		$string=strtolower($string);
136 136
 		foreach(self::$_patternPresets as $pattern => $preset)
137 137
 		{
138
-			if($string == $pattern)
138
+			if($string==$pattern)
139 139
 				return $preset;
140 140
 		}
141 141
 	}
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function getValue()
148 148
 	{
149
-		$value = $this->getViewState('Value','');
149
+		$value=$this->getViewState('Value', '');
150 150
 		if(empty($value))
151 151
 		{
152
-			$defaultText = $this->getDefaultText();
152
+			$defaultText=$this->getDefaultText();
153 153
 			if(empty($defaultText))
154 154
 				return time();
155 155
 		}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function setValue($value)
164 164
 	{
165
-		$this->setViewState('Value',$value,'');
165
+		$this->setViewState('Value', $value, '');
166 166
 	}
167 167
 
168 168
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function getDefaultText()
173 173
 	{
174
-		return $this->getViewState('DefaultText','');
174
+		return $this->getViewState('DefaultText', '');
175 175
 	}
176 176
 
177 177
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function setDefaultText($value)
182 182
 	{
183
-		$this->setViewState('DefaultText',$value,'');
183
+		$this->setViewState('DefaultText', $value, '');
184 184
 	}
185 185
 
186 186
 	/**
@@ -217,29 +217,29 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	protected function getFormattedDate()
219 219
 	{
220
-		$value = $this->getValue();
221
-		$defaultText = $this->getDefaultText();
220
+		$value=$this->getValue();
221
+		$defaultText=$this->getDefaultText();
222 222
 		if(empty($value) && !empty($defaultText))
223 223
 			return $this->getDefaultText();
224 224
 
225
-		$app = $this->getApplication()->getGlobalization();
225
+		$app=$this->getApplication()->getGlobalization();
226 226
 
227 227
 		//initialized the default class wide formatter
228 228
 		if(self::$formatter===null)
229
-			self::$formatter = new DateFormat($app->getCulture());
229
+			self::$formatter=new DateFormat($app->getCulture());
230 230
 
231
-		$culture = $this->getCulture();
231
+		$culture=$this->getCulture();
232 232
 
233 233
 		//return the specific cultural formatted date time
234
-		if(strlen($culture) && $app->getCulture() !== $culture)
234
+		if(strlen($culture) && $app->getCulture()!==$culture)
235 235
 		{
236
-			$formatter = new DateFormat($culture);
236
+			$formatter=new DateFormat($culture);
237 237
 			return $formatter->format($value,
238 238
 									  $this->getPattern(),
239 239
 									  $this->getCharset());
240 240
 		}
241 241
 		//return the application wide culture formatted date time.
242
-		$result = self::$formatter->format($value,
242
+		$result=self::$formatter->format($value,
243 243
 										$this->getPattern(),
244 244
 										$this->getCharset());
245 245
 		return $result;
Please login to merge, or discard this patch.