Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:02
created
framework/Data/SqlMap/TSqlMapManager.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -265,8 +265,9 @@
 block discarded – undo
265 265
 	 */
266 266
 	public function flushCacheModels()
267 267
 	{
268
-		foreach($this->_cacheModels as $cache)
269
-			$cache->flush();
268
+		foreach($this->_cacheModels as $cache) {
269
+					$cache->flush();
270
+		}
270 271
 	}
271 272
 }
272 273
 
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TPreparedStatementFactory.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@
 block discarded – undo
40 40
 
41 41
 	protected function createParametersForTextCommand()
42 42
 	{
43
-		foreach($this->_statement->ParameterMap()->getProperties() as $prop)
44
-			$this->_preparedStatement->getParameterNames()->add($prop->getProperty());
43
+		foreach($this->_statement->ParameterMap()->getProperties() as $prop) {
44
+					$this->_preparedStatement->getParameterNames()->add($prop->getProperty());
45
+		}
45 46
 	}
46 47
 }
47 48
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@
 block discarded – undo
55 55
 	 */
56 56
 	public function flushContent()
57 57
 	{
58
-		foreach($this->_writers as $writer)
59
-			echo $writer->flush();
58
+		foreach($this->_writers as $writer) {
59
+					echo $writer->flush();
60
+		}
60 61
 		parent::flushContent();
61 62
 	}
62 63
 
Please login to merge, or discard this patch.
framework/Caching/TDbCache.php 2 patches
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -205,8 +205,7 @@  discard block
 block discarded – undo
205 205
 				$this -> _createCheck = true;
206 206
 				$this -> getApplication() -> setGlobalState($key, time());
207 207
 			}
208
-		}
209
-		catch(\Exception $e)
208
+		} catch(\Exception $e)
210 209
 		{
211 210
 			// DB table not exists
212 211
 			if($this->_autoCreate)
@@ -229,8 +228,7 @@  discard block
 block discarded – undo
229 228
 
230 229
 				$this -> _createCheck = true;
231 230
 				$this -> getApplication() -> setGlobalState($key, time());
232
-			}
233
-			else
231
+			} else
234 232
 				throw new TConfigurationException('db_cachetable_inexistent', $this->_cacheTable);
235 233
 		}
236 234
 		$this->_cacheInitialized = true;
@@ -299,8 +297,7 @@  discard block
 block discarded – undo
299 297
 				return $config->getDbConnection();
300 298
 			else
301 299
 				throw new TConfigurationException('dbcache_connectionid_invalid', $this->_connID);
302
-		}
303
-		else
300
+		} else
304 301
 		{
305 302
 			$db = new TDbConnection;
306 303
 			if($this->_connectionString !== '')
@@ -310,8 +307,7 @@  discard block
 block discarded – undo
310 307
 					$db->setUsername($this->_username);
311 308
 				if($this->_password !== '')
312 309
 					$db->setPassword($this->_password);
313
-			}
314
-			else
310
+			} else
315 311
 			{
316 312
 				// default to SQLite3 database
317 313
 				$dbFile = $this->getApplication()->getRuntimePath() . '/sqlite3.cache';
@@ -468,8 +464,7 @@  discard block
 block discarded – undo
468 464
 			$sql = 'SELECT value FROM ' . $this->_cacheTable . ' WHERE itemkey=\'' . $key . '\' AND (expire=0 OR expire>' . time() . ') ORDER BY expire DESC';
469 465
 			$command = $this->getDbConnection()->createCommand($sql);
470 466
 			return unserialize($command->queryScalar());
471
-		}
472
-		catch(\Exception $e)
467
+		} catch(\Exception $e)
473 468
 		{
474 469
 			$this->initializeCache(true);
475 470
 			return unserialize($command->queryScalar());
@@ -512,16 +507,14 @@  discard block
 block discarded – undo
512 507
 			$command->bindValue(':value', serialize($value), \PDO::PARAM_LOB);
513 508
 			$command->execute();
514 509
 			return true;
515
-		}
516
-		catch(\Exception $e)
510
+		} catch(\Exception $e)
517 511
 		{
518 512
 			try
519 513
 			{
520 514
 				$this->initializeCache(true);
521 515
 				$command->execute();
522 516
 				return true;
523
-			}
524
-			catch(\Exception $e)
517
+			} catch(\Exception $e)
525 518
 			{
526 519
 				return false;
527 520
 			}
