Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:02
created
framework/Data/TDbDataReader.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,8 +180,7 @@
 block discarded – undo
180 180
 		{
181 181
 			$this->_row = $this->_statement->fetch();
182 182
 			$this->_index = 0;
183
-		}
184
-		else
183
+		} else
185 184
 			throw new TDbException('dbdatareader_rewind_invalid');
186 185
 	}
187 186
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 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
 	/**
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -135,28 +135,24 @@
 block discarded – undo
135 135
 			{
136 136
 				$param->setData($data);
137 137
 				$this->_nextPageList = null;
138
-			}
139
-			else
138
+			} else
140 139
 			{
141 140
 				$param->setData(array_slice($data, 0, $pageSize));
142 141
 				$this->_nextPageList = array_slice($data, $pageSize - 1, $total);
143 142
 			}
144
-		}
145
-		else
143
+		} else
146 144
 		{
147 145
 			if($total <= $pageSize)
148 146
 			{
149 147
 				$this->_prevPageList = array_slice($data, 0, $total);
150 148
 				$param->setData([]);
151 149
 				$this->_nextPageList = null;
152
-			}
153
-			elseif($total <= $pageSize * 2)
150
+			} elseif($total <= $pageSize * 2)
154 151
 			{
155 152
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
156 153
 				$param->setData(array_slice($data, $pageSize, $total));
157 154
 				$this->_nextPageList = null;
158
-			}
159
-			else
155
+			} else
160 156
 			{
161 157
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
162 158
 				$param->setData(array_slice($data, $pageSize, $pageSize));
Please login to merge, or discard this patch.
framework/Data/TDbConnection.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -196,8 +196,7 @@  discard block
 block discarded – undo
196 196
 				$this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
197 197
 				$this->_active = true;
198 198
 				$this->setConnectionCharset();
199
-			}
200
-			catch(PDOException $e)
199
+			} catch(PDOException $e)
201 200
 			{
202 201
 				throw new TDbException('dbconnection_open_failed', $e->getMessage());
203 202
 			}
@@ -350,8 +349,7 @@  discard block
 block discarded – undo
350 349
 		{
351 350
 			$this->_pdo->beginTransaction();
352 351
 			return $this->_transaction = Prado::createComponent($this->getTransactionClass(), $this);
353
-		}
354
-		else
352
+		} else
355 353
 			throw new TDbException('dbconnection_connection_inactive');
356 354
 	}
357 355
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 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
 	/**
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
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
 			}
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	protected function setConnectionCharset()
223 223
 	{
224
-		if ($this->_charset === '' || $this->_active === false)
224
+		if($this->_charset === '' || $this->_active === false)
225 225
 			return;
226
-		switch ($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME))
226
+		switch($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME))
227 227
 		{
228 228
 			case 'mysql':
229 229
 			case 'sqlite':
@@ -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();
@@ -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
 	/**
Please login to merge, or discard this patch.
framework/Caching/TChainedCacheDependency.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,9 +51,10 @@
 block discarded – undo
51 51
 	{
52 52
 		if($this->_dependencies !== null)
53 53
 		{
54
-			foreach($this->_dependencies as $dependency)
55
-				if($dependency->getHasChanged())
54
+			foreach($this->_dependencies as $dependency) {
55
+							if($dependency->getHasChanged())
56 56
 					return true;
57
+			}
57 58
 		}
58 59
 		return false;
59 60
 	}
Please login to merge, or discard this patch.
framework/Caching/TXCache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@
 block discarded – undo
56 56
 		if(!function_exists('xcache_isset'))
57 57
 			throw new TConfigurationException('xcache_extension_required');
58 58
 
59
-		$enabled = (int)ini_get('xcache.cacher') !== 0;
60
-		$var_size = (int)ini_get('xcache.var_size');
59
+		$enabled = (int) ini_get('xcache.cacher') !== 0;
60
+		$var_size = (int) ini_get('xcache.var_size');
61 61
 
62 62
 		if(!($enabled && $var_size > 0))
63 63
 			throw new TConfigurationException('xcache_extension_not_enabled');
Please login to merge, or discard this patch.
framework/PradoBase.php 2 patches
Braces   +14 added lines, -20 removed lines patch added patch discarded remove patch
@@ -160,8 +160,7 @@  discard block
 block discarded – undo
160 160
 		{
161 161
 			$am = self::$_application->getAssetManager();
162 162
 			$url = $am->publishFilePath(self::getPathOfNamespace('Prado\\' . $logoName, '.gif'));
163
-		}
164
-		else
163
+		} else
165 164
 			$url = 'http://pradosoft.github.io/docs/' . $logoName . '.gif';
166 165
 		return '<a title="Powered by PRADO" href="https://github.com/pradosoft/prado" target="_blank"><img src="' . $url . '" style="border-width:0px;" alt="Powered by PRADO" /></a>';
167 166
 	}
@@ -213,8 +212,7 @@  discard block
 block discarded – undo
213 212
 		if(self::$_application !== null && ($errorHandler = self::$_application->getErrorHandler()) !== null)
214 213
 		{
215 214
 			$errorHandler->handleError(null, $exception);
216
-		}
217
-		else
215
+		} else
218 216
 		{
219 217
 			echo $exception;
220 218
 		}
@@ -322,14 +320,14 @@  discard block
 block discarded – undo
322 320
 				break;
323 321
 				default:
324 322
 					$s = '$args[1]';
325
-					for($i = 2;$i < $n;++$i)
326
-						$s .= ",\$args[$i]";
323
+					for($i = 2;$i < $n;++$i) {
324
+											$s .= ",\$args[$i]";
325
+					}
327 326
 					eval("\$component=new $type($s);");
328 327
 					return $component;
329 328
 				break;
330 329
 			}
331
-		}
332
-		else
330
+		} else
333 331
 			return new $type;
334 332
 	}
335 333
 
@@ -383,8 +381,7 @@  discard block
 block discarded – undo
383 381
 			if($className === '*')  // a directory
384 382
 			{
385 383
 				self::$_usings[substr($namespace, 0, $pos)] = $path;
386
-			}
387
-			else  // a file
384
+			} else  // a file
388 385
 			{
389 386
 				//self::$_usings[$namespace]=$path;
390 387
 				if(!$checkClassExistence || (!class_exists($className, false) && !interface_exists($className, false)))
@@ -394,8 +391,7 @@  discard block
 block discarded – undo
394 391
 						include_once($path);
395 392
 						if(class_exists($namespace, false) || interface_exists($namespace, false))
396 393
 							class_alias($namespace, $className);
397
-					}
398
-					catch(\Exception $e)
394
+					} catch(\Exception $e)
399 395
 					{
400 396
 						if($checkClassExistence && !class_exists($className, false))
401 397
 							throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage());
@@ -471,8 +467,7 @@  discard block
 block discarded – undo
471 467
 				self::$_aliases[$alias] = $rp;
472 468
 			else
473 469
 				throw new TInvalidDataValueException('prado_aliasname_invalid', $alias);
474
-		}
475
-		else
470
+		} else
476 471
 			throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path);
477 472
 	}
478 473
 
@@ -517,8 +512,7 @@  discard block
 block discarded – undo
517 512
 							echo "'" . substr($str, 0, 70) . "...'";
518 513
 						else
519 514
 							echo "'" . $str . "'";
520
-					}
521
-					elseif (is_int($item) || is_float($item))
515
+					} elseif (is_int($item) || is_float($item))
522 516
 						echo $item;
523 517
 					elseif (is_object($item))
524 518
 						echo get_class($item);
@@ -613,8 +607,7 @@  discard block
 block discarded – undo
613 607
 			if(isset($trace[0]['file']) && isset($trace[0]['line']))
614 608
 				$msg .= " (line {$trace[0]['line']}, {$trace[0]['file']})";
615 609
 			$level = TLogger::DEBUG;
616
-		}
617
-		else
610
+		} else
618 611
 			$level = TLogger::INFO;
619 612
 		self::log($msg, $level, $category, $ctl);
620 613
 	}
@@ -677,8 +670,9 @@  discard block
 block discarded – undo
677 670
 		$app = Prado::getApplication()->getGlobalization(false);
678 671
 
679 672
 		$params = [];
680
-		foreach($parameters as $key => $value)
681
-			$params['{' . $key . '}'] = $value;
673
+		foreach($parameters as $key => $value) {
674
+					$params['{' . $key . '}'] = $value;
675
+		}
682 676
 
683 677
 		//no translation handler provided
684 678
 		if($app === null || ($config = $app->getTranslationConfiguration()) === null)
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 		/**
125 125
 		 * Sets error handler to be Prado::phpErrorHandler
126 126
 		 */
