Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:02
created
framework/Data/SqlMap/DataMapper/TSqlMapException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		array_shift($args);
31 31
 		$n = count($args);
32 32
 		$tokens = [];
33
-		for($i = 0;$i < $n;++$i)
33
+		for($i = 0; $i < $n; ++$i)
34 34
 		{
35 35
 			if($args[$i] instanceof SimpleXMLElement)
36 36
 				$tokens['{' . $i . '}'] = $this->implodeNode($args[$i]);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		$attributes = [];
50 50
 		foreach($node->attributes() as $k => $v)
51
-			$attributes[] = $k . '="' . (string)$v . '"';
51
+			$attributes[] = $k . '="' . (string) $v . '"';
52 52
 		return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>';
53 53
 	}
54 54
 
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TMappedStatement.php 1 patch
Spacing   +9 added lines, -12 removed lines patch added patch discarded remove patch
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	{
177 177
 		if($max > -1 || $skip > -1)
178 178
 		{
179
-			$maxStr = $max > 0?' LIMIT ' . $max:'';
180
-			$skipStr = $skip > 0?' OFFSET ' . $skip:'';
179
+			$maxStr = $max > 0 ? ' LIMIT ' . $max : '';
180
+			$skipStr = $skip > 0 ? ' OFFSET ' . $skip : '';
181 181
 			$command->setText($command->getText() . $maxStr . $skipStr);
182 182
 		}
183 183
 		$connection->setActive(true);
@@ -237,8 +237,7 @@  discard block
 block discarded – undo
237 237
 	public function runQueryForList($connection, $parameter, $sql, $result, $delegate = null)
238 238
 	{
239 239
 		$registry = $this->getManager()->getTypeHandlers();
240
-		$list = $result instanceof \ArrayAccess ? $result :
241
-							$this->_statement->createInstanceOfListClass($registry);
240
+		$list = $result instanceof \ArrayAccess ? $result : $this->_statement->createInstanceOfListClass($registry);
242 241
 		$connection->setActive(true);
243 242
 		$reader = $sql->query();
244 243
 		//$reader = $this->executeSQLQueryLimit($connection, $sql, $max, $skip);
@@ -322,8 +321,7 @@  discard block
 block discarded – undo
322 321
 			{
323 322
 				$obj = $this->applyResultMap($row);
324 323
 				$key = TPropertyAccess::get($obj, $keyProperty);
325
-				$value = ($valueProperty === null) ? $obj :
326
-							TPropertyAccess::get($obj, $valueProperty);
324
+				$value = ($valueProperty === null) ? $obj : TPropertyAccess::get($obj, $valueProperty);
327 325
 				$param = new TResultSetMapItemParameter($key, $value, $parameter, $map);
328 326
 				$this->raiseRowDelegate($delegate, $param);
329 327
 			}
@@ -335,8 +333,7 @@  discard block
 block discarded – undo
335 333
 			{
336 334
 				$obj = $this->applyResultMap($row);
337 335
 				$key = TPropertyAccess::get($obj, $keyProperty);
338
-				$map[$key] = ($valueProperty === null) ? $obj :
339
-								TPropertyAccess::get($obj, $valueProperty);
336
+				$map[$key] = ($valueProperty === null) ? $obj : TPropertyAccess::get($obj, $valueProperty);
340 337
 			}
341 338
 		}
342 339
 		$this->onExecuteQuery($command);
@@ -932,15 +929,15 @@  discard block
 block discarded – undo
932 929
 
933 930
 	public function __wakeup()
934 931
 	{
935
-		if (null === $this->_selectQueue) $this->_selectQueue = [];
932
+		if(null === $this->_selectQueue) $this->_selectQueue = [];
936 933
 	}
937 934
 
938 935
 	public function __sleep()
939 936
 	{
940 937
 		$exprops = []; $cn = __CLASS__;
941
-		if (!count($this->_selectQueue)) $exprops[] = "\0$cn\0_selectQueue";
942
-		if (null === $this->_groupBy) $exprops[] = "\0$cn\0_groupBy";
943
-		if (!$this->_IsRowDataFound) $exprops[] = "\0$cn\0_IsRowDataFound";
938
+		if(!count($this->_selectQueue)) $exprops[] = "\0$cn\0_selectQueue";
939
+		if(null === $this->_groupBy) $exprops[] = "\0$cn\0_groupBy";
940
+		if(!$this->_IsRowDataFound) $exprops[] = "\0$cn\0_IsRowDataFound";
944 941
 		return array_diff(parent::__sleep(), $exprops);
945 942
 	}
946 943
 }