@@ -543,8 +536,7 @@  discard block
 block discarded – undo
543 536
 			$command->bindValue(':key', $key, \PDO::PARAM_STR);
544 537
 			$command->execute();
545 538
 			return true;
546
-		}
547
-		catch(\Exception $e)
539
+		} catch(\Exception $e)
548 540
 		{
549 541
 			$this->initializeCache(true);
550 542
 			$command->execute();
@@ -563,16 +555,14 @@  discard block
 block discarded – undo
563 555
 		{
564 556
 			$command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}");
565 557
 			$command->execute();
566
-		}
567
-		catch(\Exception $e)
558
+		} catch(\Exception $e)
568 559
 		{
569 560
 			try
570 561
 			{
571 562
 				$this->initializeCache(true);
572 563
 				$command->execute();
573 564
 				return true;
574
-			}
575
-			catch(\Exception $e)
565
+			} catch(\Exception $e)
576 566
 			{
577 567
 				return false;
578 568
 			}
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 				$this -> getApplication() -> setGlobalState($key, time());
207 207
 			}
208 208
 		}
209
-		catch(\Exception $e)
209
+		catch (\Exception $e)
210 210
 		{
211 211
 			// DB table not exists
212 212
 			if($this->_autoCreate)
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 		$key = 'TDbCache:' . $this->_cacheTable . ':flushed';
251 251
 		$now = time();
252
-		$next = $interval + (integer)$this -> getApplication() -> getGlobalState($key, 0);
252
+		$next = $interval + (integer) $this -> getApplication() -> getGlobalState($key, 0);
253 253
 
254 254
 		if($force || $next <= $now)
255 255
 		{
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 			$command = $this->getDbConnection()->createCommand($sql);
470 470
 			return unserialize($command->queryScalar());
471 471
 		}
472
-		catch(\Exception $e)
472
+		catch (\Exception $e)
473 473
 		{
474 474
 			$this->initializeCache(true);
475 475
 			return unserialize($command->queryScalar());
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	protected function addValue($key, $value, $expire)
504 504
 	{
505 505
 		if(!$this->_cacheInitialized) $this->initializeCache();
506
-		$expire = ($expire <= 0)?0:time() + $expire;
506
+		$expire = ($expire <= 0) ? 0 : time() + $expire;
507 507
 		$sql = "INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)";
508 508
 		try
509 509
 		{
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			$command->execute();
514 514
 			return true;
515 515
 		}
516
-		catch(\Exception $e)
516
+		catch (\Exception $e)
517 517
 		{
518 518
 			try
519 519
 			{
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 				$command->execute();
522 522
 				return true;
523 523
 			}
524
-			catch(\Exception $e)
524
+			catch (\Exception $e)
525 525
 			{
526 526
 				return false;
527 527
 			}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 			$command->execute();
545 545
 			return true;
546 546
 		}
547
-		catch(\Exception $e)
547
+		catch (\Exception $e)
548 548
 		{
549 549
 			$this->initializeCache(true);
550 550
 			$command->execute();
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 			$command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}");
565 565
 			$command->execute();
566 566
 		}
567
-		catch(\Exception $e)
567
+		catch (\Exception $e)
568 568
 		{
569 569
 			try
570 570
 			{
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 				$command->execute();
573 573
 				return true;
574 574
 			}
575
-			catch(\Exception $e)
575
+			catch (\Exception $e)
576 576
 			{
577 577
 				return false;
578 578
 			}
Please login to merge, or discard this patch.
framework/Caching/TMemCache.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,8 +168,7 @@
 block discarded – undo
168 168
 					$server['Weight'], $server['Timeout'], $server['RetryInterval']) === false)
169 169
 					throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']);
170 170
 			}
