Passed
Push — php-cs-fixer ( b7e6c1...b932d3 )
by Fabio
31:05 queued 15:54
created
framework/Util/TEmailLogRoute.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,12 +81,14 @@
 block discarded – undo
81 81
 	protected function processLogs($logs)
82 82
 	{
83 83
 		$message = '';
84
-		foreach($logs as $log)
85
-			$message .= $this->formatLogMessage($log[0], $log[1], $log[2], $log[3]);
84
+		foreach($logs as $log) {
85
+					$message .= $this->formatLogMessage($log[0], $log[1], $log[2], $log[3]);
86
+		}
86 87
 		$message = wordwrap($message, 70);
87 88
 		$returnPath = ini_get('sendmail_path') ? "Return-Path:{$this->_from}\r\n" : '';
88
-		foreach($this->_emails as $email)
89
-			mail($email, $this->getSubject(), $message, "From:{$this->_from}\r\n{$returnPath}");
89
+		foreach($this->_emails as $email) {
90
+					mail($email, $this->getSubject(), $message, "From:{$this->_from}\r\n{$returnPath}");
91
+		}
90 92
 
91 93
 	}
92 94
 
Please login to merge, or discard this patch.
framework/Util/TParameterModule.php 2 patches
Braces   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -78,14 +78,12 @@  discard block
 block discarded – undo
78 78
 					$configFile->loadFromFile($this->_paramFile);
79 79
 					$cache->set($cacheKey, $configFile, 0, new TFileCacheDependency($this->_paramFile));
80 80
 				}
81
-			}
82
-			else
81
+			} else
83 82
 			{
84 83
 				if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
85 84
 				{
86 85
 					$configFile = include $this->_paramFile;
87
-				}
88
-				else
86
+				} else
89 87
 				{
90 88
 					$configFile = new TXmlDocument;
91 89
 					$configFile->loadFromFile($this->_paramFile);
@@ -112,14 +110,12 @@  discard block
 block discarded – undo
112 110
 				{
113 111
 					$properties = isset($parameter['properties'])?$parameter['properties']:[];
114 112
 					$parameters[$id] = [$parameter['class'],$properties];
115
-				}
116
-				else
113
+				} else
117 114
 				{
118 115
 					$parameters[$id] = $parameter;
119 116
 				}
120 117
 			}
121
-		}
122
-		elseif($config instanceof TXmlElement)
118
+		} elseif($config instanceof TXmlElement)
123 119
 		{
124 120
 			foreach($config->getElementsByTagName('parameter') as $node)
125 121
 			{
@@ -132,8 +128,7 @@  discard block
 block discarded – undo
132 128
 						$parameters[$id] = $node;
133 129
 					else
134 130
 						$parameters[$id] = $value;
135
-				}
136
-				else
131
+				} else
137 132
 					$parameters[$id] = [$type,$properties->toArray()];
138 133
 			}
139 134
 		}
@@ -144,11 +139,11 @@  discard block
 block discarded – undo
144 139
 			if(is_array($parameter))
145 140
 			{
146 141
 				$component = Prado::createComponent($parameter[0]);
147
-				foreach($parameter[1] as $name => $value)
148
-					$component->setSubProperty($name, $value);
142
+				foreach($parameter[1] as $name => $value) {
143
+									$component->setSubProperty($name, $value);
144
+				}
149 145
 				$appParams->add($id, $component);
150
-			}
151
-			else
146
+			} else
152 147
 				$appParams->add($id, $parameter);
153 148
 		}
154 149
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 			{
111 111
 				if(is_array($parameter) && isset($parameter['class']))
112 112
 				{
113
-					$properties = isset($parameter['properties'])?$parameter['properties']:[];
114
-					$parameters[$id] = [$parameter['class'],$properties];
113
+					$properties = isset($parameter['properties']) ? $parameter['properties'] : [];
114
+					$parameters[$id] = [$parameter['class'], $properties];
115 115
 				}
116 116
 				else
117 117
 				{
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 						$parameters[$id] = $value;
135 135
 				}
136 136
 				else
137
-					$parameters[$id] = [$type,$properties->toArray()];
137
+					$parameters[$id] = [$type, $properties->toArray()];
138 138
 			}