947 944
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlMappingConfiguration.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	protected function processSqlStatement($statement, $node)
260 260
 	{
261
-		$commandText = (string)$node;
261
+		$commandText = (string) $node;
262 262
 		if(strlen($extend = $statement->getExtends()) > 0)
263 263
 		{
264 264
 			$superNode = $this->getElementByIdValue($this->_document, '*', $extend);
265 265
 			if($superNode !== null)
266
-				$commandText = (string)$superNode . $commandText;
266
+				$commandText = (string) $superNode . $commandText;
267 267
 			else
268 268
 				throw new TSqlMapConfigurationException(
269 269
 						'sqlmap_unable_to_find_parent_sql', $extend, $this->_configFile, $node);
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 	protected function loadCacheModel($node)
432 432
 	{
433 433
 		$cacheModel = new TSqlMapCacheModel;
434
-		$properties = ['id','implementation'];
434
+		$properties = ['id', 'implementation'];
435 435
 		foreach($node->attributes() as $name => $value)
436 436
 		{
437 437
 			if(in_array(strtolower($name), $properties))
438
-				$cacheModel->{'set' . $name}((string)$value);
438
+				$cacheModel->{'set' . $name}((string) $value);
439 439
 		}
440 440
 		$cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
441 441
 		$this->setObjectPropFromNode($cache, $node, $properties);
@@ -476,19 +476,19 @@  discard block
 block discarded – undo
476 476
 			switch(strToLower($name))
477 477
 			{
478 478
 				case 'seconds':
479
-					$duration += (integer)$value;
479
+					$duration += (integer) $value;
480 480
 				break;
481 481
 				case 'minutes':
482
-					$duration += 60 * (integer)$value;
482
+					$duration += 60 * (integer) $value;
483 483
 				break;
484 484
 				case 'hours':
485
-					$duration += 3600 * (integer)$value;
485
+					$duration += 3600 * (integer) $value;
486 486
 				break;
487 487
 				case 'days':
488
-					$duration += 86400 * (integer)$value;
488
+					$duration += 86400 * (integer) $value;
489 489
 				break;
490 490
 				case 'duration':
491
-					$duration = (integer)$value;
491
+					$duration = (integer) $value;
492 492
 				break 2; // switch, foreach
493 493
 			}
494 494
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		foreach($node->attributes() as $name => $value)
510 510
 		{
511 511
 			if(strtolower($name) === 'statement')
512
-				$this->_FlushOnExecuteStatements[$id][] = (string)$value;
512
+				$this->_FlushOnExecuteStatements[$id][] = (string) $value;
513 513
 		}
514 514
 	}
515 515
 
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		if(isset($node['class']))
35 35
 		{
36
-			$obj = Prado::createComponent((string)$node['class']);
36
+			$obj = Prado::createComponent((string) $node['class']);
37 37
 			$this->setObjectPropFromNode($obj, $node, ['class']);
38 38
 			return $obj;
39 39
 		}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			if(!in_array($name, $except))
56 56
 			{
57 57
 				if($obj->canSetProperty($name))
58
-					$obj->{$name} = (string)$value;
58
+					$obj->{$name} = (string) $value;
59 59
 				else
60 60
 					throw new TSqlMapConfigurationException(
61 61
 						'sqlmap_invalid_property', $name, get_class($obj),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	protected function getElementByIdValue($document, $tag, $value)
106 106
 	{
107 107
 		//hack to allow upper case and lower case attribute names.
108
-		foreach(['id','ID','Id', 'iD'] as $id)
108
+		foreach(['id', 'ID', 'Id', 'iD'] as $id)
109 109
 		{
110 110
 			$xpath = "//{$tag}[@{$id}='{$value}']";
111 111
 			foreach($document->xpath($xpath) as $node)
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	protected function loadGlobalProperty($node)
92 92
 	{
93
-		$this->_properties[(string)$node['name']] = (string)$node['value'];
93
+		$this->_properties[(string) $node['name']] = (string) $node['value'];
94 94
 	}
95 95
 
96 96
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	protected function loadSqlMappingFiles($node)
121 121
 	{
122
-		if(strlen($resource = (string)$node['resource']) > 0)
122
+		if(strlen($resource = (string) $node['resource']) > 0)
123 123
 		{
124 124
 			if(strpos($resource, '${') !== false)
125 125
 				$resource = $this->replaceProperties($resource);
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TResultMap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@
 block discarded – undo
190 190
 		if(($disc = $this->getDiscriminator()) !== null)
191 191
 		{
192 192
 			$value = $disc->getMapping()->getPropertyValue($registry, $row);
193
-			$subMap = $disc->getSubMap((string)$value);
193
+			$subMap = $disc->getSubMap((string) $value);
194 194
 
195 195
 			if($subMap === null)
196 196
 				$subMap = $this;
Please login to merge, or discard this patch.
framework/Data/DataGateway/TDataGatewayCommand.php 1 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/DataGateway/TSqlCriteria.php 1 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/TDbConnection.php 1 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.