Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Util/TDbLogRoute.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function __destruct()
69 69
 	{
70
-		if($this->_db !== null)
70
+		if ($this->_db !== null)
71 71
 			$this->_db->setActive(false);
72 72
 	}
73 73
 
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 		$db = $this->getDbConnection();
84 84
 		$db->setActive(true);
85 85
 
86
-		$sql = 'SELECT * FROM ' . $this->_logTable . ' WHERE 0=1';
86
+		$sql = 'SELECT * FROM '.$this->_logTable.' WHERE 0=1';
87 87
 		try
88 88
 		{
89 89
 			$db->createCommand($sql)->query()->close();
90 90
 		}
91
-		catch(Exception $e)
91
+		catch (Exception $e)
92 92
 		{
93 93
 			// DB table not exists
94
-			if($this->_autoCreate)
94
+			if ($this->_autoCreate)
95 95
 				$this->createDbTable();
96 96
 			else
97 97
 				throw new TConfigurationException('db_logtable_inexistent', $this->_logTable);
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function processLogs($logs)
108 108
 	{
109
-		$sql = 'INSERT INTO ' . $this->_logTable . '(level, category, logtime, message) VALUES (:level, :category, :logtime, :message)';
109
+		$sql = 'INSERT INTO '.$this->_logTable.'(level, category, logtime, message) VALUES (:level, :category, :logtime, :message)';
110 110
 		$command = $this->getDbConnection()->createCommand($sql);
111
-		foreach($logs as $log)
111
+		foreach ($logs as $log)
112 112
 		{
113 113
 			$command->bindValue(':message', $log[0]);
114 114
 			$command->bindValue(':level', $log[1]);
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 		$db = $this->getDbConnection();
128 128
 		$driver = $db->getDriverName();
129 129
 		$autoidAttributes = '';
130
-		if($driver === 'mysql')
130
+		if ($driver === 'mysql')
131 131
 			$autoidAttributes = 'AUTO_INCREMENT';
132 132
 
133
-		$sql = 'CREATE TABLE ' . $this->_logTable . ' (
134
-			log_id INTEGER NOT NULL PRIMARY KEY ' . $autoidAttributes . ',
133
+		$sql = 'CREATE TABLE '.$this->_logTable.' (
134
+			log_id INTEGER NOT NULL PRIMARY KEY ' . $autoidAttributes.',
135 135
 			level INTEGER,
136 136
 			category VARCHAR(128),
137 137
 			logtime VARCHAR(20),
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	protected function createDbConnection()
149 149
 	{
150
-		if($this->_connID !== '')
150
+		if ($this->_connID !== '')
151 151
 		{
152 152
 			$config = $this->getApplication()->getModule($this->_connID);
153
-			if($config instanceof TDataSourceConfig)
153
+			if ($config instanceof TDataSourceConfig)
154 154
 				return $config->getDbConnection();
155 155
 			else
156 156
 				throw new TConfigurationException('dblogroute_connectionid_invalid', $this->_connID);
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 		{
160 160
 			$db = new TDbConnection;
161 161
 			// default to SQLite3 database
162
-			$dbFile = $this->getApplication()->getRuntimePath() . '/sqlite3.log';
163
-			$db->setConnectionString('sqlite:' . $dbFile);
162
+			$dbFile = $this->getApplication()->getRuntimePath().'/sqlite3.log';
163
+			$db->setConnectionString('sqlite:'.$dbFile);
164 164
 			return $db;
165 165
 		}
166 166
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function getDbConnection()
172 172
 	{
173
-		if($this->_db === null)
173
+		if ($this->_db === null)
174 174
 			$this->_db = $this->createDbConnection();
175 175
 		return $this->_db;
176 176
 	}
Please login to merge, or discard this patch.
Braces   +21 added lines, -18 removed lines patch added patch discarded remove patch
@@ -67,8 +67,9 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function __destruct()
69 69
 	{
70
-		if($this->_db !== null)
71
-			$this->_db->setActive(false);
70
+		if($this->_db !== null) {
71
+					$this->_db->setActive(false);
72
+		}
72 73
 	}
73 74
 
74 75
 	/**
@@ -87,14 +88,14 @@  discard block
 block discarded – undo
87 88
 		try
88 89
 		{
89 90
 			$db->createCommand($sql)->query()->close();
90
-		}
91
-		catch(Exception $e)
91
+		} catch(Exception $e)
92 92
 		{
93 93
 			// DB table not exists
94
-			if($this->_autoCreate)
95
-				$this->createDbTable();
96
-			else
97
-				throw new TConfigurationException('db_logtable_inexistent', $this->_logTable);
94
+			if($this->_autoCreate) {
95
+							$this->createDbTable();
96
+			} else {
97
+							throw new TConfigurationException('db_logtable_inexistent', $this->_logTable);
98
+			}
98 99
 		}
99 100
 
100 101
 		parent::init($config);
@@ -127,8 +128,9 @@  discard block
 block discarded – undo
127 128
 		$db = $this->getDbConnection();
128 129
 		$driver = $db->getDriverName();
129 130
 		$autoidAttributes = '';
130
-		if($driver === 'mysql')
131
-			$autoidAttributes = 'AUTO_INCREMENT';
131
+		if($driver === 'mysql') {
132
+					$autoidAttributes = 'AUTO_INCREMENT';
133
+		}
132 134
 
133 135
 		$sql = 'CREATE TABLE ' . $this->_logTable . ' (
134 136
 			log_id INTEGER NOT NULL PRIMARY KEY ' . $autoidAttributes . ',
@@ -150,12 +152,12 @@  discard block
 block discarded – undo
150 152
 		if($this->_connID !== '')
151 153
 		{
152 154
 			$config = $this->getApplication()->getModule($this->_connID);
153
-			if($config instanceof TDataSourceConfig)
154
-				return $config->getDbConnection();
155
-			else
156
-				throw new TConfigurationException('dblogroute_connectionid_invalid', $this->_connID);
157
-		}
158
-		else
155
+			if($config instanceof TDataSourceConfig) {
156
+							return $config->getDbConnection();
157
+			} else {
158
+							throw new TConfigurationException('dblogroute_connectionid_invalid', $this->_connID);
159
+			}
160
+		} else
159 161
 		{
160 162
 			$db = new TDbConnection;
161 163
 			// default to SQLite3 database
@@ -170,8 +172,9 @@  discard block
 block discarded – undo
170 172
 	 */
171 173
 	public function getDbConnection()
172 174
 	{
173
-		if($this->_db === null)
174
-			$this->_db = $this->createDbConnection();
175
+		if($this->_db === null) {
176
+					$this->_db = $this->createDbConnection();
177
+		}
175 178
 		return $this->_db;
176 179
 	}
177 180
 
Please login to merge, or discard this patch.
framework/IO/TTarFileExtractor.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
 
145 145
 		  // ----- Look if a local copy need to be done
146 146
 		  if ($this->_temp_tarname == '') {
147
-			  $this->_temp_tarname = uniqid('tar') . '.tmp';
147
+			  $this->_temp_tarname = uniqid('tar').'.tmp';
148 148
 			  if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
149 149
 				$this->_error('Unable to open in read mode \''
150
-							  . $this->_tarname . '\'');
150
+							  . $this->_tarname.'\'');
151 151
 				$this->_temp_tarname = '';
152 152
 				return false;
153 153
 			  }
154 154
 			  if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
155 155
 				$this->_error('Unable to open in write mode \''
156
-							  . $this->_temp_tarname . '\'');
156
+							  . $this->_temp_tarname.'\'');
157 157
 				$this->_temp_tarname = '';
158 158
 				return false;
159 159
 			  }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		$this->_file = @fopen($v_filename, "rb");
174 174
 
175 175
 		if ($this->_file == 0) {
176
-			$this->_error('Unable to open in read mode \'' . $v_filename . '\'');
176
+			$this->_error('Unable to open in read mode \''.$v_filename.'\'');
177 177
 			return false;
178 178
 		}
179 179
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
 		if (strlen($v_binary_data) != 512) {
248 248
 			$v_header['filename'] = '';
249
-			$this->_error('Invalid block size : ' . strlen($v_binary_data));
249
+			$this->_error('Invalid block size : '.strlen($v_binary_data));
250 250
 			return false;
251 251
 		}
252 252
 
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 			if (($v_checksum == 256) && ($v_header['checksum'] == 0))
277 277
 				return true;
278 278
 
279
-			$this->_error('Invalid checksum for file "' . $v_data['filename']
280
-						  . '" : ' . $v_checksum . ' calculated, '
281
-						  . $v_header['checksum'] . ' expected');
279
+			$this->_error('Invalid checksum for file "'.$v_data['filename']
280
+						  . '" : '.$v_checksum.' calculated, '
281
+						  . $v_header['checksum'].' expected');
282 282
 			return false;
283 283
 		}
284 284
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	$p_path = $this->_translateWinPath($p_path, false);
331 331
 	if ($p_path == '' || (substr($p_path, 0, 1) != '/'
332 332
 		&& substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
333
-	  $p_path = "./" . $p_path;
333
+	  $p_path = "./".$p_path;
334 334
 	}
335 335
 	$p_remove_path = $this->_translateWinPath($p_remove_path);
336 336
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		  $v_listing = true;
354 354
 	  break;
355 355
 	  default :
356
-		$this->_error('Invalid extract mode (' . $p_mode . ')');
356
+		$this->_error('Invalid extract mode ('.$p_mode.')');
357 357
 		return false;
358 358
 	}
359 359
 
@@ -416,25 +416,25 @@  discard block
 block discarded – undo
416 416
 			$p_path = substr($p_path, 0, strlen($p_path) - 1);
417 417
 
418 418
 		  if (substr($v_header['filename'], 0, 1) == '/')
419
-			  $v_header['filename'] = $p_path . $v_header['filename'];
419
+			  $v_header['filename'] = $p_path.$v_header['filename'];
420 420
 		  else
421
-			$v_header['filename'] = $p_path . '/' . $v_header['filename'];
421
+			$v_header['filename'] = $p_path.'/'.$v_header['filename'];
422 422
 		}