127
-		set_error_handler(['\Prado\PradoBase','phpErrorHandler']);
127
+		set_error_handler(['\Prado\PradoBase', 'phpErrorHandler']);
128 128
 		/**
129 129
 		 * Sets shutdown function to be Prado::phpFatalErrorHandler
130 130
 		 */
131
-		register_shutdown_function(['PradoBase','phpFatalErrorHandler']);
131
+		register_shutdown_function(['PradoBase', 'phpFatalErrorHandler']);
132 132
 		/**
133 133
 		 * Sets exception handler to be Prado::exceptionHandler
134 134
 		 */
135
-		set_exception_handler(['\Prado\PradoBase','exceptionHandler']);
135
+		set_exception_handler(['\Prado\PradoBase', 'exceptionHandler']);
136 136
 		/**
137 137
 		 * Disable php's builtin error reporting to avoid duplicated reports
138 138
 		 */
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public static function poweredByPrado($logoType = 0)
157 157
 	{
158
-		$logoName = $logoType == 1?'powered2':'powered';
158
+		$logoName = $logoType == 1 ? 'powered2' : 'powered';
159 159
 		if(self::$_application !== null)
160 160
 		{
161 161
 			$am = self::$_application->getAssetManager();
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 				break;
323 323
 				default:
324 324
 					$s = '$args[1]';
325
-					for($i = 2;$i < $n;++$i)
325
+					for($i = 2; $i < $n; ++$i)
326 326
 						$s .= ",\$args[$i]";
327 327
 					eval("\$component=new $type($s);");
328 328
 					return $component;
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						if(class_exists($namespace, false) || interface_exists($namespace, false))
396 396
 							class_alias($namespace, $className);
397 397
 					}
398
-					catch(\Exception $e)
398
+					catch (\Exception $e)
399 399
 					{
400 400
 						if($checkClassExistence && !class_exists($className, false))
401 401
 							throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage());
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public static function getPathOfAlias($alias)
449 449
 	{
450
-		return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null;
450
+		return isset(self::$_aliases[$alias]) ?self::$_aliases[$alias] : null;
451 451
 	}
452 452
 
453 453
 	protected static function getPathAliases()
@@ -513,25 +513,25 @@  discard block
 block discarded – undo
513 513
 					if(is_string($item))
514 514
 					{
515 515
 						$str = htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES);
516
-						if (strlen($item) > 70)
516
+						if(strlen($item) > 70)
517 517
 							echo "'" . substr($str, 0, 70) . "...'";
518 518
 						else
519 519
 							echo "'" . $str . "'";
520 520
 					}
