Passed
Push — php-cs-fixer ( b7e6c1...b932d3 )
by Fabio
31:05 queued 15:54
created
framework/Data/Common/Oracle/TOracleTableColumn.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 class TOracleTableColumn extends TDbTableColumn
29 29
 {
30 30
 	private static $types = [
31
-		'numeric' => [ 'numeric' ]
31
+		'numeric' => ['numeric']
32 32
 //		'integer' => array('bit', 'bit varying', 'real', 'serial', 'int', 'integer'),
33 33
 //		'boolean' => array('boolean'),
34 34
 //		'float' => array('bigint', 'bigserial', 'double precision', 'money', 'numeric')
Please login to merge, or discard this patch.
framework/Data/Common/Oracle/TOracleMetaData.php 3 patches
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -207,11 +207,9 @@  discard block
 block discarded – undo
207 207
 				$info['NumericPrecision'] = intval($matches[1]);
208 208
 				if(count($matches) > 2)
209 209
 					$info['NumericScale'] = intval($matches[2]);
210
-			}
211
-			else
210
+			} else
212 211
 				$info['ColumnSize'] = intval($matches[1]);
213
-		}
214
-		else
212
+		} else
215 213
 			$info['DbType'] = $col['type'];
216 214
 		$tableInfo->Columns[$columnId] = new TOracleTableColumn($info);
217 215
 	}
@@ -317,8 +315,9 @@  discard block
 block discarded – undo
317 315
 		{
318 316
 			$keys = preg_split('/,\s+/', $matches[1]);
319 317
 			$fkeys = [];
320
-			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey)
321
-				$fkeys[$keys[$i]] = $fkey;
318
+			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey) {
319
+							$fkeys[$keys[$i]] = $fkey;
320
+			}
322 321
 			return ['table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys];
323 322
 		}
324 323
 	}
@@ -353,8 +352,7 @@  discard block
 block discarded – undo
353 352
 SELECT table_name, '{$schema}' as table_schema FROM user_tables
354 353
 EOD;
355 354
 			$command = $this->getDbConnection()->createCommand($sql);
356
-		}
357
-		else
355
+		} else
358 356
 		{
359 357
 			$sql = <<<EOD
360 358
 SELECT object_name as table_name, owner as table_schema FROM all_objects
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		if(count($parts = explode('.', str_replace('"', '', $table))) > 1)
66 66
 			return [$parts[0], $parts[1]];
67 67
 		else
68
-			return [$this->getDefaultSchema(),$parts[0]];
68
+			return [$this->getDefaultSchema(), $parts[0]];
69 69
 	}
70 70
 