423 423
 		if (file_exists($v_header['filename'])) {
424 424
 		  if ((@is_dir($v_header['filename']))
425 425
 			  && ($v_header['typeflag'] == '')) {
426
-			$this->_error('File ' . $v_header['filename']
426
+			$this->_error('File '.$v_header['filename']
427 427
 						  . ' already exists as a directory');
428 428
 			return false;
429 429
 		  }
430 430
 		  if (($this->_isArchive($v_header['filename']))
431 431
 			  && ($v_header['typeflag'] == "5")) {
432
-			$this->_error('Directory ' . $v_header['filename']
432
+			$this->_error('Directory '.$v_header['filename']
433 433
 						  . ' already exists as a file');
434 434
 			return false;
435 435
 		  }
436 436
 		  if (!is_writable($v_header['filename'])) {
437
-			$this->_error('File ' . $v_header['filename']
437
+			$this->_error('File '.$v_header['filename']
438 438
 						  . ' already exists and is write protected');
439 439
 			return false;
440 440
 		  }
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 		// ----- Check the directory availability and create it if necessary
447 447
 		elseif (($v_result
448 448
 				 = $this->_dirCheck(($v_header['typeflag'] == "5"
449
-									?$v_header['filename']
449
+									? $v_header['filename']
450 450
 									:dirname($v_header['filename'])))) != 1) {
451
-			$this->_error('Unable to create path for ' . $v_header['filename']);
451
+			$this->_error('Unable to create path for '.$v_header['filename']);
452 452
 			return false;
453 453
 		}
454 454
 
@@ -457,14 +457,14 @@  discard block
 block discarded – undo
457 457
 			if (!@file_exists($v_header['filename'])) {
458 458
 				if (!@mkdir($v_header['filename'], PRADO_CHMOD)) {
459 459
 					$this->_error('Unable to create directory {'
460
-								  . $v_header['filename'] . '}');
460
+								  . $v_header['filename'].'}');
461 461
 					return false;
462 462
 				}
463 463
 				chmod($v_header['filename'], PRADO_CHMOD);
464 464
 			}
465 465
 		  } else {
466 466
 			  if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
467
-				  $this->_error('Error while opening {' . $v_header['filename']
467
+				  $this->_error('Error while opening {'.$v_header['filename']
468 468
 								. '} in write binary mode');
469 469
 				  return false;
470 470
 			  } else {
@@ -489,10 +489,10 @@  discard block
 block discarded – undo
489 489
 		  // ----- Check the file size
490 490
 		  clearstatcache();
491 491
 		  if (filesize($v_header['filename']) != $v_header['size']) {
492
-			  $this->_error('Extracted file ' . $v_header['filename']
492
+			  $this->_error('Extracted file '.$v_header['filename']
493 493
 							. ' does not have the correct file size \''
494 494
 							. filesize($v_header['filename'])
495
-							. '\' (' . $v_header['size']
495
+							. '\' ('.$v_header['size']
496 496
 							. ' expected). Archive may be corrupted.');
497 497
 			  return false;
498 498
 		  }
Please login to merge, or discard this patch.
Braces   +59 added lines, -40 removed lines patch added patch discarded remove patch
@@ -69,8 +69,9 @@  discard block
 block discarded – undo
69 69
 	{
70 70
 		$this->_close();
71 71
 		// ----- Look for a local copy to delete
72
-		if ($this->_temp_tarname != '')
73
-			@unlink($this->_temp_tarname);
72
+		if ($this->_temp_tarname != '') {
73
+					@unlink($this->_temp_tarname);
74
+		}
74 75
 	}
75 76
 
76 77
 	public function extract($p_path = '')
@@ -157,8 +158,9 @@  discard block
 block discarded – undo
157 158
 				$this->_temp_tarname = '';
158 159
 				return false;
159 160
 			  }
160
-			  while ($v_data = @fread($v_file_from, 1024))
161
-				  @fwrite($v_file_to, $v_data);
161
+			  while ($v_data = @fread($v_file_from, 1024)) {
162
+			  				  @fwrite($v_file_to, $v_data);
163
+			  }
162 164
 			  @fclose($v_file_from);
163 165
 			  @fclose($v_file_to);
164 166
 		  }
@@ -166,9 +168,10 @@  discard block
 block discarded – undo
166 168
 		  // ----- File to open if the local copy
167 169
 		  $v_filename = $this->_temp_tarname;
168 170
 
169
-		} else
170
-		  // ----- File to open if the normal Tar file
171
+		} else {
172
+				  // ----- File to open if the normal Tar file
171 173
 		  $v_filename = $this->_tarname;
174
+		}
172 175
 
173 176
 		$this->_file = @fopen($v_filename, "rb");
174 177
 
@@ -229,8 +232,9 @@  discard block
 block discarded – undo
229 232
 	private function _jumpBlock($p_len = null)
230 233
 	{
231 234
 	  if (is_resource($this->_file)) {
232
-		  if ($p_len === null)
233
-			  $p_len = 1;
235
+		  if ($p_len === null) {
236
+		  			  $p_len = 1;
237
+		  }
234 238
 
235 239
 			  @fseek($this->_file, @ftell($this->_file) + ($p_len * 512));
236 240
 	  }
@@ -253,14 +257,17 @@  discard block
 block discarded – undo
253 257
 		// ----- Calculate the checksum
254 258
 		$v_checksum = 0;
255 259
 		// ..... First part of the header
256
-		for ($i = 0; $i < 148; $i++)
257
-			$v_checksum += ord(substr($v_binary_data, $i, 1));
260
+		for ($i = 0; $i < 148; $i++) {
261
+					$v_checksum += ord(substr($v_binary_data, $i, 1));
262
+		}
258 263
 		// ..... Ignore the checksum value and replace it by ' ' (space)
259
-		for ($i = 148; $i < 156; $i++)
260
-			$v_checksum += ord(' ');
264
+		for ($i = 148; $i < 156; $i++) {
265
+					$v_checksum += ord(' ');
266
+		}
261 267
 		// ..... Last part of the header
262
-		for ($i = 156; $i < 512; $i++)
263
-		   $v_checksum += ord(substr($v_binary_data, $i, 1));
268
+		for ($i = 156; $i < 512; $i++) {
269
+				   $v_checksum += ord(substr($v_binary_data, $i, 1));
270
+		}
264 271
 
265 272
 		$v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
266 273
 						 . "a8checksum/a1typeflag/a100link/a6magic/a2version/"
@@ -273,8 +280,9 @@  discard block
 block discarded – undo
273 280
 			$v_header['filename'] = '';
274 281
 
275 282
 			// ----- Look for last block (empty block)
276
-			if (($v_checksum == 256) && ($v_header['checksum'] == 0))
277
-				return true;
283
+			if (($v_checksum == 256) && ($v_header['checksum'] == 0)) {
284
+							return true;
285
+			}
278 286
 
279 287
 			$this->_error('Invalid checksum for file "' . $v_data['filename']
280 288
 						  . '" : ' . $v_checksum . ' calculated, '
@@ -311,8 +319,9 @@  discard block
 block discarded – undo
311 319
 	  // ----- Read the next header
312 320
 	  $v_binary_data = $this->_readBlock();
313 321
 
314
-	  if (!$this->_readHeader($v_binary_data, $v_header))
315
-		return false;
322
+	  if (!$this->_readHeader($v_binary_data, $v_header)) {
323
+	  		return false;
324
+	  }
316 325
 
317 326
 	  $v_header['filename'] = $v_filename;
318 327
 
@@ -335,8 +344,9 @@  discard block
 block discarded – undo
335 344
 	$p_remove_path = $this->_translateWinPath($p_remove_path);
336 345
 
337 346
 	// ----- Look for path to remove format (should end by /)
338
-	if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
339
-	  $p_remove_path .= '/';
347
+	if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/')) {
348
+		  $p_remove_path .= '/';
349
+	}
340 350
 	$p_remove_path_size = strlen($p_remove_path);
341 351
 
342 352
 	switch ($p_mode) {
@@ -364,8 +374,9 @@  discard block
 block discarded – undo
364 374
 	  $v_extract_file = false;
365 375
 	  $v_extraction_stopped = 0;
366 376
 
367
-	  if (!$this->_readHeader($v_binary_data, $v_header))
368
-		return false;
377
+	  if (!$this->_readHeader($v_binary_data, $v_header)) {
378
+	  		return false;
379
+	  }
369 380
 
370 381
 	  if ($v_header['filename'] == '') {
371 382
 		continue;
@@ -373,8 +384,9 @@  discard block
 block discarded – undo
373 384
 
374 385
 	  // ----- Look for long filename
375 386
 	  if ($v_header['typeflag'] == 'L') {
376
-		if (!$this->_readLongHeader($v_header))
377
-		  return false;
387
+		if (!$this->_readLongHeader($v_header)) {
388
+				  return false;
389
+		}
378 390
 	  }
379 391
 
380 392
 	  if ((!$v_extract_all) && (is_array($p_file_list))) {
@@ -408,17 +420,20 @@  discard block
 block discarded – undo
408 420
 	  {
409 421
 		if (($p_remove_path != '')
410 422
 			&& (substr($v_header['filename'], 0, $p_remove_path_size)
411
-				== $p_remove_path))
412
-		  $v_header['filename'] = substr($v_header['filename'],
423
+				== $p_remove_path)) {
424
+				  $v_header['filename'] = substr($v_header['filename'],
413 425
 										 $p_remove_path_size);
426
+		}
414 427
 		if (($p_path != './') && ($p_path != '/')) {
415
-		  while (substr($p_path, -1) == '/')
416
-			$p_path = substr($p_path, 0, strlen($p_path) - 1);
428
+		  while (substr($p_path, -1) == '/') {
429
+		  			$p_path = substr($p_path, 0, strlen($p_path) - 1);
430
+		  }
417 431
 
418
-		  if (substr($v_header['filename'], 0, 1) == '/')
419
-			  $v_header['filename'] = $p_path . $v_header['filename'];
420
-		  else
421
-			$v_header['filename'] = $p_path . '/' . $v_header['filename'];
432
+		  if (substr($v_header['filename'], 0, 1) == '/') {
433
+		  			  $v_header['filename'] = $p_path . $v_header['filename'];
434
+		  } else {
435
+		  			$v_header['filename'] = $p_path . '/' . $v_header['filename'];
436
+		  }
422 437
 		}
423 438
 		if (file_exists($v_header['filename'])) {
424 439
 		  if ((@is_dir($v_header['filename']))
@@ -514,10 +529,12 @@  discard block
 block discarded – undo
514 529
 	  if ($v_listing || $v_extract_file || $v_extraction_stopped) {
515 530
 		// ----- Log extracted files
516 531
 		if (($v_file_dir = dirname($v_header['filename']))
517
-			== $v_header['filename'])
518
-		  $v_file_dir = '';
519
-		if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
520
-		  $v_file_dir = '/';
532
+			== $v_header['filename']) {
533
+				  $v_file_dir = '';
534
+		}
535
+		if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == '')) {
536
+				  $v_file_dir = '/';
537
+		}
521 538
 
522 539
 		$p_list_detail[$v_nb++] = $v_header;
523 540
 	  }
@@ -536,15 +553,17 @@  discard block
 block discarded – undo
536 553
 	 */
537 554
 	protected function _dirCheck($p_dir)
538 555
 	{
539
-		if ((@is_dir($p_dir)) || ($p_dir == ''))
540
-			return true;
556
+		if ((@is_dir($p_dir)) || ($p_dir == '')) {
557
+					return true;
558
+		}
541 559
 
542 560
 		$p_parent_dir = dirname($p_dir);
543 561
 
544 562
 		if (($p_parent_dir != $p_dir) &&
545 563
 			($p_parent_dir != '') &&
546
-			(!$this->_dirCheck($p_parent_dir)))
547
-			 return false;
564
+			(!$this->_dirCheck($p_parent_dir))) {
565
+					 return false;
566
+		}
548 567
 
549 568
 		if (!@mkdir($p_dir, PRADO_CHMOD)) {
550 569
 			$this->_error("Unable to create directory '$p_dir'");
Please login to merge, or discard this patch.
framework/TComponent.php 2 patches
Spacing   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
 	 * through each parent to the top most class, TComponent.
345 345
 	 */
346 346
 	public function __construct() {
347
-		if($this->getAutoGlobalListen())
347
+		if ($this->getAutoGlobalListen())
348 348
 			$this->listen();
349 349
 
350 350
 		$classes = array_reverse($this->getClassHierarchy(true));
351
-		foreach($classes as $class) {
352
-			if(isset(self::$_um[$class]))
351
+		foreach ($classes as $class) {
352
+			if (isset(self::$_um[$class]))
353 353
 				$this->attachBehaviors(self::$_um[$class]);
354 354
 		}
355 355
 	}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 * called must be explicitly called.
381 381
 	 */
382 382
 	public function __destruct() {
383
-		if($this->_listeningenabled)
383
+		if ($this->_listeningenabled)
384 384
 			$this->unlisten();
385 385
 	}
386 386
 
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	{
405 405
 		$class = get_class($this);
406 406
 		$classes = [$class];
407
-		while($class = get_parent_class($class)){array_unshift($classes, $class);}
408
-		if($lowercase)
407
+		while ($class = get_parent_class($class)) {array_unshift($classes, $class); }
408
+		if ($lowercase)
409 409
 			return array_map('strtolower', $classes);
410 410
 		return $classes;
411 411
 	}
@@ -426,16 +426,16 @@  discard block
 block discarded – undo
426 426
 	 * @return numeric the number of global events that were registered to the global event registry
427 427
 	 */
428 428
 	public function listen() {
429
-		if($this->_listeningenabled)
429
+		if ($this->_listeningenabled)
430 430
 			return;
431 431
 
432
-		$fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']);
432
+		$fx = array_filter(get_class_methods($this), [$this, 'filter_prado_fx']);
433 433
 
434
-		foreach($fx as $func)
435
-			$this->attachEventHandler($func, [$this,$func]);
434
+		foreach ($fx as $func)
435
+			$this->attachEventHandler($func, [$this, $func]);
436 436
 
437
-		if(is_a($this, 'Prado\\Util\\IDynamicMethods')) {
438
-			$this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']);
437
+		if (is_a($this, 'Prado\\Util\\IDynamicMethods')) {
438
+			$this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this, '__dycall']);
439 439
 			array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER);
440 440
 		}
441 441
 
@@ -460,16 +460,16 @@  discard block
 block discarded – undo
460 460
 	 * @return numeric the number of global events that were unregistered from the global event registry
461 461
 	 */
462 462
 	public function unlisten() {
463
-		if(!$this->_listeningenabled)
463
+		if (!$this->_listeningenabled)
464 464
 			return;
465 465
 
466
-		$fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']);
466
+		$fx = array_filter(get_class_methods($this), [$this, 'filter_prado_fx']);
467 467
 
468
-		foreach($fx as $func)
469
-			$this->detachEventHandler($func, [$this,$func]);
468
+		foreach ($fx as $func)
469
+			$this->detachEventHandler($func, [$this, $func]);
470 470
 
471
-		if(is_a($this, 'Prado\\Util\\IDynamicMethods')) {
472
-			$this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']);
471
+		if (is_a($this, 'Prado\\Util\\IDynamicMethods')) {
472
+			$this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this, '__dycall']);
473 473
 			array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER);
474 474
 		}
475 475
 
@@ -516,60 +516,60 @@  discard block
 block discarded – undo
516 516
 	public function __call($method, $args)
517 517
 	{
518 518
 		$getset = substr($method, 0, 3);
519
-		if(($getset == 'get') || ($getset == 'set'))
519
+		if (($getset == 'get') || ($getset == 'set'))
520 520
 		{
521 521
 			$propname = substr($method, 3);
522
-			$jsmethod = $getset . 'js' . $propname;
523
-			if(method_exists($this, $jsmethod))
522
+			$jsmethod = $getset.'js'.$propname;
523
+			if (method_exists($this, $jsmethod))
524 524
 			{
525
-				if(count($args) > 0)
526
-					if($args[0] && !($args[0] instanceof TJavaScriptString))
525
+				if (count($args) > 0)
526
+					if ($args[0] && !($args[0] instanceof TJavaScriptString))
527 527
 						$args[0] = new TJavaScriptString($args[0]);
528
-				return call_user_func_array([$this,$jsmethod], $args);
528
+				return call_user_func_array([$this, $jsmethod], $args);
529 529
 			}
530 530
 
531
-			if (($getset == 'set') && method_exists($this, 'getjs' . $propname))
531
+			if (($getset == 'set') && method_exists($this, 'getjs'.$propname))
532 532
 				throw new TInvalidOperationException('component_property_readonly', get_class($this), $method);
533 533
 		}
534 534
 
535
-		if($this->_m !== null && $this->_behaviorsenabled)
535
+		if ($this->_m !== null && $this->_behaviorsenabled)
536 536
 		{
537
-			if(strncasecmp($method, 'dy', 2) === 0)
537
+			if (strncasecmp($method, 'dy', 2) === 0)
538 538
 			{
539 539
 				$callchain = new TCallChain($method);
540
-				foreach($this->_m->toArray() as $behavior)
540
+				foreach ($this->_m->toArray() as $behavior)
541 541
 				{
542
-					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && (method_exists($behavior, $method) || ($behavior instanceof IDynamicMethods)))
542
+					if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && (method_exists($behavior, $method) || ($behavior instanceof IDynamicMethods)))
543 543
 					{
544 544
 						$behavior_args = $args;
545
-						if($behavior instanceof IClassBehavior)
545
+						if ($behavior instanceof IClassBehavior)
546 546
 							array_unshift($behavior_args, $this);
547
-						$callchain->addCall([$behavior,$method], $behavior_args);
547
+						$callchain->addCall([$behavior, $method], $behavior_args);
548 548
 					}
549 549
 
550 550
 				}
551
-				if($callchain->getCount() > 0)
552
-					return call_user_func_array([$callchain,'call'], $args);
551
+				if ($callchain->getCount() > 0)
552
+					return call_user_func_array([$callchain, 'call'], $args);
553 553
 			}
554 554
 			else
555 555
 			{
556
-				foreach($this->_m->toArray() as $behavior)
556
+				foreach ($this->_m->toArray() as $behavior)
557 557
 				{
558
-					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && method_exists($behavior, $method))
558
+					if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && method_exists($behavior, $method))
559 559
 					{
560
-						if($behavior instanceof IClassBehavior)
560
+						if ($behavior instanceof IClassBehavior)
561 561
 							array_unshift($args, $this);
562
-						return call_user_func_array([$behavior,$method], $args);
562
+						return call_user_func_array([$behavior, $method], $args);
563 563
 					}
564 564
 				}
565 565
 			}
566 566
 		}
567 567
 
568
-		if(strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
568
+		if (strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
569 569
 		{
570
-			if($this instanceof IDynamicMethods)
570
+			if ($this instanceof IDynamicMethods)
571 571
 				return $this->__dycall($method, $args);
572
-			return isset($args[0])?$args[0]:null;
572
+			return isset($args[0]) ? $args[0] : null;
573 573
 		}
574 574
 
575 575
 		// don't thrown an exception for __magicMethods() or any other weird methods natively implemented by php
@@ -604,42 +604,42 @@  discard block
 block discarded – undo
604 604
 	 */
605 605
 	public function __get($name)
606 606
 	{
607
-		if(method_exists($this, $getter = 'get' . $name))
607
+		if (method_exists($this, $getter = 'get'.$name))
608 608
 		{
609 609
 			// getting a property
610 610
 			return $this->$getter();
611 611
 		}
612
-		elseif(method_exists($this, $jsgetter = 'getjs' . $name))
612
+		elseif (method_exists($this, $jsgetter = 'getjs'.$name))
613 613
 		{
614 614
 			// getting a javascript property
615
-			return (string)$this->$jsgetter();
615
+			return (string) $this->$jsgetter();
616 616
 		}
617
-		elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
617
+		elseif (strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
618 618
 		{
619 619
 			// getting an event (handler list)
620 620
 			$name = strtolower($name);
621
-			if(!isset($this->_e[$name]))
621
+			if (!isset($this->_e[$name]))
622 622
 				$this->_e[$name] = new TPriorityList;
623 623
 			return $this->_e[$name];
624 624
 		}
625
-		elseif(strncasecmp($name, 'fx', 2) === 0)
625
+		elseif (strncasecmp($name, 'fx', 2) === 0)
626 626
 		{
627 627
 			// getting a global event (handler list)
628 628
 			$name = strtolower($name);
629
-			if(!isset(self::$_ue[$name]))
629
+			if (!isset(self::$_ue[$name]))
630 630
 				self::$_ue[$name] = new TPriorityList;
631 631
 			return self::$_ue[$name];
632 632
 		}
633
-		elseif($this->_behaviorsenabled)
633
+		elseif ($this->_behaviorsenabled)
634 634
 		{
635 635
 			// getting a behavior property/event (handler list)
636
-			if(isset($this->_m[$name]))
636
+			if (isset($this->_m[$name]))
637 637
 				return $this->_m[$name];
638
-			elseif($this->_m !== null)
638
+			elseif ($this->_m !== null)
639 639
 			{
640
-				foreach($this->_m->toArray() as $behavior)
640
+				foreach ($this->_m->toArray() as $behavior)
641 641
 				{
642
-					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) &&
642
+					if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) &&
643 643
 						(property_exists($behavior, $name) || $behavior->canGetProperty($name) || $behavior->hasEvent($name)))
644 644
 						return $behavior->$name;
645 645
 				}
@@ -665,38 +665,38 @@  discard block
 block discarded – undo
665 665
 	 */
666 666
 	public function __set($name, $value)
667 667
 	{
668
-		if(method_exists($this, $setter = 'set' . $name))
668
+		if (method_exists($this, $setter = 'set'.$name))
669 669
 		{
670
-			if(strncasecmp($name, 'js', 2) === 0 && $value && !($value instanceof TJavaScriptLiteral))
670
+			if (strncasecmp($name, 'js', 2) === 0 && $value && !($value instanceof TJavaScriptLiteral))
671 671
 				$value = new TJavaScriptLiteral($value);
672 672
 			return $this->$setter($value);
673 673
 		}
674
-		elseif(method_exists($this, $jssetter = 'setjs' . $name))
674
+		elseif (method_exists($this, $jssetter = 'setjs'.$name))
675 675
 		{
676
-			if($value && !($value instanceof TJavaScriptString))
676
+			if ($value && !($value instanceof TJavaScriptString))
677 677
 				$value = new TJavaScriptString($value);
678 678
 			return $this->$jssetter($value);
679 679
 		}
680
-		elseif((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0)
680
+		elseif ((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0)
681 681
 		{
682 682
 			return $this->attachEventHandler($name, $value);
683 683
 		}
684
-		elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
684
+		elseif ($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
685 685
 		{
686 686
 			$sets = 0;
687
-			foreach($this->_m->toArray() as $behavior)
687
+			foreach ($this->_m->toArray() as $behavior)
688 688
 			{
689
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) &&
689
+				if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) &&
690 690
 					(property_exists($behavior, $name) || $behavior->canSetProperty($name) || $behavior->hasEvent($name))) {
691 691
 					$behavior->$name = $value;
692 692
 					$sets++;
693 693
 				}
694 694
 			}
695
-			if($sets)return $value;
695
+			if ($sets)return $value;
696 696
 
697 697
 		}
698 698
 
699
-		if(method_exists($this, 'get' . $name) || method_exists($this, 'getjs' . $name))
699
+		if (method_exists($this, 'get'.$name) || method_exists($this, 'getjs'.$name))
700 700
 		{
701 701
 			throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
702 702
 		}
@@ -720,27 +720,27 @@  discard block
 block discarded – undo
720 720
 	 */
721 721
 	public function __isset($name)
722 722
 	{
723
-		if(method_exists($this, $getter = 'get' . $name))
723
+		if (method_exists($this, $getter = 'get'.$name))
724 724
 			return $this->$getter() !== null;
725
-		elseif(method_exists($this, $jsgetter = 'getjs' . $name))
725
+		elseif (method_exists($this, $jsgetter = 'getjs'.$name))
726 726
 			return $this->$jsgetter() !== null;
727
-		elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
727
+		elseif (strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
728 728
 		{
729 729
 			$name = strtolower($name);
730 730
 			return isset($this->_e[$name]) && $this->_e[$name]->getCount();
731 731
 		}
732
-		elseif(strncasecmp($name, 'fx', 2) === 0)
732
+		elseif (strncasecmp($name, 'fx', 2) === 0)
733 733
 		{
734 734
 			$name = strtolower($name);
735 735
 			return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount();
736 736
 		}
737
-		elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
737
+		elseif ($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
738 738
 		{
739
-			if(isset($this->_m[$name]))
739
+			if (isset($this->_m[$name]))
740 740
 				return true;
741
-			foreach($this->_m->toArray() as $behavior)
741
+			foreach ($this->_m->toArray() as $behavior)
742 742
 			{
743
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()))
743
+				if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()))
744 744
 					return isset($behavior->$name);
745 745
 			}
746 746
 
@@ -761,31 +761,31 @@  discard block
 block discarded – undo
761 761
 	 */
762 762
 	public function __unset($name)
763 763
 	{
764
-		if(method_exists($this, $setter = 'set' . $name))
764
+		if (method_exists($this, $setter = 'set'.$name))
765 765
 			$this->$setter(null);
766
-		elseif(method_exists($this, $jssetter = 'setjs' . $name))
766
+		elseif (method_exists($this, $jssetter = 'setjs'.$name))
767 767
 			$this->$jssetter(null);
768
-		elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
768
+		elseif (strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
769 769
 			$this->_e[strtolower($name)]->clear();
770
-		elseif(strncasecmp($name, 'fx', 2) === 0)
770
+		elseif (strncasecmp($name, 'fx', 2) === 0)
771 771
 			$this->getEventHandlers($name)->remove([$this, $name]);
772
-		elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
772
+		elseif ($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
773 773
 		{
774
-			if(isset($this->_m[$name]))
774
+			if (isset($this->_m[$name]))
775 775
 				$this->detachBehavior($name);
776 776
 			else {
777 777
 				$unset = 0;
778
-				foreach($this->_m->toArray() as $behavior)
778
+				foreach ($this->_m->toArray() as $behavior)
779 779
 				{
780
-					if((!($behavior instanceof IBehavior) || $behavior->getEnabled())) {
780
+					if ((!($behavior instanceof IBehavior) || $behavior->getEnabled())) {
781 781
 						unset($behavior->$name);
782 782
 						$unset++;
783 783
 					}
784 784
 				}
785
-				if(!$unset && method_exists($this, 'get' . $name))
785
+				if (!$unset && method_exists($this, 'get'.$name))
786 786
 					throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
787 787
 			}
788
-		} elseif(method_exists($this, 'get' . $name))
788
+		} elseif (method_exists($this, 'get'.$name))
789 789
 			throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
790 790
 	}
791 791
 
@@ -812,13 +812,13 @@  discard block
 block discarded – undo
812 812
 	 */
813 813
 	public function canGetProperty($name)
814 814
 	{
815
-		if(method_exists($this, 'get' . $name) || method_exists($this, 'getjs' . $name))
815
+		if (method_exists($this, 'get'.$name) || method_exists($this, 'getjs'.$name))
816 816
 			return true;
817
-		elseif($this->_m !== null && $this->_behaviorsenabled)
817
+		elseif ($this->_m !== null && $this->_behaviorsenabled)
818 818
 		{
819
-			foreach($this->_m->toArray() as $behavior)
819
+			foreach ($this->_m->toArray() as $behavior)
820 820
 			{
821
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canGetProperty($name))
821
+				if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canGetProperty($name))
822 822
 					return true;
823 823
 			}
824 824
 		}
@@ -836,13 +836,13 @@  discard block
 block discarded – undo
836 836
 	 */
837 837
 	public function canSetProperty($name)
838 838
 	{
839
-		if(method_exists($this, 'set' . $name) || method_exists($this, 'setjs' . $name))
839
+		if (method_exists($this, 'set'.$name) || method_exists($this, 'setjs'.$name))
840 840
 			return true;
841
-		elseif($this->_m !== null && $this->_behaviorsenabled)
841
+		elseif ($this->_m !== null && $this->_behaviorsenabled)
842 842
 		{
843
-			foreach($this->_m->toArray() as $behavior)
843
+			foreach ($this->_m->toArray() as $behavior)
844 844
 			{
845
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canSetProperty($name))
845
+				if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canSetProperty($name))
846 846
 					return true;
847 847
 			}
848 848
 		}
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	public function getSubProperty($path)
863 863
 	{
864 864
 		$object = $this;
865
-		foreach(explode('.', $path) as $property)
865
+		foreach (explode('.', $path) as $property)
866 866
 			$object = $object->$property;
867 867
 		return $object;
868 868
 	}
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 	public function setSubProperty($path, $value)
881 881
 	{
882 882
 		$object = $this;
883
-		if(($pos = strrpos($path, '.')) === false)
883
+		if (($pos = strrpos($path, '.')) === false)
884 884
 			$property = $path;
885 885
 		else
886 886
 		{
@@ -904,14 +904,14 @@  discard block
 block discarded – undo
904 904
 	 */
905 905
 	public function hasEvent($name)
906 906
 	{
907
-		if((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0 || strncasecmp($name, 'dy', 2) === 0)
907
+		if ((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0 || strncasecmp($name, 'dy', 2) === 0)
908 908
 			return true;
909 909
 
910
-		elseif($this->_m !== null && $this->_behaviorsenabled)
910
+		elseif ($this->_m !== null && $this->_behaviorsenabled)
911 911
 		{
912
-			foreach($this->_m->toArray() as $behavior)
912
+			foreach ($this->_m->toArray() as $behavior)
913 913
 			{
914
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
914
+				if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
915 915
 					return true;
916 916
 			}
917 917
 		}
@@ -928,16 +928,16 @@  discard block
 block discarded – undo
928 928
 	public function hasEventHandler($name)
929 929
 	{
930 930
 		$name = strtolower($name);
931
-		if(strncasecmp($name, 'fx', 2) === 0)
931
+		if (strncasecmp($name, 'fx', 2) === 0)
932 932
 			return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount() > 0;
933 933
 		else
934 934
 		{
935
-			if(isset($this->_e[$name]) && $this->_e[$name]->getCount() > 0)
935
+			if (isset($this->_e[$name]) && $this->_e[$name]->getCount() > 0)
936 936
 				return true;
937
-			elseif($this->_m !== null && $this->_behaviorsenabled) {
938
-				foreach($this->_m->toArray() as $behavior)
937
+			elseif ($this->_m !== null && $this->_behaviorsenabled) {
938
+				foreach ($this->_m->toArray() as $behavior)
939 939
 				{
940
-					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEventHandler($name))
940
+					if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEventHandler($name))
941 941
 						return true;
942 942
 				}
943 943
 			}
@@ -953,25 +953,25 @@  discard block
 block discarded – undo
953 953
 	 */
954 954
 	public function getEventHandlers($name)
955 955
 	{
956
-		if(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
956
+		if (strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
957 957
 		{
958 958
 			$name = strtolower($name);
959
-			if(!isset($this->_e[$name]))
959
+			if (!isset($this->_e[$name]))
960 960
 				$this->_e[$name] = new TPriorityList;
961 961
 			return $this->_e[$name];
962 962
 		}
963
-		elseif(strncasecmp($name, 'fx', 2) === 0)
963
+		elseif (strncasecmp($name, 'fx', 2) === 0)
964 964
 		{
965 965
 			$name = strtolower($name);
966
-			if(!isset(self::$_ue[$name]))
966
+			if (!isset(self::$_ue[$name]))
967 967
 				self::$_ue[$name] = new TPriorityList;
968 968
 			return self::$_ue[$name];
969 969
 		}
970
-		elseif($this->_m !== null && $this->_behaviorsenabled)
970
+		elseif ($this->_m !== null && $this->_behaviorsenabled)
971 971
 		{
972
-			foreach($this->_m->toArray() as $behavior)
972
+			foreach ($this->_m->toArray() as $behavior)
973 973
 			{
974
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
974
+				if ((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
975 975
 					return $behavior->getEventHandlers($name);
976 976
 			}
977 977
 		}
@@ -1040,14 +1040,14 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	public function detachEventHandler($name, $handler, $priority = false)
1042 1042
 	{
1043
-		if($this->hasEventHandler($name))
1043
+		if ($this->hasEventHandler($name))
1044 1044
 		{
1045 1045
 			try
1046 1046
 			{
1047 1047
 				$this->getEventHandlers($name)->remove($handler, $priority);
1048 1048
 				return true;
1049 1049
 			}
1050
-			catch(\Exception $e)
1050
+			catch (\Exception $e)
1051 1051
 			{
1052 1052
 			}
1053 1053
 		}
@@ -1129,13 +1129,13 @@  discard block
 block discarded – undo
1129 1129
 	public function raiseEvent($name, $sender, $param, $responsetype = null, $postfunction = null)
1130 1130
 	{
1131 1131
 		$p = $param;
1132
-		if(is_callable($responsetype))
1132
+		if (is_callable($responsetype))
1133 1133
 		{
1134 1134
 			$postfunction = $responsetype;
1135 1135
 			$responsetype = null;
1136 1136
 		}
1137 1137
 
1138
-		if($responsetype === null)
1138
+		if ($responsetype === null)
1139 1139
 			$responsetype = TEventResults::EVENT_RESULT_FILTER;
1140 1140
 
1141 1141
 		$name = strtolower($name);
@@ -1143,31 +1143,31 @@  discard block
 block discarded – undo
1143 1143
 
1144 1144
 		$name = $this->dyPreRaiseEvent($name, $sender, $param, $responsetype, $postfunction);
1145 1145
 
1146
-		if($this->hasEventHandler($name) || $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1146
+		if ($this->hasEventHandler($name) || $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1147 1147
 		{
1148 1148
 			$handlers = $this->getEventHandlers($name);
1149 1149
 			$handlerArray = $handlers->toArray();
1150
-			if(strncasecmp($name, 'fx', 2) === 0 && $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1150
+			if (strncasecmp($name, 'fx', 2) === 0 && $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1151 1151
 			{
1152 1152
 				$globalhandlers = $this->getEventHandlers(TComponent::GLOBAL_RAISE_EVENT_LISTENER);
1153 1153
 				$handlerArray = array_merge($globalhandlers->toArrayBelowPriority(0), $handlerArray, $globalhandlers->toArrayAbovePriority(0));
1154 1154
 			}
1155 1155
 			$response = null;
1156
-			foreach($handlerArray as $handler)
1156
+			foreach ($handlerArray as $handler)
1157 1157
 			{
1158
-				if($this->dyIntraRaiseEventTestHandler($handler, $sender, $param, $name) === false)
1158
+				if ($this->dyIntraRaiseEventTestHandler($handler, $sender, $param, $name) === false)
1159 1159
 					continue;
1160 1160
 
1161
-				if(is_string($handler))
1161
+				if (is_string($handler))
1162 1162
 				{
1163
-					if(($pos = strrpos($handler, '.')) !== false)
1163
+					if (($pos = strrpos($handler, '.')) !== false)
1164 1164
 					{
1165 1165
 						$object = $this->getSubProperty(substr($handler, 0, $pos));
1166 1166
 						$method = substr($handler, $pos + 1);
1167
-						if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
1167
+						if (method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
1168 1168
 						{
1169
-							if($method == '__dycall')
1170
-								$response = $object->__dycall($name, [$sender,$param,$name]);
1169
+							if ($method == '__dycall')
1170
+								$response = $object->__dycall($name, [$sender, $param, $name]);
1171 1171
 							else
1172 1172
 								$response = $object->$method($sender, $param, $name);
1173 1173
 						}
@@ -1177,22 +1177,22 @@  discard block
 block discarded – undo
1177 1177
 					else
1178 1178
 						$response = call_user_func($handler, $sender, $param, $name);
1179 1179
 				}
1180
-				elseif(is_callable($handler, true))
1180
+				elseif (is_callable($handler, true))
1181 1181
 				{
1182 1182
 					list($object, $method) = $handler;
1183
-					if(is_string($object))
1183
+					if (is_string($object))
1184 1184
 						$response = call_user_func($handler, $sender, $param, $name);
1185 1185
 					else
1186 1186
 					{
1187
-						if(($pos = strrpos($method, '.')) !== false)
1187
+						if (($pos = strrpos($method, '.')) !== false)
1188 1188
 						{
1189 1189
 							$object = $this->getSubProperty(substr($method, 0, $pos));
1190 1190
 							$method = substr($method, $pos + 1);
1191 1191
 						}
1192
-						if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
1192
+						if (method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
1193 1193
 						{
1194
-							if($method == '__dycall')
1195
-								$response = $object->__dycall($name, [$sender,$param,$name]);
1194
+							if ($method == '__dycall')
1195
+								$response = $object->__dycall($name, [$sender, $param, $name]);
1196 1196
 							else
1197 1197
 								$response = $object->$method($sender, $param, $name);
1198 1198
 						}
@@ -1205,23 +1205,23 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
 				$this->dyIntraRaiseEventPostHandler($name, $sender, $param, $handler, $response);
1207 1207
 
1208
-				if($postfunction)
1209
-					$response = call_user_func_array($postfunction, [$sender,$param,$this,$response]);
1208
+				if ($postfunction)
1209
+					$response = call_user_func_array($postfunction, [$sender, $param, $this, $response]);
1210 1210
 
1211
-				if($responsetype & TEventResults::EVENT_RESULT_ALL)
1212
-					$responses[] = ['sender' => $sender,'param' => $param,'response' => $response];
1211
+				if ($responsetype & TEventResults::EVENT_RESULT_ALL)
1212
+					$responses[] = ['sender' => $sender, 'param' => $param, 'response' => $response];
1213 1213
 				else
1214 1214
 					$responses[] = $response;
1215 1215
 
1216
-				if($response !== null && ($responsetype & TEventResults::EVENT_RESULT_FEED_FORWARD))
1216
+				if ($response !== null && ($responsetype & TEventResults::EVENT_RESULT_FEED_FORWARD))
1217 1217
 					$param = $response;
1218 1218
 
1219 1219
 			}
1220 1220
 		}
1221
-		elseif(strncasecmp($name, 'on', 2) === 0 && !$this->hasEvent($name))
1221
+		elseif (strncasecmp($name, 'on', 2) === 0 && !$this->hasEvent($name))
1222 1222
 			throw new TInvalidOperationException('component_event_undefined', get_class($this), $name);
1223 1223
 
1224
-		if($responsetype & TEventResults::EVENT_RESULT_FILTER)
1224
+		if ($responsetype & TEventResults::EVENT_RESULT_FILTER)
1225 1225
 			$responses = array_filter($responses);
1226 1226
 
1227 1227
 		$responses = $this->dyPostRaiseEvent($responses, $name, $sender, $param, $responsetype, $postfunction);
@@ -1251,11 +1251,11 @@  discard block
 block discarded – undo
1251 1251
 		$expression = $this->dyEvaluateExpressionFilter($expression);
1252 1252
 		try
1253 1253
 		{
1254
-			if(eval("\$result=$expression;") === false)
1254
+			if (eval("\$result=$expression;") === false)
1255 1255
 				throw new \Exception('');
1256 1256
 			return $result;
1257 1257
 		}
1258
-		catch(\Exception $e)
1258
+		catch (\Exception $e)
1259 1259
 		{
1260 1260
 			throw new TInvalidOperationException('component_expression_invalid', get_class($this), $expression, $e->getMessage());
1261 1261
 		}
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
 		try
1285 1285
 		{
1286 1286
 			ob_start();
1287
-			if(eval($statements) === false)
1287
+			if (eval($statements) === false)
1288 1288
 				throw new \Exception('');
1289 1289
 			$content = ob_get_contents();
1290 1290
 			ob_end_clean();
1291 1291
 			return $content;
1292 1292
 		}
1293
-		catch(\Exception $e)
1293
+		catch (\Exception $e)
1294 1294
 		{
1295 1295
 			throw new TInvalidOperationException('component_statements_invalid', get_class($this), $statements, $e->getMessage());
1296 1296
 		}
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 	 * @since 3.2.3
1354 1354
 	 */
1355 1355
 	public function fxAttachClassBehavior($sender, $param) {
1356
-		if(in_array($param->getClass(), $this->getClassHierarchy(true)))
1356
+		if (in_array($param->getClass(), $this->getClassHierarchy(true)))
1357 1357
 			return $this->attachBehavior($param->getName(), $param->getBehavior(), $param->getPriority());
1358 1358
 	}
1359 1359
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 	 * @since 3.2.3
1368 1368
 	 */
1369 1369
 	public function fxDetachClassBehavior($sender, $param) {
1370
-		if(in_array($param->getClass(), $this->getClassHierarchy(true)))
1370
+		if (in_array($param->getClass(), $this->getClassHierarchy(true)))
1371 1371
 			return $this->detachBehavior($param->getName(), $param->getPriority());
1372 1372
 	}
1373 1373
 
@@ -1391,23 +1391,23 @@  discard block
 block discarded – undo
1391 1391
 	 * @since 3.2.3
1392 1392
 	 */
1393 1393
 	public static function attachClassBehavior($name, $behavior, $class = null, $priority = null) {
1394
-		if(!$class && function_exists('get_called_class'))
1394
+		if (!$class && function_exists('get_called_class'))
1395 1395
 			$class = get_called_class();
1396
-		if(!$class)
1396
+		if (!$class)
1397 1397
 			throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
1398 1398
 
1399
-		if(!is_string($name))
1399
+		if (!is_string($name))
1400 1400
 			$name = get_class($name);
1401 1401
 		$class = strtolower($class);
1402
-		if($class === 'tcomponent')
1402
+		if ($class === 'tcomponent')
1403 1403
 			throw new TInvalidOperationException('component_no_tcomponent_class_behaviors');
1404
-		if(empty(self::$_um[$class]))
1404
+		if (empty(self::$_um[$class]))
1405 1405
 			self::$_um[$class] = [];
1406
-		if(isset(self::$_um[$class][$name]))
1406
+		if (isset(self::$_um[$class][$name]))
1407 1407
 			throw new TInvalidOperationException('component_class_behavior_defined', $class, $name);
1408 1408
 		$param = new TClassBehaviorEventParameter($class, $name, $behavior, $priority);
1409 1409
 		self::$_um[$class] = [$name => $param] + self::$_um[$class];
1410
-		$behaviorObject = is_string($behavior)?new $behavior:$behavior;
1410
+		$behaviorObject = is_string($behavior) ? new $behavior : $behavior;
1411 1411
 		return $behaviorObject->raiseEvent('fxAttachClassBehavior', null, $param);
1412 1412
 	}
1413 1413
 
@@ -1425,20 +1425,20 @@  discard block
 block discarded – undo
1425 1425
 	 * @since 3.2.3
1426 1426
 	 */
1427 1427
 	public static function detachClassBehavior($name, $class = null, $priority = false) {
1428
-		if(!$class && function_exists('get_called_class'))
1428
+		if (!$class && function_exists('get_called_class'))
1429 1429
 			$class = get_called_class();
1430
-		if(!$class)
1430
+		if (!$class)
1431 1431
 			throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
1432 1432
 
1433 1433
 		$class = strtolower($class);
1434
-		if(!is_string($name))
1434
+		if (!is_string($name))
1435 1435
 			$name = get_class($name);
1436
-		if(empty(self::$_um[$class]) || !isset(self::$_um[$class][$name]))
1436
+		if (empty(self::$_um[$class]) || !isset(self::$_um[$class][$name]))
1437 1437
 			return false;
1438 1438
 		$param = self::$_um[$class][$name];
1439 1439
 		$behavior = $param->getBehavior();
1440 1440
 		unset(self::$_um[$class][$name]);
1441
-		$behaviorObject = is_string($behavior)?new $behavior:$behavior;
1441
+		$behaviorObject = is_string($behavior) ? new $behavior : $behavior;
1442 1442
 		return $behaviorObject->raiseEvent('fxDetachClassBehavior', null, $param);
1443 1443
 	}
1444 1444
 
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
 	 */
1452 1452
 	public function asa($behaviorname)
1453 1453
 	{
1454
-		return isset($this->_m[$behaviorname])?$this->_m[$behaviorname]:null;
1454
+		return isset($this->_m[$behaviorname]) ? $this->_m[$behaviorname] : null;
1455 1455
 	}
1456 1456
 
1457 1457
 	/**
@@ -1475,17 +1475,17 @@  discard block
 block discarded – undo
1475 1475
 	 */
1476 1476
 	public function isa($class)
1477 1477
 	{
1478
-		if($this instanceof $class)
1478
+		if ($this instanceof $class)
1479 1479
 			return true;
1480
-		if($this->_m !== null && $this->_behaviorsenabled)
1481
-			foreach($this->_m->toArray() as $behavior){
1482
-				if(($behavior instanceof IBehavior) && !$behavior->getEnabled())
1480
+		if ($this->_m !== null && $this->_behaviorsenabled)
1481
+			foreach ($this->_m->toArray() as $behavior) {
1482
+				if (($behavior instanceof IBehavior) && !$behavior->getEnabled())
1483 1483
 					continue;
1484 1484
 
1485 1485
 				$check = null;
1486
-				if(($behavior->isa('\Prado\Util\IInstanceCheck')) && $check = $behavior->isinstanceof($class, $this))
1486
+				if (($behavior->isa('\Prado\Util\IInstanceCheck')) && $check = $behavior->isinstanceof($class, $this))
1487 1487
 					return true;
1488
-				if($check === null && ($behavior->isa($class)))
1488
+				if ($check === null && ($behavior->isa($class)))
1489 1489
 					return true;
1490 1490
 			}
1491 1491
 		return false;
@@ -1501,8 +1501,8 @@  discard block
 block discarded – undo
1501 1501
 	 */
1502 1502
 	public function attachBehaviors($behaviors)
1503 1503
 	{
1504
-		foreach($behaviors as $name => $behavior)
1505
-			if($behavior instanceof TClassBehaviorEventParameter)
1504
+		foreach ($behaviors as $name => $behavior)
1505
+			if ($behavior instanceof TClassBehaviorEventParameter)
1506 1506
 				$this->attachBehavior($behavior->getName(), $behavior->getBehavior(), $behavior->getPriority());
1507 1507
 			else
1508 1508
 				$this->attachBehavior($name, $behavior);
@@ -1518,13 +1518,13 @@  discard block
 block discarded – undo
1518 1518
 	 */
1519 1519
 	public function detachBehaviors($behaviors)
1520 1520
 	{
1521
-		if($this->_m !== null)
1521
+		if ($this->_m !== null)
1522 1522
 		{
1523
-			foreach($behaviors as $name => $behavior)
1524
-				if($behavior instanceof TClassBehaviorEventParameter)
1523
+			foreach ($behaviors as $name => $behavior)
1524
+				if ($behavior instanceof TClassBehaviorEventParameter)
1525 1525
 					$this->detachBehavior($behavior->getName(), $behavior->getPriority());
1526 1526
 				else
1527
-					$this->detachBehavior(is_string($behavior)?$behavior:$name);
1527
+					$this->detachBehavior(is_string($behavior) ? $behavior : $name);
1528 1528
 		}
1529 1529
 	}
1530 1530
 
@@ -1534,9 +1534,9 @@  discard block
 block discarded – undo
1534 1534
 	 */
1535 1535
 	public function clearBehaviors()
1536 1536
 	{
1537
-		if($this->_m !== null)
1537
+		if ($this->_m !== null)
1538 1538
 		{
1539
-			foreach($this->_m->toArray() as $name => $behavior)
1539
+			foreach ($this->_m->toArray() as $name => $behavior)
1540 1540
 				$this->detachBehavior($name);
1541 1541
 			$this->_m = null;
1542 1542
 		}
@@ -1564,13 +1564,13 @@  discard block
 block discarded – undo
1564 1564
 	 */
1565 1565
 	public function attachBehavior($name, $behavior, $priority = null)
1566 1566
 	{
1567
-		if(is_string($behavior))
1567
+		if (is_string($behavior))
1568 1568
 			$behavior = Prado::createComponent($behavior);
1569
-		if(!($behavior instanceof IBaseBehavior))
1569
+		if (!($behavior instanceof IBaseBehavior))
1570 1570
 			throw new TInvalidDataTypeException('component_not_a_behavior', get_class($behavior));
1571
-		if($behavior instanceof IBehavior)
1571
+		if ($behavior instanceof IBehavior)
1572 1572
 			$behavior->setEnabled(true);
1573
-		if($this->_m === null)
1573
+		if ($this->_m === null)
1574 1574
 			$this->_m = new TPriorityMap;
1575 1575
 		$behavior->attach($this);
1576 1576
 		$this->dyAttachBehavior($name, $behavior);
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 	 */
1598 1598
 	public function detachBehavior($name, $priority = false)
1599 1599
 	{
1600
-		if($this->_m != null && isset($this->_m[$name]))
1600
+		if ($this->_m != null && isset($this->_m[$name]))
1601 1601
 		{
1602 1602
 			$this->_m[$name]->detach($this);
1603 1603
 			$behavior = $this->_m->itemAt($name);
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	 */
1622 1622
 	public function enableBehaviors()
1623 1623
 	{
1624
-		if(!$this->_behaviorsenabled)
1624
+		if (!$this->_behaviorsenabled)
1625 1625
 		{
1626 1626
 			$this->_behaviorsenabled = true;
1627 1627
 			$this->dyEnableBehaviors();
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
 	 */
1643 1643
 	public function disableBehaviors()
1644 1644
 	{
1645
-		if($this->_behaviorsenabled)
1645
+		if ($this->_behaviorsenabled)
1646 1646
 		{
1647 1647
 			$this->dyDisableBehaviors();
1648 1648
 			$this->_behaviorsenabled = false;
@@ -1678,8 +1678,8 @@  discard block
 block discarded – undo
1678 1678
 	 */
1679 1679
 	public function enableBehavior($name)
1680 1680
 	{
1681
-		if($this->_m != null && isset($this->_m[$name])){
1682
-			if($this->_m[$name] instanceof IBehavior) {
1681
+		if ($this->_m != null && isset($this->_m[$name])) {
1682
+			if ($this->_m[$name] instanceof IBehavior) {
1683 1683
 				$this->_m[$name]->setEnabled(true);
1684 1684
 				$this->dyEnableBehavior($name, $this->_m[$name]);
1685 1685
 				return true;
@@ -1706,8 +1706,8 @@  discard block
 block discarded – undo
1706 1706
 	 */
1707 1707
 	public function disableBehavior($name)
1708 1708
 	{
1709
-		if($this->_m != null && isset($this->_m[$name])){
1710
-			if($this->_m[$name] instanceof IBehavior) {
1709
+		if ($this->_m != null && isset($this->_m[$name])) {
1710
+			if ($this->_m[$name] instanceof IBehavior) {
1711 1711
 				$this->_m[$name]->setEnabled(false);
1712 1712
 				$this->dyDisableBehavior($name, $this->_m[$name]);
1713 1713
 				return true;
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
 	 */
1725 1725
 	public function __sleep()
1726 1726
 	{
1727
-		$a = (array)$this;
1727
+		$a = (array) $this;
1728 1728
 		$a = array_keys($a);
1729 1729
 		$exprops = [];
1730 1730
 		$this->_getZappableSleepProps($exprops);
@@ -1739,9 +1739,9 @@  discard block
 block discarded – undo
1739 1739
 	 */
1740 1740
 	protected function _getZappableSleepProps(&$exprops)
1741 1741
 	{
1742
-		if($this->_listeningenabled === false)
1742
+		if ($this->_listeningenabled === false)
1743 1743
 			$exprops[] = "\0Prado\TComponent\0_listeningenabled";
1744
-		if($this->_behaviorsenabled === true)
1744
+		if ($this->_behaviorsenabled === true)
1745 1745
 			$exprops[] = "\0Prado\TComponent\0_behaviorsenabled";
1746 1746
 		if ($this->_e === [])
1747 1747
 			$exprops[] = "\0Prado\TComponent\0_e";
Please login to merge, or discard this patch.
Braces   +289 added lines, -235 removed lines patch added patch discarded remove patch
@@ -344,13 +344,15 @@  discard block
 block discarded – undo
344 344
 	 * through each parent to the top most class, TComponent.
345 345
 	 */
346 346
 	public function __construct() {
347
-		if($this->getAutoGlobalListen())
348
-			$this->listen();
347
+		if($this->getAutoGlobalListen()) {
348
+					$this->listen();
349
+		}
349 350
 
350 351
 		$classes = array_reverse($this->getClassHierarchy(true));
351 352
 		foreach($classes as $class) {
352
-			if(isset(self::$_um[$class]))
353
-				$this->attachBehaviors(self::$_um[$class]);
353
+			if(isset(self::$_um[$class])) {
354
+							$this->attachBehaviors(self::$_um[$class]);
355
+			}
354 356
 		}
355 357
 	}
356 358
 
@@ -380,8 +382,9 @@  discard block
 block discarded – undo
380 382
 	 * called must be explicitly called.
381 383
 	 */
382 384
 	public function __destruct() {
383
-		if($this->_listeningenabled)
384
-			$this->unlisten();
385
+		if($this->_listeningenabled) {
386
+					$this->unlisten();
387
+		}
385 388
 	}
386 389
 
387 390
 
@@ -405,8 +408,9 @@  discard block
 block discarded – undo
405 408
 		$class = get_class($this);
406 409
 		$classes = [$class];
407 410
 		while($class = get_parent_class($class)){array_unshift($classes, $class);}
408
-		if($lowercase)
409
-			return array_map('strtolower', $classes);
411
+		if($lowercase) {
412
+					return array_map('strtolower', $classes);
413
+		}
410 414
 		return $classes;
411 415
 	}
412 416
 
@@ -426,13 +430,15 @@  discard block
 block discarded – undo
426 430
 	 * @return numeric the number of global events that were registered to the global event registry
427 431
 	 */
428 432
 	public function listen() {
429
-		if($this->_listeningenabled)
430
-			return;
433
+		if($this->_listeningenabled) {
434
+					return;
435
+		}
431 436
 
432 437
 		$fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']);
433 438
 
434
-		foreach($fx as $func)
435
-			$this->attachEventHandler($func, [$this,$func]);
439
+		foreach($fx as $func) {
440
+					$this->attachEventHandler($func, [$this,$func]);
441
+		}
436 442
 
437 443
 		if(is_a($this, 'Prado\\Util\\IDynamicMethods')) {
438 444
 			$this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']);
@@ -460,13 +466,15 @@  discard block
 block discarded – undo
460 466
 	 * @return numeric the number of global events that were unregistered from the global event registry
461 467
 	 */
462 468
 	public function unlisten() {
463
-		if(!$this->_listeningenabled)
464
-			return;
469
+		if(!$this->_listeningenabled) {
470
+					return;
471
+		}
465 472
 
466 473
 		$fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']);
467 474
 
468
-		foreach($fx as $func)
469
-			$this->detachEventHandler($func, [$this,$func]);
475
+		foreach($fx as $func) {
476
+					$this->detachEventHandler($func, [$this,$func]);
477
+		}
470 478
 
471 479
 		if(is_a($this, 'Prado\\Util\\IDynamicMethods')) {
472 480
 			$this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']);
@@ -522,14 +530,16 @@  discard block
 block discarded – undo
522 530
 			$jsmethod = $getset . 'js' . $propname;
523 531
 			if(method_exists($this, $jsmethod))
524 532
 			{
525
-				if(count($args) > 0)
526
-					if($args[0] && !($args[0] instanceof TJavaScriptString))
533
+				if(count($args) > 0) {
534
+									if($args[0] && !($args[0] instanceof TJavaScriptString))
527 535
 						$args[0] = new TJavaScriptString($args[0]);
536
+				}
528 537
 				return call_user_func_array([$this,$jsmethod], $args);
529 538
 			}
530 539
 
531
-			if (($getset == 'set') && method_exists($this, 'getjs' . $propname))
532
-				throw new TInvalidOperationException('component_property_readonly', get_class($this), $method);
540
+			if (($getset == 'set') && method_exists($this, 'getjs' . $propname)) {
541
+							throw new TInvalidOperationException('component_property_readonly', get_class($this), $method);
542
+			}
533 543
 		}
534 544
 
535 545
 		if($this->_m !== null && $this->_behaviorsenabled)
@@ -542,23 +552,25 @@  discard block
 block discarded – undo
542 552
 					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && (method_exists($behavior, $method) || ($behavior instanceof IDynamicMethods)))
543 553
 					{
544 554
 						$behavior_args = $args;
545
-						if($behavior instanceof IClassBehavior)
546
-							array_unshift($behavior_args, $this);
555
+						if($behavior instanceof IClassBehavior) {
556
+													array_unshift($behavior_args, $this);
557
+						}
547 558
 						$callchain->addCall([$behavior,$method], $behavior_args);
548 559
 					}
549 560
 
550 561
 				}
551
-				if($callchain->getCount() > 0)
552
-					return call_user_func_array([$callchain,'call'], $args);
553
-			}
554
-			else
562
+				if($callchain->getCount() > 0) {
563
+									return call_user_func_array([$callchain,'call'], $args);
564
+				}
565
+			} else
555 566
 			{
556 567
 				foreach($this->_m->toArray() as $behavior)
557 568
 				{
558 569
 					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && method_exists($behavior, $method))
559 570
 					{
560
-						if($behavior instanceof IClassBehavior)
561
-							array_unshift($args, $this);
571
+						if($behavior instanceof IClassBehavior) {
572
+													array_unshift($args, $this);
573
+						}
562 574
 						return call_user_func_array([$behavior,$method], $args);
563 575
 					}
564 576
 				}
@@ -567,8 +579,9 @@  discard block
 block discarded – undo
567 579
 
568 580
 		if(strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
569 581
 		{
570
-			if($this instanceof IDynamicMethods)
571
-				return $this->__dycall($method, $args);
582
+			if($this instanceof IDynamicMethods) {
583
+							return $this->__dycall($method, $args);
584
+			}
572 585
 			return isset($args[0])?$args[0]:null;
573 586
 		}
574 587
 
@@ -608,40 +621,39 @@  discard block
 block discarded – undo
608 621
 		{
609 622
 			// getting a property
610 623
 			return $this->$getter();
611
-		}
612
-		elseif(method_exists($this, $jsgetter = 'getjs' . $name))
624
+		} elseif(method_exists($this, $jsgetter = 'getjs' . $name))
613 625
 		{
614 626
 			// getting a javascript property
615 627
 			return (string)$this->$jsgetter();
616
-		}
617
-		elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
628
+		} elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
618 629
 		{
619 630
 			// getting an event (handler list)
620 631
 			$name = strtolower($name);
621
-			if(!isset($this->_e[$name]))
622
-				$this->_e[$name] = new TPriorityList;
632
+			if(!isset($this->_e[$name])) {
633
+							$this->_e[$name] = new TPriorityList;
634
+			}
623 635
 			return $this->_e[$name];
624
-		}
625
-		elseif(strncasecmp($name, 'fx', 2) === 0)
636
+		} elseif(strncasecmp($name, 'fx', 2) === 0)
626 637
 		{
627 638
 			// getting a global event (handler list)
628 639
 			$name = strtolower($name);
629
-			if(!isset(self::$_ue[$name]))
630
-				self::$_ue[$name] = new TPriorityList;
640
+			if(!isset(self::$_ue[$name])) {
641
+							self::$_ue[$name] = new TPriorityList;
642
+			}
631 643
 			return self::$_ue[$name];
632
-		}
633
-		elseif($this->_behaviorsenabled)
644
+		} elseif($this->_behaviorsenabled)
634 645
 		{
635 646
 			// getting a behavior property/event (handler list)
636
-			if(isset($this->_m[$name]))
637
-				return $this->_m[$name];
638
-			elseif($this->_m !== null)
647
+			if(isset($this->_m[$name])) {
648
+							return $this->_m[$name];
649
+			} elseif($this->_m !== null)
639 650
 			{
640 651
 				foreach($this->_m->toArray() as $behavior)
641 652
 				{
642 653
 					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) &&
643
-						(property_exists($behavior, $name) || $behavior->canGetProperty($name) || $behavior->hasEvent($name)))
644
-						return $behavior->$name;
654
+						(property_exists($behavior, $name) || $behavior->canGetProperty($name) || $behavior->hasEvent($name))) {
655
+											return $behavior->$name;
656
+					}
645 657
 				}
646 658
 			}
647 659
 		}
@@ -667,21 +679,20 @@  discard block
 block discarded – undo
667 679
 	{
668 680
 		if(method_exists($this, $setter = 'set' . $name))
669 681
 		{
670
-			if(strncasecmp($name, 'js', 2) === 0 && $value && !($value instanceof TJavaScriptLiteral))
671
-				$value = new TJavaScriptLiteral($value);
682
+			if(strncasecmp($name, 'js', 2) === 0 && $value && !($value instanceof TJavaScriptLiteral)) {
683
+							$value = new TJavaScriptLiteral($value);
684
+			}
672 685
 			return $this->$setter($value);
673
-		}
674
-		elseif(method_exists($this, $jssetter = 'setjs' . $name))
686
+		} elseif(method_exists($this, $jssetter = 'setjs' . $name))
675 687
 		{
676
-			if($value && !($value instanceof TJavaScriptString))
677
-				$value = new TJavaScriptString($value);
688
+			if($value && !($value instanceof TJavaScriptString)) {
689
+							$value = new TJavaScriptString($value);
690
+			}
678 691
 			return $this->$jssetter($value);
679
-		}
680
-		elseif((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0)
692
+		} elseif((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0)
681 693
 		{
682 694
 			return $this->attachEventHandler($name, $value);
683
-		}
684
-		elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
695
+		} elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
685 696
 		{
686 697
 			$sets = 0;
687 698
 			foreach($this->_m->toArray() as $behavior)
@@ -692,15 +703,16 @@  discard block
 block discarded – undo
692 703
 					$sets++;
693 704
 				}
694 705
 			}
695
-			if($sets)return $value;
706
+			if($sets) {
707
+				return $value;
708
+			}
696 709
 
697 710
 		}
698 711
 
699 712
 		if(method_exists($this, 'get' . $name) || method_exists($this, 'getjs' . $name))
700 713
 		{
701 714
 			throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
702
-		}
703
-		else
715
+		} else
704 716
 		{
705 717
 			throw new TInvalidOperationException('component_property_undefined', get_class($this), $name);
706 718
 		}
@@ -720,33 +732,33 @@  discard block
 block discarded – undo
720 732
 	 */
721 733
 	public function __isset($name)
722 734
 	{
723
-		if(method_exists($this, $getter = 'get' . $name))
724
-			return $this->$getter() !== null;
725
-		elseif(method_exists($this, $jsgetter = 'getjs' . $name))
726
-			return $this->$jsgetter() !== null;
727
-		elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
735
+		if(method_exists($this, $getter = 'get' . $name)) {
736
+					return $this->$getter() !== null;
737
+		} elseif(method_exists($this, $jsgetter = 'getjs' . $name)) {
738
+					return $this->$jsgetter() !== null;
739
+		} elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
728 740
 		{
729 741
 			$name = strtolower($name);
730 742
 			return isset($this->_e[$name]) && $this->_e[$name]->getCount();
731
-		}
732
-		elseif(strncasecmp($name, 'fx', 2) === 0)
743
+		} elseif(strncasecmp($name, 'fx', 2) === 0)
733 744
 		{
734 745
 			$name = strtolower($name);
735 746
 			return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount();
736
-		}
737
-		elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
747
+		} elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
738 748
 		{
739
-			if(isset($this->_m[$name]))
740
-				return true;
749
+			if(isset($this->_m[$name])) {
750
+							return true;
751
+			}
741 752
 			foreach($this->_m->toArray() as $behavior)
742 753
 			{
743
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()))
744
-					return isset($behavior->$name);
754
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled())) {
755
+									return isset($behavior->$name);
756
+				}
745 757
 			}
746 758
 
759
+		} else {
760
+					return false;
747 761
 		}
748
-		else
749
-			return false;
750 762
 	}
751 763
 
752 764
 	/**
@@ -761,19 +773,19 @@  discard block
 block discarded – undo
761 773
 	 */
762 774
 	public function __unset($name)
763 775
 	{
764
-		if(method_exists($this, $setter = 'set' . $name))
765
-			$this->$setter(null);
766
-		elseif(method_exists($this, $jssetter = 'setjs' . $name))
767
-			$this->$jssetter(null);
768
-		elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
769
-			$this->_e[strtolower($name)]->clear();
770
-		elseif(strncasecmp($name, 'fx', 2) === 0)
771
-			$this->getEventHandlers($name)->remove([$this, $name]);
772
-		elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
776
+		if(method_exists($this, $setter = 'set' . $name)) {
777
+					$this->$setter(null);
778
+		} elseif(method_exists($this, $jssetter = 'setjs' . $name)) {
779
+					$this->$jssetter(null);
780
+		} elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) {
781
+					$this->_e[strtolower($name)]->clear();
782
+		} elseif(strncasecmp($name, 'fx', 2) === 0) {
783
+					$this->getEventHandlers($name)->remove([$this, $name]);
784
+		} elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
773 785
 		{
774
-			if(isset($this->_m[$name]))
775
-				$this->detachBehavior($name);
776
-			else {
786
+			if(isset($this->_m[$name])) {
787
+							$this->detachBehavior($name);
788
+			} else {
777 789
 				$unset = 0;
778 790
 				foreach($this->_m->toArray() as $behavior)
779 791
 				{
@@ -782,11 +794,13 @@  discard block
 block discarded – undo
782 794
 						$unset++;
783 795
 					}
784 796
 				}
785
-				if(!$unset && method_exists($this, 'get' . $name))
786
-					throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
797
+				if(!$unset && method_exists($this, 'get' . $name)) {
798
+									throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
799
+				}
787 800
 			}
788
-		} elseif(method_exists($this, 'get' . $name))
789
-			throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
801
+		} elseif(method_exists($this, 'get' . $name)) {
802
+					throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
803
+		}
790 804
 	}
791 805
 
792 806
 	/**
@@ -812,14 +826,15 @@  discard block
 block discarded – undo
812 826
 	 */
813 827
 	public function canGetProperty($name)
814 828
 	{
815
-		if(method_exists($this, 'get' . $name) || method_exists($this, 'getjs' . $name))
816
-			return true;
817
-		elseif($this->_m !== null && $this->_behaviorsenabled)
829
+		if(method_exists($this, 'get' . $name) || method_exists($this, 'getjs' . $name)) {
830
+					return true;
831
+		} elseif($this->_m !== null && $this->_behaviorsenabled)
818 832
 		{
819 833
 			foreach($this->_m->toArray() as $behavior)
820 834
 			{
821
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canGetProperty($name))
822
-					return true;
835
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canGetProperty($name)) {
836
+									return true;
837
+				}
823 838
 			}
824 839
 		}
825 840
 		return false;
@@ -836,14 +851,15 @@  discard block
 block discarded – undo
836 851
 	 */
837 852
 	public function canSetProperty($name)
838 853
 	{
839
-		if(method_exists($this, 'set' . $name) || method_exists($this, 'setjs' . $name))
840
-			return true;
841
-		elseif($this->_m !== null && $this->_behaviorsenabled)
854
+		if(method_exists($this, 'set' . $name) || method_exists($this, 'setjs' . $name)) {
855
+					return true;
856
+		} elseif($this->_m !== null && $this->_behaviorsenabled)
842 857
 		{
843 858
 			foreach($this->_m->toArray() as $behavior)
844 859
 			{
845
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canSetProperty($name))
846
-					return true;
860
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canSetProperty($name)) {
861
+									return true;
862
+				}
847 863
 			}
848 864
 		}
849 865
 		return false;
@@ -862,8 +878,9 @@  discard block
 block discarded – undo
862 878
 	public function getSubProperty($path)
863 879
 	{
864 880
 		$object = $this;
865
-		foreach(explode('.', $path) as $property)
866
-			$object = $object->$property;
881
+		foreach(explode('.', $path) as $property) {
882
+					$object = $object->$property;
883
+		}
867 884
 		return $object;
868 885
 	}
869 886
 
@@ -880,9 +897,9 @@  discard block
 block discarded – undo
880 897
 	public function setSubProperty($path, $value)
881 898
 	{
882 899
 		$object = $this;
883
-		if(($pos = strrpos($path, '.')) === false)
884
-			$property = $path;
885
-		else
900
+		if(($pos = strrpos($path, '.')) === false) {
901
+					$property = $path;
902
+		} else
886 903
 		{
887 904
 			$object = $this->getSubProperty(substr($path, 0, $pos));
888 905
 			$property = substr($path, $pos + 1);
@@ -904,15 +921,15 @@  discard block
 block discarded – undo
904 921
 	 */
905 922
 	public function hasEvent($name)
906 923
 	{
907
-		if((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0 || strncasecmp($name, 'dy', 2) === 0)
908
-			return true;
909
-
910
-		elseif($this->_m !== null && $this->_behaviorsenabled)
924
+		if((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0 || strncasecmp($name, 'dy', 2) === 0) {
925
+					return true;
926
+		} elseif($this->_m !== null && $this->_behaviorsenabled)
911 927
 		{
912 928
 			foreach($this->_m->toArray() as $behavior)
913 929
 			{
914
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
915
-					return true;
930
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name)) {
931
+									return true;
932
+				}
916 933
 			}
917 934
 		}
918 935
 		return false;
@@ -928,17 +945,18 @@  discard block
 block discarded – undo
928 945
 	public function hasEventHandler($name)
929 946
 	{
930 947
 		$name = strtolower($name);
931
-		if(strncasecmp($name, 'fx', 2) === 0)
932
-			return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount() > 0;
933
-		else
948
+		if(strncasecmp($name, 'fx', 2) === 0) {
949
+					return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount() > 0;
950
+		} else
934 951
 		{
935
-			if(isset($this->_e[$name]) && $this->_e[$name]->getCount() > 0)
936
-				return true;
937
-			elseif($this->_m !== null && $this->_behaviorsenabled) {
952
+			if(isset($this->_e[$name]) && $this->_e[$name]->getCount() > 0) {
953
+							return true;
954
+			} elseif($this->_m !== null && $this->_behaviorsenabled) {
938 955
 				foreach($this->_m->toArray() as $behavior)
939 956
 				{
940
-					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEventHandler($name))
941
-						return true;
957
+					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEventHandler($name)) {
958
+											return true;
959
+					}
942 960
 				}
943 961
 			}
944 962
 		}
@@ -956,23 +974,24 @@  discard block
 block discarded – undo
956 974
 		if(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name))
957 975
 		{
958 976
 			$name = strtolower($name);
959
-			if(!isset($this->_e[$name]))
960
-				$this->_e[$name] = new TPriorityList;
977
+			if(!isset($this->_e[$name])) {
978
+							$this->_e[$name] = new TPriorityList;
979
+			}
961 980
 			return $this->_e[$name];
962
-		}
963
-		elseif(strncasecmp($name, 'fx', 2) === 0)
981
+		} elseif(strncasecmp($name, 'fx', 2) === 0)
964 982
 		{
965 983
 			$name = strtolower($name);
966
-			if(!isset(self::$_ue[$name]))
967
-				self::$_ue[$name] = new TPriorityList;
984
+			if(!isset(self::$_ue[$name])) {
985
+							self::$_ue[$name] = new TPriorityList;
986
+			}
968 987
 			return self::$_ue[$name];
969
-		}
970
-		elseif($this->_m !== null && $this->_behaviorsenabled)
988
+		} elseif($this->_m !== null && $this->_behaviorsenabled)
971 989
 		{
972 990
 			foreach($this->_m->toArray() as $behavior)
973 991
 			{
974
-				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
975
-					return $behavior->getEventHandlers($name);
992
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name)) {
993
+									return $behavior->getEventHandlers($name);
994
+				}
976 995
 			}
977 996
 		}
978 997
 		throw new TInvalidOperationException('component_event_undefined', get_class($this), $name);
@@ -1046,8 +1065,7 @@  discard block
 block discarded – undo
1046 1065
 			{
1047 1066
 				$this->getEventHandlers($name)->remove($handler, $priority);
1048 1067
 				return true;
1049
-			}
1050
-			catch(\Exception $e)
1068
+			} catch(\Exception $e)
1051 1069
 			{
1052 1070
 			}
1053 1071
 		}
@@ -1135,8 +1153,9 @@  discard block
 block discarded – undo
1135 1153
 			$responsetype = null;
1136 1154
 		}
1137 1155
 
1138
-		if($responsetype === null)
1139
-			$responsetype = TEventResults::EVENT_RESULT_FILTER;
1156
+		if($responsetype === null) {
1157
+					$responsetype = TEventResults::EVENT_RESULT_FILTER;
1158
+		}
1140 1159
 
1141 1160
 		$name = strtolower($name);
1142 1161
 		$responses = [];
@@ -1155,8 +1174,9 @@  discard block
 block discarded – undo
1155 1174
 			$response = null;
1156 1175
 			foreach($handlerArray as $handler)
1157 1176
 			{
1158
-				if($this->dyIntraRaiseEventTestHandler($handler, $sender, $param, $name) === false)
1159
-					continue;
1177
+				if($this->dyIntraRaiseEventTestHandler($handler, $sender, $param, $name) === false) {
1178
+									continue;
1179
+				}
1160 1180
 
1161 1181
 				if(is_string($handler))
1162 1182
 				{
@@ -1166,23 +1186,23 @@  discard block
 block discarded – undo
1166 1186
 						$method = substr($handler, $pos + 1);
1167 1187
 						if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
1168 1188
 						{
1169
-							if($method == '__dycall')
1170
-								$response = $object->__dycall($name, [$sender,$param,$name]);
1171
-							else
1172
-								$response = $object->$method($sender, $param, $name);
1189
+							if($method == '__dycall') {
1190
+															$response = $object->__dycall($name, [$sender,$param,$name]);
1191
+							} else {
1192
+															$response = $object->$method($sender, $param, $name);
1193
+							}
1194
+						} else {
1195
+													throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler);
1173 1196
 						}
1174
-						else
1175
-							throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler);
1197
+					} else {
1198
+											$response = call_user_func($handler, $sender, $param, $name);
1176 1199
 					}
1177
-					else
1178
-						$response = call_user_func($handler, $sender, $param, $name);
1179
-				}
1180
-				elseif(is_callable($handler, true))
1200
+				} elseif(is_callable($handler, true))
1181 1201
 				{
1182 1202
 					list($object, $method) = $handler;
1183
-					if(is_string($object))
1184
-						$response = call_user_func($handler, $sender, $param, $name);
1185
-					else
1203
+					if(is_string($object)) {
1204
+											$response = call_user_func($handler, $sender, $param, $name);
1205
+					} else
1186 1206
 					{
1187 1207
 						if(($pos = strrpos($method, '.')) !== false)
1188 1208
 						{
@@ -1191,38 +1211,43 @@  discard block
 block discarded – undo
1191 1211
 						}
1192 1212
 						if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0)
1193 1213
 						{
1194
-							if($method == '__dycall')
1195
-								$response = $object->__dycall($name, [$sender,$param,$name]);
1196
-							else
1197
-								$response = $object->$method($sender, $param, $name);
1214
+							if($method == '__dycall') {
1215
+															$response = $object->__dycall($name, [$sender,$param,$name]);
1216
+							} else {
1217
+															$response = $object->$method($sender, $param, $name);
1218
+							}
1219
+						} else {
1220
+													throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler[1]);
1198 1221
 						}
1199
-						else
1200
-							throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler[1]);
1201 1222
 					}
1223
+				} else {
1224
+									throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, gettype($handler));
1202 1225
 				}
1203
-				else
1204
-					throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, gettype($handler));
1205 1226
 
1206 1227
 				$this->dyIntraRaiseEventPostHandler($name, $sender, $param, $handler, $response);
1207 1228
 
1208
-				if($postfunction)
1209
-					$response = call_user_func_array($postfunction, [$sender,$param,$this,$response]);
1229
+				if($postfunction) {
1230
+									$response = call_user_func_array($postfunction, [$sender,$param,$this,$response]);
1231
+				}
1210 1232
 
1211
-				if($responsetype & TEventResults::EVENT_RESULT_ALL)
1212
-					$responses[] = ['sender' => $sender,'param' => $param,'response' => $response];
1213
-				else
1214
-					$responses[] = $response;
1233
+				if($responsetype & TEventResults::EVENT_RESULT_ALL) {
1234
+									$responses[] = ['sender' => $sender,'param' => $param,'response' => $response];
1235
+				} else {
1236
+									$responses[] = $response;
1237
+				}
1215 1238
 
1216
-				if($response !== null && ($responsetype & TEventResults::EVENT_RESULT_FEED_FORWARD))
1217
-					$param = $response;
1239
+				if($response !== null && ($responsetype & TEventResults::EVENT_RESULT_FEED_FORWARD)) {
1240
+									$param = $response;
1241
+				}
1218 1242
 
1219 1243
 			}
1244
+		} elseif(strncasecmp($name, 'on', 2) === 0 && !$this->hasEvent($name)) {
1245
+					throw new TInvalidOperationException('component_event_undefined', get_class($this), $name);
1220 1246
 		}
1221
-		elseif(strncasecmp($name, 'on', 2) === 0 && !$this->hasEvent($name))
1222
-			throw new TInvalidOperationException('component_event_undefined', get_class($this), $name);
1223 1247
 
1224
-		if($responsetype & TEventResults::EVENT_RESULT_FILTER)
1225
-			$responses = array_filter($responses);
1248
+		if($responsetype & TEventResults::EVENT_RESULT_FILTER) {
1249
+					$responses = array_filter($responses);
1250
+		}
1226 1251
 
1227 1252
 		$responses = $this->dyPostRaiseEvent($responses, $name, $sender, $param, $responsetype, $postfunction);
1228 1253
 
@@ -1251,11 +1276,11 @@  discard block
 block discarded – undo
1251 1276
 		$expression = $this->dyEvaluateExpressionFilter($expression);
1252 1277
 		try
1253 1278
 		{
1254
-			if(eval("\$result=$expression;") === false)
1255
-				throw new \Exception('');
1279
+			if(eval("\$result=$expression;") === false) {
1280
+							throw new \Exception('');
1281
+			}
1256 1282
 			return $result;
1257
-		}
1258
-		catch(\Exception $e)
1283
+		} catch(\Exception $e)
1259 1284
 		{
1260 1285
 			throw new TInvalidOperationException('component_expression_invalid', get_class($this), $expression, $e->getMessage());
1261 1286
 		}
@@ -1284,13 +1309,13 @@  discard block
 block discarded – undo
1284 1309
 		try
1285 1310
 		{
1286 1311
 			ob_start();
1287
-			if(eval($statements) === false)
1288
-				throw new \Exception('');
1312
+			if(eval($statements) === false) {
1313
+							throw new \Exception('');
1314
+			}
1289 1315
 			$content = ob_get_contents();
1290 1316
 			ob_end_clean();
1291 1317
 			return $content;
1292
-		}
1293
-		catch(\Exception $e)
1318
+		} catch(\Exception $e)
1294 1319
 		{
1295 1320
 			throw new TInvalidOperationException('component_statements_invalid', get_class($this), $statements, $e->getMessage());
1296 1321
 		}
@@ -1353,8 +1378,9 @@  discard block
 block discarded – undo
1353 1378
 	 * @since 3.2.3
1354 1379
 	 */
1355 1380
 	public function fxAttachClassBehavior($sender, $param) {
1356
-		if(in_array($param->getClass(), $this->getClassHierarchy(true)))
1357
-			return $this->attachBehavior($param->getName(), $param->getBehavior(), $param->getPriority());
1381
+		if(in_array($param->getClass(), $this->getClassHierarchy(true))) {
1382
+					return $this->attachBehavior($param->getName(), $param->getBehavior(), $param->getPriority());
1383
+		}
1358 1384
 	}
1359 1385
 
1360 1386
 
@@ -1367,8 +1393,9 @@  discard block
 block discarded – undo
1367 1393
 	 * @since 3.2.3
1368 1394
 	 */
1369 1395
 	public function fxDetachClassBehavior($sender, $param) {
1370
-		if(in_array($param->getClass(), $this->getClassHierarchy(true)))
1371
-			return $this->detachBehavior($param->getName(), $param->getPriority());
1396
+		if(in_array($param->getClass(), $this->getClassHierarchy(true))) {
1397
+					return $this->detachBehavior($param->getName(), $param->getPriority());
1398
+		}
1372 1399
 	}
1373 1400
 
1374 1401
 
@@ -1391,20 +1418,26 @@  discard block
 block discarded – undo
1391 1418
 	 * @since 3.2.3
1392 1419
 	 */
1393 1420
 	public static function attachClassBehavior($name, $behavior, $class = null, $priority = null) {
1394
-		if(!$class && function_exists('get_called_class'))
1395
-			$class = get_called_class();
1396
-		if(!$class)
1397
-			throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
1421
+		if(!$class && function_exists('get_called_class')) {
1422
+					$class = get_called_class();
1423
+		}
1424
+		if(!$class) {
1425
+					throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
1426
+		}
1398 1427
 
1399
-		if(!is_string($name))
1400
-			$name = get_class($name);
1428
+		if(!is_string($name)) {
1429
+					$name = get_class($name);
1430
+		}
1401 1431
 		$class = strtolower($class);
1402
-		if($class === 'tcomponent')
1403
-			throw new TInvalidOperationException('component_no_tcomponent_class_behaviors');
1404
-		if(empty(self::$_um[$class]))
1405
-			self::$_um[$class] = [];
1406
-		if(isset(self::$_um[$class][$name]))
1407
-			throw new TInvalidOperationException('component_class_behavior_defined', $class, $name);
1432
+		if($class === 'tcomponent') {
1433
+					throw new TInvalidOperationException('component_no_tcomponent_class_behaviors');
1434
+		}
1435
+		if(empty(self::$_um[$class])) {
1436
+					self::$_um[$class] = [];
1437
+		}
1438
+		if(isset(self::$_um[$class][$name])) {
1439
+					throw new TInvalidOperationException('component_class_behavior_defined', $class, $name);
1440
+		}
1408 1441
 		$param = new TClassBehaviorEventParameter($class, $name, $behavior, $priority);
1409 1442
 		self::$_um[$class] = [$name => $param] + self::$_um[$class];
1410 1443
 		$behaviorObject = is_string($behavior)?new $behavior:$behavior;
@@ -1425,16 +1458,20 @@  discard block
 block discarded – undo
1425 1458
 	 * @since 3.2.3
1426 1459
 	 */
1427 1460
 	public static function detachClassBehavior($name, $class = null, $priority = false) {
1428
-		if(!$class && function_exists('get_called_class'))
1429
-			$class = get_called_class();
1430
-		if(!$class)
1431
-			throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
1461
+		if(!$class && function_exists('get_called_class')) {
1462
+					$class = get_called_class();
1463
+		}
1464
+		if(!$class) {
1465
+					throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
1466
+		}
1432 1467
 
1433 1468
 		$class = strtolower($class);
1434
-		if(!is_string($name))
1435
-			$name = get_class($name);
1436
-		if(empty(self::$_um[$class]) || !isset(self::$_um[$class][$name]))
1437
-			return false;
1469
+		if(!is_string($name)) {
1470
+					$name = get_class($name);
1471
+		}
1472
+		if(empty(self::$_um[$class]) || !isset(self::$_um[$class][$name])) {
1473
+					return false;
1474
+		}
1438 1475
 		$param = self::$_um[$class][$name];
1439 1476
 		$behavior = $param->getBehavior();
1440 1477
 		unset(self::$_um[$class][$name]);
@@ -1475,18 +1512,22 @@  discard block
 block discarded – undo
1475 1512
 	 */
1476 1513
 	public function isa($class)
1477 1514
 	{
1478
-		if($this instanceof $class)
1479
-			return true;
1480
-		if($this->_m !== null && $this->_behaviorsenabled)
1481
-			foreach($this->_m->toArray() as $behavior){
1515
+		if($this instanceof $class) {
1516
+					return true;
1517
+		}
1518
+		if($this->_m !== null && $this->_behaviorsenabled) {
1519
+					foreach($this->_m->toArray() as $behavior){
1482 1520
 				if(($behavior instanceof IBehavior) && !$behavior->getEnabled())
1483 1521
 					continue;
1522
+		}
1484 1523
 
1485 1524
 				$check = null;
1486
-				if(($behavior->isa('\Prado\Util\IInstanceCheck')) && $check = $behavior->isinstanceof($class, $this))
1487
-					return true;
1488
-				if($check === null && ($behavior->isa($class)))
1489
-					return true;
1525
+				if(($behavior->isa('\Prado\Util\IInstanceCheck')) && $check = $behavior->isinstanceof($class, $this)) {
1526
+									return true;
1527
+				}
1528
+				if($check === null && ($behavior->isa($class))) {
1529
+									return true;
1530
+				}
1490 1531
 			}
1491 1532
 		return false;
1492 1533
 	}
@@ -1501,11 +1542,13 @@  discard block
 block discarded – undo
1501 1542
 	 */
1502 1543
 	public function attachBehaviors($behaviors)
1503 1544
 	{
1504
-		foreach($behaviors as $name => $behavior)
1505
-			if($behavior instanceof TClassBehaviorEventParameter)
1545
+		foreach($behaviors as $name => $behavior) {
1546
+					if($behavior instanceof TClassBehaviorEventParameter)
1506 1547
 				$this->attachBehavior($behavior->getName(), $behavior->getBehavior(), $behavior->getPriority());
1507
-			else
1508
-				$this->attachBehavior($name, $behavior);
1548
+		}
1549
+			else {
1550
+							$this->attachBehavior($name, $behavior);
1551
+			}
1509 1552
 	}
1510 1553
 
1511 1554
 	/**
@@ -1520,11 +1563,13 @@  discard block
 block discarded – undo
1520 1563
 	{
1521 1564
 		if($this->_m !== null)
1522 1565
 		{
1523
-			foreach($behaviors as $name => $behavior)
1524
-				if($behavior instanceof TClassBehaviorEventParameter)
1566
+			foreach($behaviors as $name => $behavior) {
1567
+							if($behavior instanceof TClassBehaviorEventParameter)
1525 1568
 					$this->detachBehavior($behavior->getName(), $behavior->getPriority());
1526
-				else
1527
-					$this->detachBehavior(is_string($behavior)?$behavior:$name);
1569
+			}
1570
+				else {
1571
+									$this->detachBehavior(is_string($behavior)?$behavior:$name);
1572
+				}
1528 1573
 		}
1529 1574
 	}
1530 1575
 
@@ -1536,8 +1581,9 @@  discard block
 block discarded – undo
1536 1581
 	{
1537 1582
 		if($this->_m !== null)
1538 1583
 		{
1539
-			foreach($this->_m->toArray() as $name => $behavior)
1540
-				$this->detachBehavior($name);
1584
+			foreach($this->_m->toArray() as $name => $behavior) {
1585
+							$this->detachBehavior($name);
1586
+			}
1541 1587
 			$this->_m = null;
1542 1588
 		}
1543 1589
 	}
@@ -1564,14 +1610,18 @@  discard block
 block discarded – undo
1564 1610
 	 */
1565 1611
 	public function attachBehavior($name, $behavior, $priority = null)
1566 1612
 	{
1567
-		if(is_string($behavior))
1568
-			$behavior = Prado::createComponent($behavior);
1569
-		if(!($behavior instanceof IBaseBehavior))
1570
-			throw new TInvalidDataTypeException('component_not_a_behavior', get_class($behavior));
1571
-		if($behavior instanceof IBehavior)
1572
-			$behavior->setEnabled(true);
1573
-		if($this->_m === null)
1574
-			$this->_m = new TPriorityMap;
1613
+		if(is_string($behavior)) {
1614
+					$behavior = Prado::createComponent($behavior);
1615
+		}
1616
+		if(!($behavior instanceof IBaseBehavior)) {
1617
+					throw new TInvalidDataTypeException('component_not_a_behavior', get_class($behavior));
1618
+		}
1619
+		if($behavior instanceof IBehavior) {
1620
+					$behavior->setEnabled(true);
1621
+		}
1622
+		if($this->_m === null) {
1623
+					$this->_m = new TPriorityMap;
1624
+		}
1575 1625
 		$behavior->attach($this);
1576 1626
 		$this->dyAttachBehavior($name, $behavior);
1577 1627
 		$this->_m->add($name, $behavior, $priority);
@@ -1739,13 +1789,17 @@  discard block
 block discarded – undo
1739 1789
 	 */
1740 1790
 	protected function _getZappableSleepProps(&$exprops)
1741 1791
 	{
1742
-		if($this->_listeningenabled === false)
1743
-			$exprops[] = "\0Prado\TComponent\0_listeningenabled";
1744
-		if($this->_behaviorsenabled === true)
1745
-			$exprops[] = "\0Prado\TComponent\0_behaviorsenabled";
1746
-		if ($this->_e === [])
1747
-			$exprops[] = "\0Prado\TComponent\0_e";
1748
-		if ($this->_m === null)
1749
-			$exprops[] = "\0Prado\TComponent\0_m";
1792
+		if($this->_listeningenabled === false) {
1793
+					$exprops[] = "\0Prado\TComponent\0_listeningenabled";
1794
+		}
1795
+		if($this->_behaviorsenabled === true) {
1796
+					$exprops[] = "\0Prado\TComponent\0_behaviorsenabled";
1797
+		}
1798
+		if ($this->_e === []) {
1799
+					$exprops[] = "\0Prado\TComponent\0_e";
1800
+		}
1801
+		if ($this->_m === null) {
1802
+					$exprops[] = "\0Prado\TComponent\0_m";
1803
+		}
1750 1804
 	}
1751 1805
 }
1752 1806
\ No newline at end of file
Please login to merge, or discard this patch.
framework/TPropertyValue.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		if (is_string($value))
66 66
 			return strcasecmp($value, 'true') == 0 || $value != 0;
67 67
 		else
68
-			return (boolean)$value;
68
+			return (boolean) $value;
69 69
 	}
70 70
 
71 71
 	/**
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 		if (TJavaScript::isJsLiteral($value))
81 81
 			return $value;
82 82
 		if (is_bool($value))
83
-			return $value?'true':'false';
83
+			return $value ? 'true' : 'false';
84 84
 		else
85
-			return (string)$value;
85
+			return (string) $value;
86 86
 	}
87 87
 
88 88
 	/**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public static function ensureInteger($value)
94 94
 	{
95
-		return (integer)$value;
95
+		return (integer) $value;
96 96
 	}
97 97
 
98 98
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public static function ensureFloat($value)
104 104
 	{
105
-		return (float)$value;
105
+		return (float) $value;
106 106
 	}
107 107
 
108 108
 	/**
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public static function ensureArray($value)
118 118
 	{
119
-		if(is_string($value))
119
+		if (is_string($value))
120 120
 		{
121 121
 			$value = trim($value);
122 122
 			$len = strlen($value);
123 123
 			if ($len >= 2 && $value[0] == '(' && $value[$len - 1] == ')')
124 124
 			{
125
-				eval('$array=array' . $value . ';');
125
+				eval('$array=array'.$value.';');
126 126
 				return $array;
127 127
 			}
128 128
 			else
129
-				return $len > 0?[$value]:[];
129
+				return $len > 0 ? [$value] : [];
130 130
 		}
131 131
 		else
132
-			return (array)$value;
132
+			return (array) $value;
133 133
 	}
134 134
 
135 135
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public static function ensureObject($value)
141 141
 	{
142
-		return (object)$value;
142
+		return (object) $value;
143 143
 	}
144 144
 
145 145
 	/**
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 	public static function ensureEnum($value, $enums)
162 162
 	{
163 163
 		static $types = [];
164
-		if(func_num_args() === 2 && is_string($enums))
164
+		if (func_num_args() === 2 && is_string($enums))
165 165
 		{
166
-			if(!isset($types[$enums]))
166
+			if (!isset($types[$enums]))
167 167
 				$types[$enums] = new \ReflectionClass($enums);
168
-			if($types[$enums]->hasConstant($value))
168
+			if ($types[$enums]->hasConstant($value))
169 169
 				return $value;
170 170
 			else
171 171
 				throw new TInvalidDataValueException(
172 172
 					'propertyvalue_enumvalue_invalid', $value,
173 173
 						implode(' | ', $types[$enums]->getConstants()));
174 174
 		}
175
-		elseif(!is_array($enums))
175
+		elseif (!is_array($enums))
176 176
 		{
177 177
 			$enums = func_get_args();
178 178
 			array_shift($enums);
179 179
 		}
180
-		if(in_array($value, $enums, true))
180
+		if (in_array($value, $enums, true))
181 181
 			return $value;
182 182
 		else
183 183
 			throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid', $value, implode(' | ', $enums));
@@ -190,6 +190,6 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public static function ensureNullIfEmpty($value)
192 192
 	{
193
-		return empty($value)?null:$value;
193
+		return empty($value) ?null:$value;
194 194
 	}
195 195
 }
196 196
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +31 added lines, -26 removed lines patch added patch discarded remove patch
@@ -62,10 +62,11 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public static function ensureBoolean($value)
64 64
 	{
65
-		if (is_string($value))
66
-			return strcasecmp($value, 'true') == 0 || $value != 0;
67
-		else
68
-			return (boolean)$value;
65
+		if (is_string($value)) {
66
+					return strcasecmp($value, 'true') == 0 || $value != 0;
67
+		} else {
68
+					return (boolean)$value;
69
+		}
69 70
 	}
70 71
 
71 72
 	/**
@@ -77,12 +78,14 @@  discard block
 block discarded – undo
77 78
 	 */
78 79
 	public static function ensureString($value)
79 80
 	{
80
-		if (TJavaScript::isJsLiteral($value))
81
-			return $value;
82
-		if (is_bool($value))
83
-			return $value?'true':'false';
84
-		else
85
-			return (string)$value;
81
+		if (TJavaScript::isJsLiteral($value)) {
82
+					return $value;
83
+		}
84
+		if (is_bool($value)) {
85
+					return $value?'true':'false';
86
+		} else {
87
+					return (string)$value;
88
+		}
86 89
 	}
87 90
 
88 91
 	/**
@@ -124,12 +127,12 @@  discard block
 block discarded – undo
124 127
 			{
125 128
 				eval('$array=array' . $value . ';');
126 129
 				return $array;
130
+			} else {
131
+							return $len > 0?[$value]:[];
127 132
 			}
128
-			else
129
-				return $len > 0?[$value]:[];
133
+		} else {
134
+					return (array)$value;
130 135
 		}
131
-		else
132
-			return (array)$value;
133 136
 	}
134 137
 
135 138
 	/**
@@ -163,24 +166,26 @@  discard block
 block discarded – undo
163 166
 		static $types = [];
164 167
 		if(func_num_args() === 2 && is_string($enums))
165 168
 		{
166
-			if(!isset($types[$enums]))
167
-				$types[$enums] = new \ReflectionClass($enums);
168
-			if($types[$enums]->hasConstant($value))
169
-				return $value;
170
-			else
171
-				throw new TInvalidDataValueException(
169
+			if(!isset($types[$enums])) {
170
+							$types[$enums] = new \ReflectionClass($enums);
171
+			}
172
+			if($types[$enums]->hasConstant($value)) {
173
+							return $value;
174
+			} else {
175
+							throw new TInvalidDataValueException(
172 176
 					'propertyvalue_enumvalue_invalid', $value,
173 177
 						implode(' | ', $types[$enums]->getConstants()));
174
-		}
175
-		elseif(!is_array($enums))
178
+			}
179
+		} elseif(!is_array($enums))
176 180
 		{
177 181
 			$enums = func_get_args();
178 182
 			array_shift($enums);
179 183
 		}
180
-		if(in_array($value, $enums, true))
181
-			return $value;
182
-		else
183
-			throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid', $value, implode(' | ', $enums));
184
+		if(in_array($value, $enums, true)) {
185
+					return $value;
186
+		} else {
187
+					throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid', $value, implode(' | ', $enums));
188
+		}
184 189
 	}
185 190
 
186 191
 	/**
Please login to merge, or discard this patch.
framework/Data/TDbDataReader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function bindColumn($column, &$value, $dataType = null)
69 69
 	{
70
-		if($dataType === null)
70
+		if ($dataType === null)
71 71
 			$this->_statement->bindColumn($column, $value);
72 72
 		else
73 73
 			$this->_statement->bindColumn($column, $value, $dataType);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function setFetchMode($mode)
80 80
 	{
81 81
 		$params = func_get_args();
82
-		call_user_func_array([$this->_statement,'setFetchMode'], $params);
82
+		call_user_func_array([$this->_statement, 'setFetchMode'], $params);
83 83
 	}
84 84
 
85 85
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function rewind()
178 178
 	{
179
-		if($this->_index < 0)
179
+		if ($this->_index < 0)
180 180
 		{
181 181
 			$this->_row = $this->_statement->fetch();
182 182
 			$this->_index = 0;
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,10 +67,11 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function bindColumn($column, &$value, $dataType = null)
69 69
 	{
70
-		if($dataType === null)
71
-			$this->_statement->bindColumn($column, $value);
72
-		else
73
-			$this->_statement->bindColumn($column, $value, $dataType);
70
+		if($dataType === null) {
71
+					$this->_statement->bindColumn($column, $value);
72
+		} else {
73
+					$this->_statement->bindColumn($column, $value, $dataType);
74
+		}
74 75
 	}
75 76
 
76 77
 	/**
@@ -180,9 +181,9 @@  discard block
 block discarded – undo
180 181
 		{
181 182
 			$this->_row = $this->_statement->fetch();
182 183
 			$this->_index = 0;
184
+		} else {
185
+					throw new TDbException('dbdatareader_rewind_invalid');
183 186
 		}
184
-		else
185
-			throw new TDbException('dbdatareader_rewind_invalid');
186 187
 	}
187 188
 
188 189
 	/**
Please login to merge, or discard this patch.
framework/Data/TDbConnection.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	public function __sleep()
142 142
 	{
143 143
 //		$this->close(); - DO NOT CLOSE the current connection as serializing doesn't neccessarily mean we don't this connection anymore in the current session
144
-		return array_diff(parent::__sleep(), ["\0Prado\Data\TDbConnection\0_pdo","\0Prado\Data\TDbConnection\0_active"]);
144
+		return array_diff(parent::__sleep(), ["\0Prado\Data\TDbConnection\0_pdo", "\0Prado\Data\TDbConnection\0_active"]);
145 145
 	}
146 146
 
147 147
 	/**
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 	public function setActive($value)
170 170
 	{
171 171
 		$value = TPropertyValue::ensureBoolean($value);
172
-		if($value !== $this->_active)
172
+		if ($value !== $this->_active)
173 173
 		{
174
-			if($value)
174
+			if ($value)
175 175
 				$this->open();
176 176
 			else
177 177
 				$this->close();
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function open()
186 186
 	{
187
-		if($this->_pdo === null)
187
+		if ($this->_pdo === null)
188 188
 		{
189 189
 			try
190 190
 			{
191
-				$this->_pdo = new PDO($this->getConnectionString(),$this->getUsername(),
191
+				$this->_pdo = new PDO($this->getConnectionString(), $this->getUsername(),
192 192
 									$this->getPassword(), $this->_attributes);
193 193
 				// This attribute is only useful for PDO::MySql driver.
194 194
 				// Ignore the warning if a driver doesn't understand this.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				$this->_active = true;
198 198
 				$this->setConnectionCharset();
199 199
 			}
200
-			catch(PDOException $e)
200
+			catch (PDOException $e)
201 201
 			{
202 202
 				throw new TDbException('dbconnection_open_failed', $e->getMessage());
203 203
 			}
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	/**
291 291
 	 * @return string the charset used for database connection. Defaults to emtpy string.
292 292
 	 */
293
-	public function getCharset ()
293
+	public function getCharset()
294 294
 	{
295 295
 		return $this->_charset;
296 296
 	}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	/**
299 299
 	 * @param string the charset used for database connection
300 300
 	 */
301
-	public function setCharset ($value)
301
+	public function setCharset($value)
302 302
 	{
303 303
 		$this->_charset = $value;
304 304
 		$this->setConnectionCharset();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function createCommand($sql)
322 322
 	{
323
-		if($this->getActive())
323
+		if ($this->getActive())
324 324
 			return new TDbCommand($this, $sql);
325 325
 		else
326 326
 			throw new TDbException('dbconnection_connection_inactive');
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	public function getCurrentTransaction()
333 333
 	{
334
-		if($this->_transaction !== null)
334
+		if ($this->_transaction !== null)
335 335
 		{
336
-			if($this->_transaction->getActive())
336
+			if ($this->_transaction->getActive())
337 337
 				return $this->_transaction;
338 338
 		}
339 339
 		return null;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	public function beginTransaction()
348 348
 	{
349
-		if($this->getActive())
349
+		if ($this->getActive())
350 350
 		{
351 351
 			$this->_pdo->beginTransaction();
352 352
 			return $this->_transaction = Prado::createComponent($this->getTransactionClass(), $this);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	public function setTransactionClass($value)
373 373
 	{
374
-		$this->_transactionClass = (string)$value;
374
+		$this->_transactionClass = (string) $value;
375 375
 	}
376 376
 
377 377
 	/**
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function getLastInsertID($sequenceName = '')
384 384
 	{
385
-		if($this->getActive())
385
+		if ($this->getActive())
386 386
 			return $this->_pdo->lastInsertId($sequenceName);
387 387
 		else
388 388
 			throw new TDbException('dbconnection_connection_inactive');
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	 */
397 397
 	public function quoteString($str)
398 398
 	{
399
-		if($this->getActive())
399
+		if ($this->getActive())
400 400
 			return $this->_pdo->quote($str);
401 401
 		else
402 402
 			throw new TDbException('dbconnection_connection_inactive');
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	public function getDbMetaData()
439 439
 	{
440
-		if($this->_dbMeta === null)
440
+		if ($this->_dbMeta === null)
441 441
 		{
442 442
 			$this->_dbMeta = TDbMetaData::getInstance($this);
443 443
 		}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	 */
450 450
 	public function getColumnCase()
451 451
 	{
452
-		switch($this->getAttribute(PDO::ATTR_CASE))
452
+		switch ($this->getAttribute(PDO::ATTR_CASE))
453 453
 		{
454 454
 			case PDO::CASE_NATURAL:
455 455
 				return TDbColumnCaseMode::Preserved;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	public function setColumnCase($value)
467 467
 	{
468
-		switch(TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbColumnCaseMode'))
468
+		switch (TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbColumnCaseMode'))
469 469
 		{
470 470
 			case TDbColumnCaseMode::Preserved:
471 471
 				$value = PDO::CASE_NATURAL;
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function getNullConversion()
487 487
 	{
488
-		switch($this->getAttribute(PDO::ATTR_ORACLE_NULLS))
488
+		switch ($this->getAttribute(PDO::ATTR_ORACLE_NULLS))
489 489
 		{
490 490
 			case PDO::NULL_NATURAL:
491 491
 				return TDbNullConversionMode::Preserved;
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 */
502 502
 	public function setNullConversion($value)
503 503
 	{
504
-		switch(TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbNullConversionMode'))
504
+		switch (TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbNullConversionMode'))
505 505
 		{
506 506
 			case TDbNullConversionMode::Preserved:
507 507
 				$value = PDO::NULL_NATURAL;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	 */
618 618
 	public function getAttribute($name)
619 619
 	{
620
-		if($this->getActive())
620
+		if ($this->getActive())
621 621
 			return $this->_pdo->getAttribute($name);
622 622
 		else
623 623
 			throw new TDbException('dbconnection_connection_inactive');
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 */
632 632
 	public function setAttribute($name, $value)
633 633
 	{
634
-		if($this->_pdo instanceof PDO)
634
+		if ($this->_pdo instanceof PDO)
635 635
 			$this->_pdo->setAttribute($name, $value);
636 636
 		else
637 637
 			$this->_attributes[$name] = $value;
Please login to merge, or discard this patch.
Braces   +39 added lines, -32 removed lines patch added patch discarded remove patch
@@ -171,10 +171,11 @@  discard block
 block discarded – undo
171 171
 		$value = TPropertyValue::ensureBoolean($value);
172 172
 		if($value !== $this->_active)
173 173
 		{
174
-			if($value)
175
-				$this->open();
176
-			else
177
-				$this->close();
174
+			if($value) {
175
+							$this->open();
176
+			} else {
177
+							$this->close();
178
+			}
178 179
 		}
179 180
 	}
180 181
 
@@ -196,8 +197,7 @@  discard block
 block discarded – undo
196 197
 				$this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
197 198
 				$this->_active = true;
198 199
 				$this->setConnectionCharset();
199
-			}
200
-			catch(PDOException $e)
200
+			} catch(PDOException $e)
201 201
 			{
202 202
 				throw new TDbException('dbconnection_open_failed', $e->getMessage());
203 203
 			}
@@ -221,8 +221,9 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	protected function setConnectionCharset()
223 223
 	{
224
-		if ($this->_charset === '' || $this->_active === false)
225
-			return;
224
+		if ($this->_charset === '' || $this->_active === false) {
225
+					return;
226
+		}
226 227
 		switch ($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME))
227 228
 		{
228 229
 			case 'mysql':
@@ -320,10 +321,11 @@  discard block
 block discarded – undo
320 321
 	 */
321 322
 	public function createCommand($sql)
322 323
 	{
323
-		if($this->getActive())
324
-			return new TDbCommand($this, $sql);
325
-		else
326
-			throw new TDbException('dbconnection_connection_inactive');
324
+		if($this->getActive()) {
325
+					return new TDbCommand($this, $sql);
326
+		} else {
327
+					throw new TDbException('dbconnection_connection_inactive');
328
+		}
327 329
 	}
328 330
 
329 331
 	/**
@@ -333,8 +335,9 @@  discard block
 block discarded – undo
333 335
 	{
334 336
 		if($this->_transaction !== null)
335 337
 		{
336
-			if($this->_transaction->getActive())
337
-				return $this->_transaction;
338
+			if($this->_transaction->getActive()) {
339
+							return $this->_transaction;
340
+			}
338 341
 		}
339 342
 		return null;
340 343
 	}
@@ -350,9 +353,9 @@  discard block
 block discarded – undo
350 353
 		{
351 354
 			$this->_pdo->beginTransaction();
352 355
 			return $this->_transaction = Prado::createComponent($this->getTransactionClass(), $this);
356
+		} else {
357
+					throw new TDbException('dbconnection_connection_inactive');
353 358
 		}
354
-		else
355
-			throw new TDbException('dbconnection_connection_inactive');
356 359
 	}
357 360
 
358 361
 	/**
@@ -382,10 +385,11 @@  discard block
 block discarded – undo
382 385
 	 */
383 386
 	public function getLastInsertID($sequenceName = '')
384 387
 	{
385
-		if($this->getActive())
386
-			return $this->_pdo->lastInsertId($sequenceName);
387
-		else
388
-			throw new TDbException('dbconnection_connection_inactive');
388
+		if($this->getActive()) {
389
+					return $this->_pdo->lastInsertId($sequenceName);
390
+		} else {
391
+					throw new TDbException('dbconnection_connection_inactive');
392
+		}
389 393
 	}
390 394
 
391 395
 	/**
@@ -396,10 +400,11 @@  discard block
 block discarded – undo
396 400
 	 */
397 401
 	public function quoteString($str)
398 402
 	{
399
-		if($this->getActive())
400
-			return $this->_pdo->quote($str);
401
-		else
402
-			throw new TDbException('dbconnection_connection_inactive');
403
+		if($this->getActive()) {
404
+					return $this->_pdo->quote($str);
405
+		} else {
406
+					throw new TDbException('dbconnection_connection_inactive');
407
+		}
403 408
 	}
404 409
 
405 410
 	/**
@@ -617,10 +622,11 @@  discard block
 block discarded – undo
617 622
 	 */
618 623
 	public function getAttribute($name)
619 624
 	{
620
-		if($this->getActive())
621
-			return $this->_pdo->getAttribute($name);
622
-		else
623
-			throw new TDbException('dbconnection_connection_inactive');
625
+		if($this->getActive()) {
626
+					return $this->_pdo->getAttribute($name);
627
+		} else {
628
+					throw new TDbException('dbconnection_connection_inactive');
629
+		}
624 630
 	}
625 631
 
626 632
 	/**
@@ -631,9 +637,10 @@  discard block
 block discarded – undo
631 637
 	 */
632 638
 	public function setAttribute($name, $value)
633 639
 	{
634
-		if($this->_pdo instanceof PDO)
635
-			$this->_pdo->setAttribute($name, $value);
636
-		else
637
-			$this->_attributes[$name] = $value;
640
+		if($this->_pdo instanceof PDO) {
641
+					$this->_pdo->setAttribute($name, $value);
642
+		} else {
643
+					$this->_attributes[$name] = $value;
644
+		}
638 645
 	}
639 646
 }
640 647
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/TDbTransaction.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function commit()
66 66
 	{
67
-		if($this->_active && $this->_connection->getActive())
67
+		if ($this->_active && $this->_connection->getActive())
68 68
 		{
69 69
 			$this->_connection->getPdoInstance()->commit();
70 70
 			$this->_active = false;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function rollback()
81 81
 	{
82
-		if($this->_active && $this->_connection->getActive())
82
+		if ($this->_active && $this->_connection->getActive())
83 83
 		{
84 84
 			$this->_connection->getPdoInstance()->rollBack();
85 85
 			$this->_active = false;
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 		{
69 69
 			$this->_connection->getPdoInstance()->commit();
70 70
 			$this->_active = false;
71
+		} else {
72
+					throw new TDbException('dbtransaction_transaction_inactive');
71 73
 		}
72
-		else
73
-			throw new TDbException('dbtransaction_transaction_inactive');
74 74
 	}
75 75
 
76 76
 	/**
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 		{
84 84
 			$this->_connection->getPdoInstance()->rollBack();
85 85
 			$this->_active = false;
86
+		} else {
87
+					throw new TDbException('dbtransaction_transaction_inactive');
86 88
 		}
87
-		else
88
-			throw new TDbException('dbtransaction_transaction_inactive');
89 89
 	}
90 90
 
91 91
 	/**
Please login to merge, or discard this patch.
framework/Data/TDbCommand.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function prepare()
114 114
 	{
115
-		if($this->_statement == null)
115
+		if ($this->_statement == null)
116 116
 		{
117 117
 			try
118 118
 			{
119 119
 				$this->_statement = $this->getConnection()->getPdoInstance()->prepare($this->getText());
120 120
 			}
121
-			catch(Exception $e)
121
+			catch (Exception $e)
122 122
 			{
123 123
 				throw new TDbException('dbcommand_prepare_failed', $e->getMessage(), $this->getText());
124 124
 			}
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 	public function bindParameter($name, &$value, $dataType = null, $length = null)
150 150
 	{
151 151
 		$this->prepare();
152
-		if($dataType === null)
152
+		if ($dataType === null)
153 153
 			$this->_statement->bindParam($name, $value);
154
-		elseif($length === null)
154
+		elseif ($length === null)
155 155
 			$this->_statement->bindParam($name, $value, $dataType);
156 156
 		else
157 157
 			$this->_statement->bindParam($name, $value, $dataType, $length);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	public function bindValue($name, $value, $dataType = null)
171 171
 	{
172 172
 		$this->prepare();
173
-		if($dataType === null)
173
+		if ($dataType === null)
174 174
 			$this->_statement->bindValue($name, $value);
175 175
 		else
176 176
 			$this->_statement->bindValue($name, $value, $dataType);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		{
190 190
 			// Do not trace because it will remain even in Performance mode
191 191
 			// Prado::trace('Execute Command: '.$this->getDebugStatementText(), 'Prado\Data');
192
-			if($this->_statement instanceof PDOStatement)
192
+			if ($this->_statement instanceof PDOStatement)
193 193
 			{
194 194
 				$this->_statement->execute();
195 195
 				return $this->_statement->rowCount();
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			else
198 198
 				return $this->getConnection()->getPdoInstance()->exec($this->getText());
199 199
 		}
200
-		catch(Exception $e)
200
+		catch (Exception $e)
201 201
 		{
202 202
 			throw new TDbException('dbcommand_execute_failed', $e->getMessage(), $this->getDebugStatementText());
203 203
 		}
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 		try
226 226
 		{
227 227
 			// Prado::trace('Query: '.$this->getDebugStatementText(), 'Prado\Data');
228
-			if($this->_statement instanceof PDOStatement)
228
+			if ($this->_statement instanceof PDOStatement)
229 229
 				$this->_statement->execute();
230 230
 			else
231 231
 				$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
232 232
 			return new TDbDataReader($this);
233 233
 		}
234
-		catch(Exception $e)
234
+		catch (Exception $e)
235 235
 		{
236 236
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
237 237
 		}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		try
251 251
 		{
252 252
 			// Prado::trace('Query Row: '.$this->getDebugStatementText(), 'Prado\Data');
253
-			if($this->_statement instanceof PDOStatement)
253
+			if ($this->_statement instanceof PDOStatement)
254 254
 				$this->_statement->execute();
255 255
 			else
256 256
 				$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			$this->_statement->closeCursor();
259 259
 			return $result;
260 260
 		}
261
-		catch(Exception $e)
261
+		catch (Exception $e)
262 262
 		{
263 263
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
264 264
 		}
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
 		try
277 277
 		{
278 278
 			// Prado::trace('Query Scalar: '.$this->getDebugStatementText(), 'Prado\Data');
279
-			if($this->_statement instanceof PDOStatement)
279
+			if ($this->_statement instanceof PDOStatement)
280 280
 				$this->_statement->execute();
281 281
 			else
282 282
 				$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
283 283
 			$result = $this->_statement->fetchColumn();
284 284
 			$this->_statement->closeCursor();
285
-			if(is_resource($result) && get_resource_type($result) === 'stream')
285
+			if (is_resource($result) && get_resource_type($result) === 'stream')
286 286
 				return stream_get_contents($result);
287 287
 			else
288 288
 				return $result;
289 289
 		}
290
-		catch(Exception $e)
290
+		catch (Exception $e)
291 291
 		{
292 292
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
293 293
 		}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	{
306 306
 		$rows = $this->query()->readAll();
307 307
 		$column = [];
308
-		foreach($rows as $row)
308
+		foreach ($rows as $row)
309 309
 			$column[] = current($row);
310 310
 		return $column;
311 311
 	}
Please login to merge, or discard this patch.
Braces   +42 added lines, -40 removed lines patch added patch discarded remove patch
@@ -117,8 +117,7 @@  discard block
 block discarded – undo
117 117
 			try
118 118
 			{
119 119
 				$this->_statement = $this->getConnection()->getPdoInstance()->prepare($this->getText());
120
-			}
121
-			catch(Exception $e)
120
+			} catch(Exception $e)
122 121
 			{
123 122
 				throw new TDbException('dbcommand_prepare_failed', $e->getMessage(), $this->getText());
124 123
 			}
@@ -149,12 +148,13 @@  discard block
 block discarded – undo
149 148
 	public function bindParameter($name, &$value, $dataType = null, $length = null)
150 149
 	{
151 150
 		$this->prepare();
152
-		if($dataType === null)
153
-			$this->_statement->bindParam($name, $value);
154
-		elseif($length === null)
155
-			$this->_statement->bindParam($name, $value, $dataType);
156
-		else
157
-			$this->_statement->bindParam($name, $value, $dataType, $length);
151
+		if($dataType === null) {
152
+					$this->_statement->bindParam($name, $value);
153
+		} elseif($length === null) {
154
+					$this->_statement->bindParam($name, $value, $dataType);
155
+		} else {
156
+					$this->_statement->bindParam($name, $value, $dataType, $length);
157
+		}
158 158
 	}
159 159
 
160 160
 	/**
@@ -170,10 +170,11 @@  discard block
 block discarded – undo
170 170
 	public function bindValue($name, $value, $dataType = null)
171 171
 	{
172 172
 		$this->prepare();
173
-		if($dataType === null)
174
-			$this->_statement->bindValue($name, $value);
175
-		else
176
-			$this->_statement->bindValue($name, $value, $dataType);
173
+		if($dataType === null) {
174
+					$this->_statement->bindValue($name, $value);
175
+		} else {
176
+					$this->_statement->bindValue($name, $value, $dataType);
177
+		}
177 178
 	}
178 179
 
179 180
 	/**
@@ -193,11 +194,10 @@  discard block
 block discarded – undo
193 194
 			{
194 195
 				$this->_statement->execute();
195 196
 				return $this->_statement->rowCount();
197
+			} else {
198
+							return $this->getConnection()->getPdoInstance()->exec($this->getText());
196 199
 			}
197
-			else
198
-				return $this->getConnection()->getPdoInstance()->exec($this->getText());
199
-		}
200
-		catch(Exception $e)
200
+		} catch(Exception $e)
201 201
 		{
202 202
 			throw new TDbException('dbcommand_execute_failed', $e->getMessage(), $this->getDebugStatementText());
203 203
 		}
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 		try
226 226
 		{
227 227
 			// Prado::trace('Query: '.$this->getDebugStatementText(), 'Prado\Data');
228
-			if($this->_statement instanceof PDOStatement)
229
-				$this->_statement->execute();
230
-			else
231
-				$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
228
+			if($this->_statement instanceof PDOStatement) {
229
+							$this->_statement->execute();
230
+			} else {
231
+							$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
232
+			}
232 233
 			return new TDbDataReader($this);
233
-		}
234
-		catch(Exception $e)
234
+		} catch(Exception $e)
235 235
 		{
236 236
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
237 237
 		}
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
 		try
251 251
 		{
252 252
 			// Prado::trace('Query Row: '.$this->getDebugStatementText(), 'Prado\Data');
253
-			if($this->_statement instanceof PDOStatement)
254
-				$this->_statement->execute();
255
-			else
256
-				$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
253
+			if($this->_statement instanceof PDOStatement) {
254
+							$this->_statement->execute();
255
+			} else {
256
+							$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
257
+			}
257 258
 			$result = $this->_statement->fetch($fetchAssociative ? PDO::FETCH_ASSOC : PDO::FETCH_NUM);
258 259
 			$this->_statement->closeCursor();
259 260
 			return $result;
260
-		}
261
-		catch(Exception $e)
261
+		} catch(Exception $e)
262 262
 		{
263 263
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
264 264
 		}
@@ -276,18 +276,19 @@  discard block
 block discarded – undo
276 276
 		try
277 277
 		{
278 278
 			// Prado::trace('Query Scalar: '.$this->getDebugStatementText(), 'Prado\Data');
279
-			if($this->_statement instanceof PDOStatement)
280
-				$this->_statement->execute();
281
-			else
282
-				$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
279
+			if($this->_statement instanceof PDOStatement) {
280
+							$this->_statement->execute();
281
+			} else {
282
+							$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
283
+			}
283 284
 			$result = $this->_statement->fetchColumn();
284 285
 			$this->_statement->closeCursor();
285
-			if(is_resource($result) && get_resource_type($result) === 'stream')
286
-				return stream_get_contents($result);
287
-			else
288
-				return $result;
289
-		}
290
-		catch(Exception $e)
286
+			if(is_resource($result) && get_resource_type($result) === 'stream') {
287
+							return stream_get_contents($result);
288
+			} else {
289
+							return $result;
290
+			}
291
+		} catch(Exception $e)
291 292
 		{
292 293
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
293 294
 		}
@@ -305,8 +306,9 @@  discard block
 block discarded – undo
305 306
 	{
306 307
 		$rows = $this->query()->readAll();
307 308
 		$column = [];
308
-		foreach($rows as $row)
309
-			$column[] = current($row);
309
+		foreach($rows as $row) {
310
+					$column[] = current($row);
311
+		}
310 312
 		return $column;
311 313
 	}
312 314
 }
Please login to merge, or discard this patch.
framework/Data/DataGateway/TSqlCriteria.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function __construct($condition = null, $parameters = [])
55 55
 	{
56
-		if(!is_array($parameters) && func_num_args() > 1)
56
+		if (!is_array($parameters) && func_num_args() > 1)
57 57
 			$parameters = array_slice(func_get_args(), 1);
58 58
 		$this->_parameters = new TAttributeCollection;
59 59
 		$this->_parameters->setCaseSensitive(true);
60
-		$this->_parameters->copyFrom((array)$parameters);
60
+		$this->_parameters->copyFrom((array) $parameters);
61 61
 		$this->_ordersBy = new TAttributeCollection;
62 62
 		$this->_ordersBy->setCaseSensitive(true);
63 63
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function setCondition($value)
134 134
 	{
135
-		if(empty($value)) {
135
+		if (empty($value)) {
136 136
 			// reset the condition
137 137
 			$this->_condition = null;
138 138
 			return;
@@ -144,32 +144,32 @@  discard block
 block discarded – undo
144 144
 		//    [LIMIT {[offset,] row_count | row_count OFFSET offset}]
145 145
 		// See: http://dev.mysql.com/doc/refman/5.0/en/select.html
146 146
 
147
-		if(preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) {
147
+		if (preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) {
148 148
 			// condition contains ORDER BY
149 149
 			$value = str_replace($matches[0], '', $value);
150
-			if(strlen($matches[1]) > 0) {
150
+			if (strlen($matches[1]) > 0) {
151 151
 				$this->setOrdersBy($matches[1]);
152
-			} elseif(strlen($matches[2]) > 0) {
152
+			} elseif (strlen($matches[2]) > 0) {
153 153
 				$this->setOrdersBy($matches[2]);
154 154
 			}
155 155
 		}
156 156
 
157
-		if(preg_match('/LIMIT\s+([\d\s,]+)/i', $value, $matches) > 0) {
157
+		if (preg_match('/LIMIT\s+([\d\s,]+)/i', $value, $matches) > 0) {
158 158
 			// condition contains limit
159 159
 			$value = str_replace($matches[0], '', $value); // remove limit from query
160
-			if(strpos($matches[1], ',')) { // both offset and limit given
160
+			if (strpos($matches[1], ',')) { // both offset and limit given
161 161
 				list($offset, $limit) = explode(',', $matches[1]);
162
-				$this->_limit = (int)$limit;
163
-				$this->_offset = (int)$offset;
162
+				$this->_limit = (int) $limit;
163
+				$this->_offset = (int) $offset;
164 164
 			} else { // only limit given
165
-				$this->_limit = (int)$matches[1];
165
+				$this->_limit = (int) $matches[1];
166 166
 			}
167 167
 		}
168 168
 
169
-		if(preg_match('/OFFSET\s+(\d+)/i', $value, $matches) > 0) {
169
+		if (preg_match('/OFFSET\s+(\d+)/i', $value, $matches) > 0) {
170 170
 			// condition contains offset
171 171
 			$value = str_replace($matches[0], '', $value); // remove offset from query
172
-			$this->_offset = (int)$matches[1]; // set offset in criteria
172
+			$this->_offset = (int) $matches[1]; // set offset in criteria
173 173
 		}
174 174
 
175 175
 		$this->_condition = trim($value);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function setParameters($value)
190 190
 	{
191
-		if(!(is_array($value) || $value instanceof \ArrayAccess))
191
+		if (!(is_array($value) || $value instanceof \ArrayAccess))
192 192
 			throw new TException('value must be array or \ArrayAccess');
193 193
 		$this->_parameters->copyFrom($value);
194 194
 	}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function getIsNamedParameters()
200 200
 	{
201
-		foreach($this->getParameters() as $k => $v)
201
+		foreach ($this->getParameters() as $k => $v)
202 202
 			return is_string($k);
203 203
 	}
204 204
 
@@ -215,16 +215,16 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function setOrdersBy($value)
217 217
 	{
218
-		if(is_array($value) || $value instanceof Traversable)
218
+		if (is_array($value) || $value instanceof Traversable)
219 219
 			$this->_ordersBy->copyFrom($value);
220 220
 		else
221 221
 		{
222
-			$value = trim(preg_replace('/\s+/', ' ', (string)$value));
222
+			$value = trim(preg_replace('/\s+/', ' ', (string) $value));
223 223
 			$orderBys = [];
224
-			foreach(explode(',', $value) as $orderBy)
224
+			foreach (explode(',', $value) as $orderBy)
225 225
 			{
226 226
 				$vs = explode(' ', trim($orderBy));
227
-				$orderBys[$vs[0]] = isset($vs[1])?$vs[1]:'asc';
227
+				$orderBys[$vs[0]] = isset($vs[1]) ? $vs[1] : 'asc';
228 228
 			}
229 229
 			$this->_ordersBy->copyFrom($orderBys);
230 230
 		}
@@ -268,22 +268,22 @@  discard block
 block discarded – undo
268 268
 	public function __toString()
269 269
 	{
270 270
 		$str = '';
271
-		if(strlen((string)$this->getCondition()) > 0)
272
-			$str .= '"' . (string)$this->getCondition() . '"';
271
+		if (strlen((string) $this->getCondition()) > 0)
272
+			$str .= '"'.(string) $this->getCondition().'"';
273 273
 		$params = [];
274
-		foreach($this->getParameters() as $k => $v)
274
+		foreach ($this->getParameters() as $k => $v)
275 275
 			$params[] = "{$k} => ${v}";
276
-		if(count($params) > 0)
277
-			$str .= ', "' . implode(', ', $params) . '"';
276
+		if (count($params) > 0)
277
+			$str .= ', "'.implode(', ', $params).'"';
278 278
 		$orders = [];
279
-		foreach($this->getOrdersBy() as $k => $v)
279
+		foreach ($this->getOrdersBy() as $k => $v)
280 280
 			$orders[] = "{$k} => ${v}";
281
-		if(count($orders) > 0)
282
-			$str .= ', "' . implode(', ', $orders) . '"';
283
-		if($this->_limit !== null)
284
-			$str .= ', ' . $this->_limit;
285
-		if($this->_offset !== null)
286
-			$str .= ', ' . $this->_offset;
281
+		if (count($orders) > 0)
282
+			$str .= ', "'.implode(', ', $orders).'"';
283
+		if ($this->_limit !== null)
284
+			$str .= ', '.$this->_limit;
285
+		if ($this->_offset !== null)
286
+			$str .= ', '.$this->_offset;
287 287
 		return $str;
288 288
 	}
289 289
 }
Please login to merge, or discard this patch.
Braces   +33 added lines, -23 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function __construct($condition = null, $parameters = [])
55 55
 	{
56
-		if(!is_array($parameters) && func_num_args() > 1)
57
-			$parameters = array_slice(func_get_args(), 1);
56
+		if(!is_array($parameters) && func_num_args() > 1) {
57
+					$parameters = array_slice(func_get_args(), 1);
58
+		}
58 59
 		$this->_parameters = new TAttributeCollection;
59 60
 		$this->_parameters->setCaseSensitive(true);
60 61
 		$this->_parameters->copyFrom((array)$parameters);
@@ -188,8 +189,9 @@  discard block
 block discarded – undo
188 189
 	 */
189 190
 	public function setParameters($value)
190 191
 	{
191
-		if(!(is_array($value) || $value instanceof \ArrayAccess))
192
-			throw new TException('value must be array or \ArrayAccess');
192
+		if(!(is_array($value) || $value instanceof \ArrayAccess)) {
193
+					throw new TException('value must be array or \ArrayAccess');
194
+		}
193 195
 		$this->_parameters->copyFrom($value);
194 196
 	}
195 197
 
@@ -198,8 +200,9 @@  discard block
 block discarded – undo
198 200
 	 */
199 201
 	public function getIsNamedParameters()
200 202
 	{
201
-		foreach($this->getParameters() as $k => $v)
202
-			return is_string($k);
203
+		foreach($this->getParameters() as $k => $v) {
204
+					return is_string($k);
205
+		}
203 206
 	}
204 207
 
205 208
 	/**
@@ -215,9 +218,9 @@  discard block
 block discarded – undo
215 218
 	 */
216 219
 	public function setOrdersBy($value)
217 220
 	{
218
-		if(is_array($value) || $value instanceof Traversable)
219
-			$this->_ordersBy->copyFrom($value);
220
-		else
221
+		if(is_array($value) || $value instanceof Traversable) {
222
+					$this->_ordersBy->copyFrom($value);
223
+		} else
221 224
 		{
222 225
 			$value = trim(preg_replace('/\s+/', ' ', (string)$value));
223 226
 			$orderBys = [];
@@ -268,22 +271,29 @@  discard block
 block discarded – undo
268 271
 	public function __toString()
269 272
 	{
270 273
 		$str = '';
271
-		if(strlen((string)$this->getCondition()) > 0)
272
-			$str .= '"' . (string)$this->getCondition() . '"';
274
+		if(strlen((string)$this->getCondition()) > 0) {
275
+					$str .= '"' . (string)$this->getCondition() . '"';
276
+		}
273 277
 		$params = [];
274
-		foreach($this->getParameters() as $k => $v)
275
-			$params[] = "{$k} => ${v}";
276
-		if(count($params) > 0)
277
-			$str .= ', "' . implode(', ', $params) . '"';
278
+		foreach($this->getParameters() as $k => $v) {
279
+					$params[] = "{$k} => ${v}";
280
+		}
281
+		if(count($params) > 0) {
282
+					$str .= ', "' . implode(', ', $params) . '"';
283
+		}
278 284
 		$orders = [];
279
-		foreach($this->getOrdersBy() as $k => $v)
280
-			$orders[] = "{$k} => ${v}";
281
-		if(count($orders) > 0)
282
-			$str .= ', "' . implode(', ', $orders) . '"';
283
-		if($this->_limit !== null)
284
-			$str .= ', ' . $this->_limit;
285
-		if($this->_offset !== null)
286
-			$str .= ', ' . $this->_offset;
285
+		foreach($this->getOrdersBy() as $k => $v) {
286
+					$orders[] = "{$k} => ${v}";
287
+		}
288
+		if(count($orders) > 0) {
289
+					$str .= ', "' . implode(', ', $orders) . '"';
290
+		}
291
+		if($this->_limit !== null) {
292
+					$str .= ', ' . $this->_limit;
293
+		}
294
+		if($this->_offset !== null) {
295
+					$str .= ', ' . $this->_offset;
296
+		}
287 297
 		return $str;
288 298
 	}
289 299
 }
Please login to merge, or discard this patch.