139 139
 		}
140 140
 
Please login to merge, or discard this patch.
framework/Data/Common/TDbMetaData.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,8 +146,9 @@
 block discarded – undo
146 146
 		if(strpos($name, '.') === false)
147 147
 			return $lft . $name . $rgt;
148 148
 		$names = explode('.', $name);
149
-		foreach($names as &$n)
150
-			$n = $lft . $n . $rgt;
149
+		foreach($names as &$n) {
150
+					$n = $lft . $n . $rgt;
151
+		}
151 152
 		return implode('.', $names);
152 153
 	}
153 154
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
 	 */
95 95
 	public function getTableInfo($tableName = null)
96 96
 	{
97
-		$key = $tableName === null?$this->getDbConnection()->getConnectionString():$tableName;
97
+		$key = $tableName === null ? $this->getDbConnection()->getConnectionString() : $tableName;
98 98
 		if(!isset($this->_tableInfoCache[$key]))
99 99
 		{
100 100
 			$class = $this->getTableInfoClass();
Please login to merge, or discard this patch.
framework/Data/Common/Pgsql/TPgsqlMetaData.php 3 patches
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -244,11 +244,9 @@  discard block
 block discarded – undo
244 244
 				$info['NumericPrecision'] = intval($matches[1]);
245 245
 				if(count($matches) > 2)
246 246
 					$info['NumericScale'] = intval($matches[2]);
247
-			}
248
-			else
247
+			} else
249 248
 				$info['ColumnSize'] = intval($matches[1]);
250
-		}
251
-		else
249
+		} else
252 250
 			$info['DbType'] = $col['type'];
253 251
 
254 252
 		$tableInfo->Columns[$columnId] = new TPgsqlTableColumn($info);
@@ -400,8 +398,9 @@  discard block
 block discarded – undo
400 398
 		{
401 399
 			$keys = preg_split('/,\s+/', $matches[1]);
402 400
 			$fkeys = [];
403
-			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey)
404
-				$fkeys[$keys[$i]] = $fkey;
401
+			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey) {
402
+							$fkeys[$keys[$i]] = $fkey;
403
+			}
405 404
 			return ['table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys];
406 405
 		}
407 406
 	}
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		if(count($parts = explode('.', str_replace('"', '', $table))) > 1)
94 94
 			return [$parts[0], $parts[1]];
95 95
 		else
96
-			return [$this->getDefaultSchema(),$parts[0]];
96
+			return [$this->getDefaultSchema(), $parts[0]];
97 97
 	}
98 98
 