171
-		}
172
-		else
171
+		} else
173 172
 		{
174 173
 			Prado::trace('Adding server ' . $this->_host, '\Prado\Caching\TMemCache');
175 174
 			if($this->_cache->addServer($this->_host, $this->_port) === false)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			foreach($this->_servers as $server)
165 165
 			{
166 166
 				Prado::trace('Adding server ' . $server['Host'] . ' from serverlist', '\Prado\Caching\TMemCache');
167
-				if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'],
167
+				if($this->_cache->addServer($server['Host'], $server['Port'], $server['Persistent'],
168 168
 					$server['Weight'], $server['Timeout'], $server['RetryInterval']) === false)
169 169
 					throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']);
170 170
 			}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 					throw new TConfigurationException('memcache_serverport_required');
200 200
 				if(!is_numeric($port))
201 201
 					throw new TConfigurationException('memcache_serverport_invalid');
202
-				$server = ['Host' => $host,'Port' => $port,'Weight' => 1,'Timeout' => 1800,'RetryInterval' => 15,'Persistent' => true];
202
+				$server = ['Host' => $host, 'Port' => $port, 'Weight' => 1, 'Timeout' => 1800, 'RetryInterval' => 15, 'Persistent' => true];
203 203
 				$checks = [
204 204
 					'Weight' => 'memcache_serverweight_invalid',
205 205
 					'Timeout' => 'memcache_servertimeout_invalid',
Please login to merge, or discard this patch.
framework/Caching/TDirectoryCacheDependency.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,8 +166,7 @@
 block discarded – undo
166 166
 			{
167 167
 				if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path))
168 168
 					$timestamps = array_merge($this->generateTimestamps($path, $level + 1));
169
-			}
170
-			elseif($this->validateFile($path))
169
+			} elseif($this->validateFile($path))
171 170
 				$timestamps[$path] = filemtime($path);
172 171
 		}
173 172
 		closedir($dir);
Please login to merge, or discard this patch.
framework/Exceptions/TErrorHandler.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -235,8 +235,7 @@  discard block
 block discarded – undo
235 235
 			echo "<body><h1>Recursive Error</h1>\n";
236 236
 			echo "<pre>" . $exception->__toString() . "</pre>\n";
237 237
 			echo "</body></html>";
238
-		}
239
-		else
238
+		} else
240 239
 		{
241 240
 			error_log("Error happened while processing an existing error:\n" . $exception->__toString());
242 241
 			header('HTTP/1.0 500 Internal Error');
@@ -267,15 +266,13 @@  discard block
 block discarded – undo
267 266
 			if($fileName === '')
268 267
 				$fileName = '---embedded template---';
269 268
 			$errorLine = $exception->getLineNumber();
270
-		}
271
-		else
269
+		} else
272 270
 		{
273 271
 			if(($trace = $this->getExactTrace($exception)) !== null)
274 272
 			{
275 273
 				$fileName = $trace['file'];
276 274
 				$errorLine = $trace['line'];
277
-			}
278
-			else
275
+			} else
279 276
 			{
280 277
 				$fileName = $exception->getFile();
281 278
 				$errorLine = $exception->getLine();
@@ -435,8 +432,7 @@  discard block
 block discarded – undo
435 432
 			{
436 433
 				$line = htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
437 434
 				$source .= "<div class=\"error\">" . $line . "</div>";
438
-			}
439
-			else
435
+			} else
440 436
 				$source .= htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
441 437
 		}
442 438
 		return $source;
@@ -456,8 +452,7 @@  discard block
 block discarded – undo
456 452
 			$class = $matches[0];
457 453
 			try {
458 454
 				$function = new \ReflectionClass($class);
459
-			}
460
-			catch (\Exception $e) {
455
+			} catch (\Exception $e) {
461 456
 				return null;
462 457
 			}
463 458
 			$classname = $function->getNamespaceName();
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 		$content = $this->getErrorTemplate($statusCode, $exception);
197 197
 