71 71
 	/**
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 		$info['ColumnName'] = $columnId; //NOT quote the column names!
181 181
 		$info['ColumnId'] = $columnId;
182 182
 		$info['ColumnIndex'] = $col['index'];
183
-		if(! (bool)$col['attnotnull']) $info['AllowNull'] = true;
183
+		if(!(bool) $col['attnotnull']) $info['AllowNull'] = true;
184 184
 		if(in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey'] = true;
185 185
 		if($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey'] = true;
186
-		if((int)$col['atttypmod'] > 0) $info['ColumnSize'] = $col['atttypmod']; // - 4;
187
-		if((bool)$col['atthasdef']) $info['DefaultValue'] = $col['adsrc'];
186
+		if((int) $col['atttypmod'] > 0) $info['ColumnSize'] = $col['atttypmod']; // - 4;
187
+		if((bool) $col['atthasdef']) $info['DefaultValue'] = $col['adsrc'];
188 188
 		//
189 189
 		// For a while Oracle Tables has no  associated AutoIncrement Triggers
190 190
 		//
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 					break;
288 288
 			}
289 289
 		}
290
-		return [$primary,$foreign];
290
+		return [$primary, $foreign];
291 291
 	}
292 292
 
293 293
 	/**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			TABLE_NAME = '{$tableName}'
98 98
 			AND OWNER = '{$schemaName}'
99 99
 		ORDER BY a.COLUMN_ID
100
-EOD;
100
+eod;
101 101
 		$this->getDbConnection()->setActive(true);
102 102
 		$this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
103 103
 		$command = $this->getDbConnection()->createCommand($sql);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		from 	ALL_OBJECTS
161 161
 		where	OBJECT_NAME = '{$tableName}'
162 162
 		and 	OWNER = '{$schemaName}'
163
-EOD;
163
+eod;
164 164
 		$this->getDbConnection()->setActive(true);
165 165
 		$command = $this->getDbConnection()->createCommand($sql);
166 166
 		//$command->bindValue(':schema',$schemaName);
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		and	  a.TABLE_NAME = '{$tableName}'
260 260
 		and   a.OWNER = '{$schemaName}'
261 261
 		and   a.CONSTRAINT_TYPE in ('P','R')
262
-EOD;
262
+eod;
263 263
 		$this->getDbConnection()->setActive(true);
264 264
 		$command = $this->getDbConnection()->createCommand($sql);
265 265
 		//$command->bindValue(':table', $tableName);
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		{
352 352
 			$sql = <<<EOD
353 353
 SELECT table_name, '{$schema}' as table_schema FROM user_tables
354
-EOD;
354
+eod;
355 355
 			$command = $this->getDbConnection()->createCommand($sql);
356 356
 		}
357 357
 		else
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 			$sql = <<<EOD
360 360
 SELECT object_name as table_name, owner as table_schema FROM all_objects
361 361
 WHERE object_type = 'TABLE' AND owner=:schema
362
-EOD;
362
+eod;
363 363
 			$command = $this->getDbConnection()->createCommand($sql);
364 364
 			$command->bindParam(':schema', $schema);
365 365
 		}
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlCommandBuilder.php 2 patches
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -138,8 +138,7 @@  discard block
 block discarded – undo
138 138
 						$ordering[$subs[1][0]] = $subs[2][0];
139 139
 					}
140 140
 					//else what?
141
-				}
142
-				else
141
+				} else
143 142
 					$ordering[trim($part)] = 'ASC';
144 143
 			}
145 144
 		}
@@ -155,8 +154,9 @@  discard block
 block discarded – undo
155 154
 		if(count($orders) > 0)
156 155
 		{
157 156
 			$str = [];
158
-			foreach($orders as $column => $direction)
159
-				$str[] = $column . ' ' . $direction;
157
+			foreach($orders as $column => $direction) {
158
+							$str[] = $column . ' ' . $direction;
159
+			}
160 160
 			return 'ORDER BY ' . implode(', ', $str);
161 161
 		}
162 162
 	}
@@ -167,8 +167,9 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function reverseDirection($orders)
169 169
 	{
170
-		foreach($orders as $column => $direction)
171
-			$orders[$column] = strtolower(trim($direction)) === 'desc' ? 'ASC' : 'DESC';
170
+		foreach($orders as $column => $direction) {
171
+					$orders[$column] = strtolower(trim($direction)) === 'desc' ? 'ASC' : 'DESC';
172
+		}
172 173
 		return $orders;
173 174
 	}
174 175
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 	{
86 86
 		$limit = $limit !== null ? intval($limit) : -1;
87 87
 		$offset = $offset !== null ? intval($offset) : -1;
88
-		if ($limit > 0 && $offset <= 0) //just limit
88
+		if($limit > 0 && $offset <= 0) //just limit
89 89
 			$sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $limit", $sql);
90 90
 		elseif($limit > 0 && $offset > 0)
91 91
 			$sql = $this->rewriteLimitOffsetSql($sql, $limit, $offset);
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlMetaData.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -196,8 +196,9 @@
 block discarded – undo
196 196
 		$command = $this->getDbConnection()->createCommand($sql);
197 197
 		$command->bindValue(':table', $col['TABLE_NAME']);
198 198
 		$primary = [];
199
-		foreach($command->query()->readAll() as $field)
200
-			$primary[] = $field['field_name'];
199
+		foreach($command->query()->readAll() as $field) {
200
+					$primary[] = $field['field_name'];
201
+		}
201 202
 		$foreign = $this->getForeignConstraints($col);
202 203
 		return [$primary,$foreign];
203 204
 	}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 		//remove possible delimiters
118 118
 		$result = explode('.', preg_replace('/\[|\]|"/', '', $table));
119 119
 		if(count($result) === 1)
120
-			return [null,null,$result[0]];
120
+			return [null, null, $result[0]];
121 121
 		if(count($result) === 2)
122
-			return [null,$result[0],$result[1]];
122
+			return [null, $result[0], $result[1]];
123 123
 		if(count($result) > 2)
124
-			return [$result[0],$result[1],$result[2]];
124
+			return [$result[0], $result[1], $result[2]];
125 125
 	}
126 126
 
127 127
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		foreach($command->query()->readAll() as $field)
200 200
 			$primary[] = $field['field_name'];
201 201
 		$foreign = $this->getForeignConstraints($col);
202
-		return [$primary,$foreign];
202
+		return [$primary, $foreign];
203 203
 	}
204 204
 
205 205
 	/**
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 		$command->bindParam(":schema", $schema);
281 281
 		$rows = $command->queryAll();
282 282
 		$names = [];
283
-		foreach ($rows as $row)
283
+		foreach($rows as $row)
284 284
 		{
285
-			if ($schema == self::DEFAULT_SCHEMA)
285
+			if($schema == self::DEFAULT_SCHEMA)
286 286
 				$names[] = $row['TABLE_NAME'];
287 287
 			else
288 288
 				$names[] = $schema . '.' . $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME'];
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 												INFORMATION_SCHEMA.COLUMNS c
84 84
 									WHERE t.table_name = c.table_name
85 85
 										AND t.table_name = :table
86
-EOD;
86
+eod;
87 87
 		if($schemaName !== null)
88 88
 			$sql .= ' AND t.table_schema = :schema';
89 89
 		if($catalogName !== null)
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		AND
193 193
 			c.constraint_type ='PRIMARY KEY'
194 194
 				AND k.table_name = :table
195
-EOD;
195
+eod;
196 196
 		$command = $this->getDbConnection()->createCommand($sql);
197 197
 		$command->bindValue(':table', $col['TABLE_NAME']);
198 198
 		$primary = [];
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		RC.UNIQUE_CONSTRAINT_NAME
236 236
 			AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION
237 237
 		WHERE KCU1.TABLE_NAME = :table
238
-EOD;
238
+eod;
239 239
 		$command = $this->getDbConnection()->createCommand($sql);
240 240
 		$command->bindValue(':table', $col['TABLE_NAME']);
241 241
 		$fkeys = [];
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$sql = <<<EOD
276 276
 SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES]
277 277
 WHERE TABLE_SCHEMA=:schema AND $condition
278
-EOD;
278
+eod;
279 279
 		$command = $this->getDbConnection()->createCommand($sql);
280 280
 		$command->bindParam(":schema", $schema);
281 281
 		$rows = $command->queryAll();
Please login to merge, or discard this patch.
framework/Data/TDbCommand.php 2 patches
Braces   +9 added lines, -14 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
 			}
@@ -193,11 +192,9 @@  discard block
 block discarded – undo
193 192
 			{
194 193
 				$this->_statement->execute();
195 194
 				return $this->_statement->rowCount();
196
-			}
197
-			else
195
+			} else
198 196
 				return $this->getConnection()->getPdoInstance()->exec($this->getText());
199
-		}
200
-		catch(Exception $e)
197
+		} catch(Exception $e)
201 198
 		{
202 199
 			throw new TDbException('dbcommand_execute_failed', $e->getMessage(), $this->getDebugStatementText());
203 200
 		}
@@ -230,8 +227,7 @@  discard block
 block discarded – undo
230 227
 			else
231 228
 				$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
232 229
 			return new TDbDataReader($this);
233
-		}
234
-		catch(Exception $e)
230
+		} catch(Exception $e)
235 231
 		{
236 232
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
237 233
 		}
@@ -257,8 +253,7 @@  discard block
 block discarded – undo
257 253
 			$result = $this->_statement->fetch($fetchAssociative ? PDO::FETCH_ASSOC : PDO::FETCH_NUM);
258 254
 			$this->_statement->closeCursor();
259 255
 			return $result;
260
-		}
261
-		catch(Exception $e)
256
+		} catch(Exception $e)
262 257
 		{
263 258
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
264 259
 		}
@@ -286,8 +281,7 @@  discard block
 block discarded – undo
286 281
 				return stream_get_contents($result);
287 282
 			else
288 283
 				return $result;
289
-		}
290
-		catch(Exception $e)
284
+		} catch(Exception $e)
291 285
 		{
292 286
 			throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText());
293 287
 		}
@@ -305,8 +299,9 @@  discard block
 block discarded – undo
305 299
 	{
306 300
 		$rows = $this->query()->readAll();
307 301
 		$column = [];
308
-		foreach($rows as $row)
309
-			$column[] = current($row);
302
+		foreach($rows as $row) {
303
+					$column[] = current($row);
304
+		}
310 305
 		return $column;
311 306
 	}
312 307
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
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
 			}
@@ -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
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
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
 		}
@@ -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
 		}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
framework/Data/DataGateway/TSqlCriteria.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -198,8 +198,9 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function getIsNamedParameters()
200 200
 	{
201
-		foreach($this->getParameters() as $k => $v)
202
-			return is_string($k);
201
+		foreach($this->getParameters() as $k => $v) {
202
+					return is_string($k);
203
+		}
203 204
 	}
204 205
 
205 206
 	/**
@@ -271,13 +272,15 @@  discard block
 block discarded – undo
271 272
 		if(strlen((string)$this->getCondition()) > 0)
272 273
 			$str .= '"' . (string)$this->getCondition() . '"';
273 274
 		$params = [];
274
-		foreach($this->getParameters() as $k => $v)
275
-			$params[] = "{$k} => ${v}";
275
+		foreach($this->getParameters() as $k => $v) {
276
+					$params[] = "{$k} => ${v}";
277
+		}
276 278
 		if(count($params) > 0)
277 279
 			$str .= ', "' . implode(', ', $params) . '"';
278 280
 		$orders = [];
279
-		foreach($this->getOrdersBy() as $k => $v)
280
-			$orders[] = "{$k} => ${v}";
281
+		foreach($this->getOrdersBy() as $k => $v) {
282
+					$orders[] = "{$k} => ${v}";
283
+		}
281 284
 		if(count($orders) > 0)
282 285
 			$str .= ', "' . implode(', ', $orders) . '"';
283 286
 		if($this->_limit !== null)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
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
 
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 			$value = str_replace($matches[0], '', $value); // remove limit from query
160 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 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);
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
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 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,8 +268,8 @@  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 274
 		foreach($this->getParameters() as $k => $v)
275 275
 			$params[] = "{$k} => ${v}";
Please login to merge, or discard this patch.
framework/Data/DataGateway/TDataGatewayCommand.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -202,8 +202,9 @@  discard block
 block discarded – undo
202 202
 			return 'FALSE';
203 203
 		$columns = [];
204 204
 		$tableName = $table->getTableFullName();
205
-		foreach($fields as $field)
206
-			$columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName();
205
+		foreach($fields as $field) {
206
+					$columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName();
207
+		}
207 208
 		return '(' . implode(', ', $columns) . ') IN ' . $this->quoteTuple($values);
208 209
 	}
209 210
 
@@ -245,8 +246,9 @@  discard block
 block discarded – undo
245 246
 	{
246 247
 		$conn = $this->getDbConnection();
247 248
 		$data = [];
248
-		foreach($array as $k => $v)
249
-			$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
249
+		foreach($array as $k => $v) {
250
+					$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
251
+		}
250 252
 		return '(' . implode(', ', $data) . ')';
251 253
 	}
252 254
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function updateByPk($data, $keys)
105 105
 	{
106
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
106
+		list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys);
107 107
 		return $this->update($data, new TSqlCriteria($where, $parameters));
108 108
 	}
109 109
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	{
154 154
 		if($keys === null)
155 155
 			return null;
156
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
156
+		list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys);
157 157
 		$command = $this->getBuilder()->createFindCommand($where, $parameters);
158 158
 		$this->onCreateCommand($command, new TSqlCriteria($where, $parameters));
159 159
 		return $this->onExecuteCommand($command, $command->queryRow());
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public function findAllByPk($keys)
166 166
 	{
167
-		$where = $this->getCompositeKeyCondition((array)$keys);
167
+		$where = $this->getCompositeKeyCondition((array) $keys);
168 168
 		$command = $this->getBuilder()->createFindCommand($where);
169 169
 		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
170 170
 		return $this->onExecuteCommand($command, $command->query());
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	{
190 190
 		if(count($keys) == 0)
191 191
 			return 0;
192
-		$where = $this->getCompositeKeyCondition((array)$keys);
192
+		$where = $this->getCompositeKeyCondition((array) $keys);
193 193
 		$command = $this->getBuilder()->createDeleteCommand($where);
194 194
 		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
195 195
 		$command->prepare();
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
 	public function getIndexKeyCondition($table, $fields, $values)
200 200
 	{
201
-		if (!count($values))
201
+		if(!count($values))
202 202
 			return 'FALSE';
203 203
 		$columns = [];
204 204
 		$tableName = $table->getTableFullName();
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		{
271 271
 			$column = $this->getTableInfo()->getColumn($key)->getColumnName();
272 272
 			$criteria[] = $column . ' = :' . $key;
273
-			$bindings[$key] = isset($values[$key])?$values[$key]:$values[$i++];
273
+			$bindings[$key] = isset($values[$key]) ? $values[$key] : $values[$i++];
274 274
 		}
275 275
 		return [implode(' AND ', $criteria), $bindings];
276 276
 	}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	public function count($criteria)
326 326
 	{
327 327
 		if($criteria === null)
328
-			return (int)$this->getBuilder()->createCountCommand()->queryScalar();
328
+			return (int) $this->getBuilder()->createCountCommand()->queryScalar();
329 329
 		$where = $criteria->getCondition();
330 330
 		$parameters = $criteria->getParameters()->toArray();
331 331
 		$ordering = $criteria->getOrdersBy();
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		$offset = $criteria->getOffset();
334 334
 		$command = $this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset);
335 335
 		$this->onCreateCommand($command, $criteria);
336
-		return $this->onExecuteCommand($command, (int)$command->queryScalar());
336
+		return $this->onExecuteCommand($command, (int) $command->queryScalar());
337 337
 	}
338 338
 
339 339
 	/**
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		static $stack = [];
80 80
 
81
-		$results = call_user_func_array([$this->getSourceRecord(),$method], $args);
81
+		$results = call_user_func_array([$this->getSourceRecord(), $method], $args);
82 82
 		$validArray = is_array($results) && count($results) > 0;
83 83
 		if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord)
84 84
 		{
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	{
173 173
 		$ids = [];
174 174
 		foreach($properties as $property)
175
-			$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
175
+			$ids[] = is_object($obj) ? (string) $obj->getColumnValue($property) : (string) $obj[$property];
176 176
 		return serialize($ids);
177 177
 	}
178 178
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	{
235 235
 		if(is_array($results) || $results instanceof \ArrayAccess)
236 236
 		{
237
-			for($i = 0,$k = count($results);$i < $k;$i++)
237
+			for($i = 0, $k = count($results); $i < $k; $i++)
238 238
 				$this->setObjectProperty($results[$i], $properties, $collections);
239 239
 		}
240 240
 		else
Please login to merge, or discard this patch.
Braces   +17 added lines, -14 removed lines patch added patch discarded remove patch
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 		if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord)
84 84
 		{
85 85
 			$this->collectForeignObjects($results);
86
-			while($obj = array_pop($stack))
87
-				$obj->collectForeignObjects($results);
88
-		}
89
-		elseif($results instanceof TActiveRecordRelation)
86
+			while($obj = array_pop($stack)) {
87
+							$obj->collectForeignObjects($results);
88
+			}
89
+		} elseif($results instanceof TActiveRecordRelation)
90 90
 			$stack[] = $this; //call it later
91 91
 		elseif($results === null || !$validArray)
92 92
 			$stack = [];
@@ -171,8 +171,9 @@  discard block
 block discarded – undo
171 171
 	protected function getObjectHash($obj, $properties)
172 172
 	{
173 173
 		$ids = [];
174
-		foreach($properties as $property)
175
-			$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
174
+		foreach($properties as $property) {
175
+					$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
176
+		}
176 177
 		return serialize($ids);
177 178
 	}
178 179
 
@@ -202,8 +203,9 @@  discard block
 block discarded – undo
202 203
 		foreach($results as $result)
203 204
 		{
204 205
 			$value = [];
205
-			foreach($keys as $name)
206
-				$value[] = $result->getColumnValue($name);
206
+			foreach($keys as $name) {
207
+							$value[] = $result->getColumnValue($name);
208
+			}
207 209
 			$values[] = $value;
208 210
 		}
209 211
 		return $values;
@@ -219,8 +221,9 @@  discard block
 block discarded – undo
219 221
 	protected function populateResult(&$results, $properties, &$fkObjects, $fields)
220 222
 	{
221 223
 		$collections = [];
222
-		foreach($fkObjects as $fkObject)
223
-			$collections[$this->getObjectHash($fkObject, $fields)][] = $fkObject;
224
+		foreach($fkObjects as $fkObject) {
225
+					$collections[$this->getObjectHash($fkObject, $fields)][] = $fkObject;
226
+		}
224 227
 		$this->setResultCollection($results, $collections, $properties);
225 228
 	}
226 229
 
@@ -234,10 +237,10 @@  discard block
 block discarded – undo
234 237
 	{
235 238
 		if(is_array($results) || $results instanceof \ArrayAccess)
236 239
 		{
237
-			for($i = 0,$k = count($results);$i < $k;$i++)
238
-				$this->setObjectProperty($results[$i], $properties, $collections);
239
-		}
240
-		else
240
+			for($i = 0,$k = count($results);$i < $k;$i++) {
241
+							$this->setObjectProperty($results[$i], $properties, $collections);
242
+			}
243
+		} else
241 244
 			$this->setObjectProperty($results, $properties, $collections);
242 245
 	}
243 246
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 		{
110 110
 			$source = $this->getSourceRecord();
111 111
 			$fkeys = $this->findForeignKeys($fkObjects[0], $source);
112
-			for($i = 0;$i < $total;$i++)
112
+			for($i = 0; $i < $total; $i++)
113 113
 			{
114 114
 				foreach($fkeys as $fKey => $srcKey)
115 115
 					$fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey));
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,8 +111,9 @@
 block discarded – undo
111 111
 			$fkeys = $this->findForeignKeys($fkObjects[0], $source);
112 112
 			for($i = 0;$i < $total;$i++)
113 113
 			{
114
-				foreach($fkeys as $fKey => $srcKey)
115
-					$fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey));
114
+				foreach($fkeys as $fKey => $srcKey) {
115
+									$fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey));
116
+				}
116 117
 				$success = $fkObjects[$i]->save() && $success;
117 118
 			}
118 119
 		}
Please login to merge, or discard this patch.