521
-					elseif (is_int($item) || is_float($item))
521
+					elseif(is_int($item) || is_float($item))
522 522
 						echo $item;
523
-					elseif (is_object($item))
523
+					elseif(is_object($item))
524 524
 						echo get_class($item);
525
-					elseif (is_array($item))
525
+					elseif(is_array($item))
526 526
 						echo 'array(' . count($item) . ')';
527
-					elseif (is_bool($item))
527
+					elseif(is_bool($item))
528 528
 						echo $item ? 'true' : 'false';
529
-					elseif ($item === null)
529
+					elseif($item === null)
530 530
 						echo 'NULL';
531
-					elseif (is_resource($item))
531
+					elseif(is_resource($item))
532 532
 						echo get_resource_type($item);
533 533
 					$count++;
534
-					if (count($t['args']) > $count)
534
+					if(count($t['args']) > $count)
535 535
 						echo ', ';
536 536
 				}
537 537
 			}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 				foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
562 562
 				{
563 563
 					$array = explode(';q=', trim($language));
564
-					$languages[trim($array[0])] = isset($array[1])?(float)$array[1]:1.0;
564
+					$languages[trim($array[0])] = isset($array[1]) ? (float) $array[1] : 1.0;
565 565
 				}
566 566
 				arsort($languages);
567 567
 				$languages = array_keys($languages);
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 		if($app === null || ($config = $app->getTranslationConfiguration()) === null)
685 685
 			return strtr($text, $params);
686 686
 
687
-		if ($catalogue === null)
688
-			$catalogue = isset($config['catalogue'])?$config['catalogue']:'messages';
687
+		if($catalogue === null)
688
+			$catalogue = isset($config['catalogue']) ? $config['catalogue'] : 'messages';
689 689
 
690 690
 		Translation::init($catalogue);
691 691
 
Please login to merge, or discard this patch.
framework/Exceptions/THttpException.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@
 block discarded – undo
46 46
 		array_shift($args);
47 47
 		$n = count($args);
48 48
 		$tokens = [];
49
-		for($i = 0;$i < $n;++$i)
50
-			$tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]);
49
+		for($i = 0;$i < $n;++$i) {
50
+					$tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]);
51
+		}
51 52
 		parent::__construct(strtr($errorMessage, $tokens));
52 53
 	}
53 54
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 		array_shift($args);
47 47
 		$n = count($args);
48 48
 		$tokens = [];
49
-		for($i = 0;$i < $n;++$i)
49
+		for($i = 0; $i < $n; ++$i)
50 50
 			$tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]);
51 51
 		parent::__construct(strtr($errorMessage, $tokens));
52 52
 	}
Please login to merge, or discard this patch.
framework/Exceptions/TPhpErrorException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 			E_USER_NOTICE => "User Notice",
47 47
 			E_STRICT => "Runtime Notice"
48 48
 		];
49
-		$errorType = isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error';
49
+		$errorType = isset($errorTypes[$errno]) ? $errorTypes[$errno] : 'Unknown Error';
50 50
 		parent::__construct("[$errorType] $errstr (@line $errline in file $errfile).");
51 51
 	}
52 52
 
Please login to merge, or discard this patch.
framework/Security/TUser.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@
 block discarded – undo
174 174
 	 */
175 175
 	protected function getState($key, $defaultValue = null)
176 176
 	{
177
-		return isset($this->_state[$key])?$this->_state[$key]:$defaultValue;
177
+		return isset($this->_state[$key]) ? $this->_state[$key] : $defaultValue;
178 178
 	}
179 179
 
180 180
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,9 +132,10 @@
 block discarded – undo
132 132
 	 */
133 133
 	public function isInRole($role)
134 134
 	{
135
-		foreach($this->getRoles() as $r)
136
-			if(strcasecmp($role, $r) === 0)
135
+		foreach($this->getRoles() as $r) {
136
+					if(strcasecmp($role, $r) === 0)
137 137
 				return true;
138
+		}
138 139
 		return false;
139 140
 	}
140 141
 
Please login to merge, or discard this patch.