198
-		$serverAdmin = isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:'';
198
+		$serverAdmin = isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : '';
199 199
 
200 200
 		$isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug;
201 201
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		if($exception instanceof TTemplateException)
263 263
 		{
264 264
 			$fileName = $exception->getTemplateFile();
265
-			$lines = empty($fileName)?explode("\n", $exception->getTemplateSource()):@file($fileName);
265
+			$lines = empty($fileName) ?explode("\n", $exception->getTemplateSource()) : @file($fileName);
266 266
 			$source = $this->getSourceCode($lines, $exception->getLineNumber());
267 267
 			if($fileName === '')
268 268
 				$fileName = '---embedded template---';
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
 
426 426
 	private function getSourceCode($lines, $errorLine)
427 427
 	{
428
-		$beginLine = $errorLine - self::SOURCE_LINES >= 0?$errorLine - self::SOURCE_LINES:0;
429
-		$endLine = $errorLine + self::SOURCE_LINES <= count($lines)?$errorLine + self::SOURCE_LINES:count($lines);
428
+		$beginLine = $errorLine - self::SOURCE_LINES >= 0 ? $errorLine - self::SOURCE_LINES : 0;
429
+		$endLine = $errorLine + self::SOURCE_LINES <= count($lines) ? $errorLine + self::SOURCE_LINES : count($lines);
430 430
 
431 431
 		$source = '';
432
-		for($i = $beginLine;$i < $endLine;++$i)
432
+		for($i = $beginLine; $i < $endLine; ++$i)
433 433
 		{
434 434
 			if($i === $errorLine - 1)
435 435
 			{
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	}
444 444
 
445 445
 	private function addLink($message) {
446
-		if (null !== ($class = $this->getErrorClassNameSpace($message))) {
446
+		if(null !== ($class = $this->getErrorClassNameSpace($message))) {
447 447
 			return str_replace($class['name'], '<a href="' . $class['url'] . '" target="_blank">' . $class['name'] . '</a>', $message);
448 448
 		}
449 449
 		return $message;
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	private function getErrorClassNameSpace($message) {
453 453
 		$matches = [];
454 454
 		preg_match('/\b(T[A-Z]\w+)\b/', $message, $matches);
455
-		if (is_array($matches) && count($matches) > 0) {
455
+		if(is_array($matches) && count($matches) > 0) {
456 456
 			$class = $matches[0];
457 457
 			try {
458 458
 				$function = new \ReflectionClass($class);
Please login to merge, or discard this patch.
framework/TApplicationConfiguration.php 2 patches
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@  discard block
 block discarded – undo
70 70
 		{
71 71
 			$fcontent = include $fname;
72 72
 			$this->loadFromPhp($fcontent, dirname($fname));
73
-		}
74
-		else
73
+		} else
75 74
 		{
76 75
 			$dom = new TXmlDocument;
77 76
 			$dom->loadFromFile($fname);
@@ -218,8 +217,7 @@  discard block
 block discarded – undo
218 217
 						if(isset($this->_aliases[$id]))
219 218
 							throw new TConfigurationException('appconfig_alias_redefined', $id);
220 219
 						$this->_aliases[$id] = $p;
221
-					}
222
-					else
220
+					} else
223 221
 						throw new TConfigurationException('appconfig_alias_invalid');
224 222
 					$this->_empty = false;
225 223
 					break;
@@ -286,8 +284,7 @@  discard block
 block discarded – undo
286 284
 				else
287 285
 					$this->_modules[$id] = [$type,$properties->toArray(),$element];
288 286
 				$this->_empty = false;
289
-			}
290
-			else
287
+			} else
291 288
 				throw new TConfigurationException('appconfig_modules_invalid', $element->getTagName());
292 289
 		}
293 290
 	}
@@ -331,8 +328,7 @@  discard block
 block discarded – undo
331 328
 				$element->setParent(null);
332 329
 				$this->_services[$id] = [$type,$properties->toArray(),$element];
333 330
 				$this->_empty = false;
334
-			}
335
-			else
331
+			} else
336 332
 				throw new TConfigurationException('appconfig_services_invalid', $element->getTagName());
337 333
 		}