99 99
 	/**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 					break;
353 353
 			}
354 354
 		}
355
-		return [$primary,$foreign];
355
+		return [$primary, $foreign];
356 356
 	}
357 357
 
358 358
 	/**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 				nspname = :schema))
138 138
 			AND a.attnum > 0 AND NOT a.attisdropped
139 139
 		ORDER BY a.attnum
140
-EOD;
140
+eod;
141 141
 		$this->getDbConnection()->setActive(true);
142 142
 		$command = $this->getDbConnection()->createCommand($sql);
143 143
 		$command->bindValue(':table', $tableName);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		SELECT count(c.relname) FROM pg_catalog.pg_class c
198 198
 		LEFT JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace)
199 199
 		WHERE (n.nspname=:schema) AND (c.relkind = 'v'::"char") AND c.relname = :table
200
-EOD;
200
+eod;
201 201
 		$this->getDbConnection()->setActive(true);
202 202
 		$command = $this->getDbConnection()->createCommand($sql);
203 203
 		$command->bindValue(':schema', $schemaName);
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 					WHERE nspname=:schema))
333 333
 	ORDER BY
334 334
 			1
335
-EOD;
335
+eod;
336 336
 		$this->getDbConnection()->setActive(true);
337 337
 		$command = $this->getDbConnection()->createCommand($sql);
338 338
 		$command->bindValue(':table', $tableName);
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			)
373 373
 		)
374 374
 				AND attnum IN ({$index})
375
-EOD;
375
+eod;
376 376
 		$command = $this->getDbConnection()->createCommand($sql);
377 377
 		$command->bindValue(':table', $tableName);
378 378
 		$command->bindValue(':schema', $schemaName);
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		$sql = <<<EOD
435 435
 SELECT table_name, table_schema FROM information_schema.tables
436 436
 WHERE table_schema=:schema AND table_type='BASE TABLE'
437
-EOD;
437
+eod;
438 438
 		$command = $this->getDbConnection()->createCommand($sql);
439 439
 		$command->bindParam(':schema', $schema);
440 440
 		$rows = $command->queryAll();
Please login to merge, or discard this patch.
framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@
 block discarded – undo
62 62
 	protected function getSearchCondition($column, $words)
63 63
 	{
64 64
 		$conditions = [];
65
-		foreach($words as $word)
66
-			$conditions[] = $column . ' ILIKE ' . $this->getDbConnection()->quoteString('%' . $word . '%');
65
+		foreach($words as $word) {
66
+					$conditions[] = $column . ' ILIKE ' . $this->getDbConnection()->quoteString('%' . $word . '%');
67
+		}
67 68
 		return '(' . implode(' AND ', $conditions) . ')';
68 69
 	}
69 70
 
Please login to merge, or discard this patch.
framework/Data/Common/TDbTableInfo.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
 		if($this->_names === null)
132 132
 		{
133 133
 			$this->_names = [];
134
-			foreach($this->getColumns() as $column)
135
-				$this->_names[] = $column->getColumnName();
134
+			foreach($this->getColumns() as $column) {
135
+							$this->_names[] = $column->getColumnName();
136
+			}
136 137
 		}
137 138
 		return $this->_names;
138 139
 	}
@@ -161,8 +162,9 @@  discard block
 block discarded – undo
161 162
 		if($this->_lowercase === null)
162 163
 		{
163 164
 			$this->_lowercase = [];
164
-			foreach($this->getColumns()->getKeys() as $key)
165
-				$this->_lowercase[strtolower($key)] = $key;
165
+			foreach($this->getColumns()->getKeys() as $key) {
166
+							$this->_lowercase[strtolower($key)] = $key;
167
+			}
166 168
 		}
167 169
 		return $this->_lowercase;
168 170
 	}
Please login to merge, or discard this patch.
framework/Data/Common/TDbCommandBuilder.php 3 patches
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -154,8 +154,9 @@  discard block
 block discarded – undo
154 154
 	protected function getSearchCondition($column, $words)
155 155
 	{
156 156
 		$conditions = [];
157
-		foreach($words as $word)
158
-			$conditions[] = $column . ' LIKE ' . $this->getDbConnection()->quoteString('%' . $word . '%');
157
+		foreach($words as $word) {
158
+					$conditions[] = $column . ' LIKE ' . $this->getDbConnection()->quoteString('%' . $word . '%');
159
+		}
159 160
 		return '(' . implode(' AND ', $conditions) . ')';
160 161
 	}
161 162
 
@@ -202,8 +203,9 @@  discard block
 block discarded – undo
202 203
 		if(is_scalar($data)) {
203 204
 			$tmp = explode(',', $data);
204 205
 			$result = [];
205
-			foreach($tmp as $v)
206
-				$result[] = trim($v);
206
+			foreach($tmp as $v) {
207
+							$result[] = trim($v);
208
+			}
207 209
 			return $result;
208 210
 		}
209 211
 
@@ -466,10 +468,10 @@  discard block
 block discarded – undo
466 468
 		if($this->hasIntegerKey($values))
467 469
 		{
468 470
 			$values = array_values($values);
469
-			for($i = 0, $max = count($values); $i < $max; $i++)
470
-				$command->bindValue($i + 1, $values[$i], $this->getPdoType($values[$i]));
471
-		}
472
-		else
471
+			for($i = 0, $max = count($values); $i < $max; $i++) {
472
+							$command->bindValue($i + 1, $values[$i], $this->getPdoType($values[$i]));
473
+			}
474
+		} else
473 475
 		{
474 476
 			foreach($values as $name => $value)
475 477
 			{
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function applyLimitOffset($sql, $limit = -1, $offset = -1)
95 95
 	{
96
-		$limit = $limit !== null ? (int)$limit : -1;
97
-		$offset = $offset !== null ? (int)$offset : -1;
96
+		$limit = $limit !== null ? (int) $limit : -1;
97
+		$offset = $offset !== null ? (int) $offset : -1;
98 98
 		$limitStr = $limit >= 0 ? ' LIMIT ' . $limit : '';
99 99
 		$offsetStr = $offset >= 0 ? ' OFFSET ' . $offset : '';
100 100
 		return $sql . $limitStr . $offsetStr;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 					if($k)
249 249
 						$result[] = 'NULL AS ' . $columns[$key]->getColumnName();
250 250
 					else
251
-						$result[] = 'NULL' . (is_string($key) ? (' AS ' . (string)$key) : '');
251
+						$result[] = 'NULL' . (is_string($key) ? (' AS ' . (string) $key) : '');
252 252
 					continue;
253 253
 				}
254 254
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 					if($k)
257 257
 						$result[] = $value . ' AS ' . $columns[$key]->getColumnName();
258 258
 					else
259
-						$result[] = $value . (is_string($key) ? (' AS ' . (string)$key) : '');
259
+						$result[] = $value . (is_string($key) ? (' AS ' . (string) $key) : '');
260 260
 					continue;
261 261
 				}
262 262
 
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 				}
287 287
 
288 288
 				if(!$v && !$k && is_int($key)) {
289
-					$result[] = is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value);
289
+					$result[] = is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string) $value);
290 290
 					continue;
291 291
 				}
292 292
 
293
-				$result[] = (is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value)) . ' AS ' . $key;
293
+				$result[] = (is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string) $value)) . ' AS ' . $key;
294 294
 			}
295 295
 		}
296 296
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	public function createDeleteCommand($where, $parameters = [])
351 351
 	{
352 352
 		$table = $this->getTableInfo()->getTableFullName();
353
-		if (!empty($where))
353
+		if(!empty($where))
354 354
 			$where = ' WHERE ' . $where;
355 355
 		$command = $this->createCommand("DELETE FROM {$table}" . $where);
356 356
 		$this->bindArrayValues($command, $parameters);
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 		else
391 391
 			$fields = implode(', ', $this->getColumnBindings($data));
392 392
 
393
-		if (!empty($where))
393
+		if(!empty($where))
394 394
 			$where = ' WHERE ' . $where;
395 395
 		$command = $this->createCommand("UPDATE {$table} SET {$fields}" . $where);
396 396
 		$this->bindArrayValues($command, array_merge($data, $parameters));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	{
312 312
 		$table = $this->getTableInfo()->getTableFullName();
313 313
 		$fields = implode(', ', $this -> getSelectFieldList($select));
314
-		$sql = "SELECT {$fields} FROM {$table}";
314
+		$sql = "select {$fields} FROM {$table}";
315 315
 		if(!empty($where))
316 316
 			$sql .= " WHERE {$where}";
317 317
 		return $this->applyCriterias($sql, $parameters, $ordering, $limit, $offset);
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
 		if (!empty($where))
394 394
 			$where = ' WHERE ' . $where;
395
-		$command = $this->createCommand("UPDATE {$table} SET {$fields}" . $where);
395
+		$command = $this->createCommand("update {$table} SET {$fields}" . $where);
396 396
 		$this->bindArrayValues($command, array_merge($data, $parameters));
397 397
 		return $command;
398 398
 	}
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlMetaData.php 3 patches
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -160,8 +160,7 @@  discard block
 block discarded – undo
160 160
 					$info['NumericPrecision'] = intval($pscale[1]);
161 161
 					if(count($pscale) > 2)
162 162
 						$info['NumericScale'] = intval($pscale[2]);
163
-				}
164
-				else
163
+				} else
165 164
 					$info['ColumnSize'] = intval($pscale[1]);
166 165
 			}
167 166
 		}
@@ -260,8 +259,7 @@  discard block
 block discarded – undo
260 259
 		try
261 260
 		{
262 261
 			return count($result = $command->queryRow()) > 0 && $result['Table_type'] === 'VIEW';
263
-		}
264
-		catch(TDbException $e)
262
+		} catch(TDbException $e)
265 263
 		{
266 264
 			$table = $schemaName === null?$tableName:$schemaName . '.' . $tableName;
267 265
 			throw new TDbException('dbcommon_invalid_table_name', $table, $e->getMessage());
@@ -370,8 +368,9 @@  discard block
 block discarded – undo
370 368
 			$fields = array_map('trim', explode(',', str_replace('`', '', $match[1])));
371 369
 			$fk_fields = array_map('trim', explode(',', str_replace('`', '', $match[3])));
372 370
 			$keys = [];
373
-			foreach($fields as $k => $v)
374
-				$keys[$v] = $fk_fields[$k];
371
+			foreach($fields as $k => $v) {
372
+							$keys[$v] = $fk_fields[$k];
373
+			}
375 374
 			$foreign[] = ['keys' => $keys, 'table' => trim($match[2])];
376 375
 		}
377 376
 		return $foreign;
@@ -403,8 +402,9 @@  discard block
 block discarded – undo
403 402
 		if($schema === '')
404 403
 			return $this->getDbConnection()->createCommand('SHOW TABLES')->queryColumn();
405 404
 		$names = $this->getDbConnection()->createCommand('SHOW TABLES FROM ' . $this->quoteTableName($schema))->queryColumn();
406
-		foreach($names as &$name)
407
-			$name = $schema . '.' . $name;
405
+		foreach($names as &$name) {
406
+					$name = $schema . '.' . $name;
407
+		}
408 408
 		return $names;
409 409
 	}
410 410
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 		{
262 262
 			return count($result = $command->queryRow()) > 0 && $result['Table_type'] === 'VIEW';
263 263
 		}
264
-		catch(TDbException $e)
264
+		catch (TDbException $e)
265 265
 		{
266
-			$table = $schemaName === null?$tableName:$schemaName . '.' . $tableName;
266
+			$table = $schemaName === null ? $tableName : $schemaName . '.' . $tableName;
267 267
 			throw new TDbException('dbcommon_invalid_table_name', $table, $e->getMessage());
268 268
 		}
269 269
 	}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			$foreign = $this->getForeignConstraints($schemaName, $tableName);
292 292
 		else
293 293
 			$foreign = $this->findForeignConstraints($schemaName, $tableName);
294
-		return [$primary,$foreign];
294
+		return [$primary, $foreign];
295 295
 	}
296 296
 
297 297
 	/**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -316,7 +316,7 @@
 block discarded – undo
316 316
 				REFERENCED_TABLE_NAME IS NOT NULL
317 317
 				AND TABLE_NAME LIKE :table
318 318
 				$andSchema
319
-EOD;
319
+eod;
320 320
 		$command = $this->getDbConnection()->createCommand($sql);
321 321
 		$command->bindValue(':table', $tableName);
322 322
 		if($schemaName !== null)
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlTableColumn.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 	 */
40 40
 	public function getPHPType()
41 41
 	{
42
-		$dbtype = trim(str_replace(['unsigned', 'zerofill'], ['','',], strtolower($this->getDbType())));
42
+		$dbtype = trim(str_replace(['unsigned', 'zerofill'], ['', '', ], strtolower($this->getDbType())));
43 43
 		if($dbtype === 'tinyint' && $this->getColumnSize() === 1)
44 44
 			return 'boolean';
45 45
 		foreach(self::$types as $type => $dbtypes)
Please login to merge, or discard this patch.