338 334
 	}
@@ -356,8 +352,7 @@  discard block
 block discarded – undo
356 352
 					$properties['id'] = $id;
357 353
 					$this->_parameters[$id] = [$type,$properties];
358 354
 				}
359
-			}
360
-			else
355
+			} else
361 356
 			{
362 357
 				$this->_parameters[$id] = $parameter;
363 358
 			}
@@ -384,12 +379,10 @@  discard block
 block discarded – undo
384 379
 						$this->_parameters[$id] = $element;
385 380
 					else
386 381
 						$this->_parameters[$id] = $value;
387
-				}
388
-				else
382
+				} else
389 383
 					$this->_parameters[$id] = [$type,$properties->toArray()];
390 384
 				$this->_empty = false;
391
-			}
392
-			else
385
+			} else
393 386
 				throw new TConfigurationException('appconfig_parameters_invalid', $element->getTagName());
394 387
 		}
395 388
 	}
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 				unset($module['properties']);
260 260
 			}
261 261
 			$properties['id'] = $id;
262
-			$this->_modules[$id] = [$type,$properties,$module];
262
+			$this->_modules[$id] = [$type, $properties, $module];
263 263
 			$this->_empty = false;
264 264
 		}
265 265
 	}
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 					throw new TConfigurationException('appconfig_moduletype_required', $id);
283 283
 				$element->setParent(null);
284 284
 				if($id === null)
285
-					$this->_modules[] = [$type,$properties->toArray(),$element];
285
+					$this->_modules[] = [$type, $properties->toArray(), $element];
286 286
 				else
287
-					$this->_modules[$id] = [$type,$properties->toArray(),$element];
287
+					$this->_modules[$id] = [$type, $properties->toArray(), $element];
288 288
 				$this->_empty = false;
289 289
 			}
290 290
 			else
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			$properties = isset($service['properties']) ? $service['properties'] : [];
308 308
 			unset($service['properties']);
309 309
 			$properties['id'] = $id;
310
-			$this->_services[$id] = [$type,$properties,$service];
310
+			$this->_services[$id] = [$type, $properties, $service];
311 311
 			$this->_empty = false;
312 312
 		}
313 313
 	}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 				if(($type = $properties->remove('class')) === null)
330 330
 					throw new TConfigurationException('appconfig_servicetype_required', $id);
331 331
 				$element->setParent(null);
332
-				$this->_services[$id] = [$type,$properties->toArray(),$element];
332
+				$this->_services[$id] = [$type, $properties->toArray(), $element];
333 333
 				$this->_empty = false;
334 334
 			}
335 335
 			else
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 					unset($parameter['class']);
355 355
 					$properties = isset($service['properties']) ? $service['properties'] : [];
356 356
 					$properties['id'] = $id;
357
-					$this->_parameters[$id] = [$type,$properties];
357
+					$this->_parameters[$id] = [$type, $properties];
358 358
 				}
359 359
 			}
360 360
 			else
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 						$this->_parameters[$id] = $value;
387 387
 				}
388 388
 				else
389
-					$this->_parameters[$id] = [$type,$properties->toArray()];
389
+					$this->_parameters[$id] = [$type, $properties->toArray()];
390 390
 				$this->_empty = false;
391 391
 			}
392 392
 			else
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	{
404 404
 		foreach($includeNode as $include)
405 405
 		{
406
-			$when = isset($include['when'])?true:false;
406
+			$when = isset($include['when']) ?true:false;
407 407
 			if(!isset($include['file']))
408 408
 				throw new TConfigurationException('appconfig_includefile_required');
409 409
 			$filePath = $include['file'];
Please login to merge, or discard this patch.
framework/Security/TAuthorizationRuleCollection.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@
 block discarded – undo
41 41
 					return ($decision > 0);
42 42
 			}
43 43
 			return true;
44
-		}
45
-		else
44
+		} else
46 45
 			return false;
47 46
 	}
48 47
 
Please login to merge, or discard this patch.