Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Data/SqlMap/Configuration/TParameterProperty.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -138,12 +138,24 @@
 block discarded – undo
138 138
 	public function __sleep()
139 139
 	{
140 140
 		$exprops = []; $cn = 'TParameterProperty';
141
-		if ($this->_typeHandler === null) $exprops[] = "\0$cn\0_typeHandler";
142
-		if ($this->_type === null) $exprops[] = "\0$cn\0_type";
143
-		if ($this->_column === null) $exprops[] = "\0$cn\0_column";
144
-		if ($this->_dbType === null) $exprops[] = "\0$cn\0_dbType";
145
-		if ($this->_property === null) $exprops[] = "\0$cn\0_property";
146
-		if ($this->_nullValue === null) $exprops[] = "\0$cn\0_nullValue";
141
+		if ($this->_typeHandler === null) {
142
+			$exprops[] = "\0$cn\0_typeHandler";
143
+		}
144
+		if ($this->_type === null) {
145
+			$exprops[] = "\0$cn\0_type";
146
+		}
147
+		if ($this->_column === null) {
148
+			$exprops[] = "\0$cn\0_column";
149
+		}
150
+		if ($this->_dbType === null) {
151
+			$exprops[] = "\0$cn\0_dbType";
152
+		}
153
+		if ($this->_property === null) {
154
+			$exprops[] = "\0$cn\0_property";
155
+		}
156
+		if ($this->_nullValue === null) {
157
+			$exprops[] = "\0$cn\0_nullValue";
158
+		}
147 159
 		return array_diff(parent::__sleep(), $exprops);
148 160
 	}
149 161
 }
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 		$matches = [];
35 35
 		$mappings = [];
36 36
 		preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches);
37
-		for($i = 0, $k = count($matches[1]); $i < $k; $i++)
37
+		for ($i = 0, $k = count($matches[1]); $i < $k; $i++)
38 38
 		{
39 39
 			$mappings[] = $matches[1][$i];
40 40
 			$sqlText = str_replace($matches[0][$i], self::DYNAMIC_TOKEN, $sqlText);
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlMappingConfiguration.php 2 patches
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -77,39 +77,39 @@  discard block
 block discarded – undo
77 77
 		$this->_document = $document;
78 78
 
79 79
 		static $bCacheDependencies;
80
-		if($bCacheDependencies === null)
80
+		if ($bCacheDependencies === null)
81 81
 			$bCacheDependencies = true; //Prado::getApplication()->getMode() !== TApplicationMode::Performance;
82 82
 
83
-		if($bCacheDependencies)
83
+		if ($bCacheDependencies)
84 84
 			$this->_manager->getCacheDependencies()
85 85
 					->getDependencies()
86 86
 					->add(new TFileCacheDependency($filename));
87 87
 
88
-		foreach($document->xpath('//resultMap') as $node)
88
+		foreach ($document->xpath('//resultMap') as $node)
89 89
 			$this->loadResultMap($node);
90 90
 
91
-		foreach($document->xpath('//parameterMap') as $node)
91
+		foreach ($document->xpath('//parameterMap') as $node)
92 92
 			$this->loadParameterMap($node);
93 93
 
94
-		foreach($document->xpath('//statement') as $node)
94
+		foreach ($document->xpath('//statement') as $node)
95 95
 			$this->loadStatementTag($node);
96 96
 
97
-		foreach($document->xpath('//select') as $node)
97
+		foreach ($document->xpath('//select') as $node)
98 98
 			$this->loadSelectTag($node);
99 99
 
100
-		foreach($document->xpath('//insert') as $node)
100
+		foreach ($document->xpath('//insert') as $node)
101 101
 			$this->loadInsertTag($node);
102 102
 
103
-		foreach($document->xpath('//update') as $node)
103
+		foreach ($document->xpath('//update') as $node)
104 104
 			$this->loadUpdateTag($node);
105 105
 
106
-		foreach($document->xpath('//delete') as $node)
106
+		foreach ($document->xpath('//delete') as $node)
107 107
 			$this->loadDeleteTag($node);
108 108
 
109
-		foreach($document->xpath('//procedure') as $node)
109
+		foreach ($document->xpath('//procedure') as $node)
110 110
 			$this->loadProcedureTag($node);
111 111
 
112
-		foreach($document->xpath('//cacheModel') as $node)
112
+		foreach ($document->xpath('//cacheModel') as $node)
113 113
 				$this->loadCacheModel($node);
114 114
 
115 115
 		$this->registerCacheTriggers();
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 		$resultMap = $this->createResultMap($node);
125 125
 
126 126
 		//find extended result map.
127
-		if(strlen($extendMap = $resultMap->getExtends()) > 0)
127
+		if (strlen($extendMap = $resultMap->getExtends()) > 0)
128 128
 		{
129
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
129
+			if (!$this->_manager->getResultMaps()->contains($extendMap))
130 130
 			{
131 131
 				$extendNode = $this->getElementByIdValue($this->_document, 'resultMap', $extendMap);
132
-				if($extendNode !== null)
132
+				if ($extendNode !== null)
133 133
 					$this->loadResultMap($extendNode);
134 134
 			}
135 135
 
136
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
136
+			if (!$this->_manager->getResultMaps()->contains($extendMap))
137 137
 				throw new TSqlMapConfigurationException(
138 138
 					'sqlmap_unable_to_find_parent_result_map', $node, $this->_configFile, $extendMap);
139 139
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		}
143 143
 
144 144
 		//add the result map
145
-		if(!$this->_manager->getResultMaps()->contains($resultMap->getID()))
145
+		if (!$this->_manager->getResultMaps()->contains($resultMap->getID()))
146 146
 			$this->_manager->addResultMap($resultMap);
147 147
 	}
148 148
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		$this->setObjectPropFromNode($resultMap, $node);
159 159
 
160 160
 		//result nodes
161
-		foreach($node->result as $result)
161
+		foreach ($node->result as $result)
162 162
 		{
163 163
 			$property = new TResultProperty($resultMap);
164 164
 			$this->setObjectPropFromNode($property, $result);
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 
168 168
 		//create the discriminator
169 169
 		$discriminator = null;
170
-		if(isset($node->discriminator))
170
+		if (isset($node->discriminator))
171 171
 		{
172 172
 			$discriminator = new TDiscriminator();
173 173
 			$this->setObjectPropFromNode($discriminator, $node->discriminator);
174 174
 			$discriminator->initMapping($resultMap);
175 175
 		}
176 176
 
177
-		foreach($node->xpath('subMap') as $subMapNode)
177
+		foreach ($node->xpath('subMap') as $subMapNode)
178 178
 		{
179
-			if($discriminator === null)
179
+			if ($discriminator === null)
180 180
 				throw new TSqlMapConfigurationException(
181 181
 					'sqlmap_undefined_discriminator', $node, $this->_configFile, $subMapNode);
182 182
 			$subMap = new TSubMap;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			$discriminator->addSubMap($subMap);
185 185
 		}
186 186
 
187
-		if($discriminator !== null)
187
+		if ($discriminator !== null)
188 188
 			$resultMap->setDiscriminator($discriminator);
189 189
 
190 190
 		return $resultMap;
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
 	{
200 200
 		$parameterMap = $this->createParameterMap($node);
201 201
 
202
-		if(strlen($extendMap = $parameterMap->getExtends()) > 0)
202
+		if (strlen($extendMap = $parameterMap->getExtends()) > 0)
203 203
 		{
204
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
204
+			if (!$this->_manager->getParameterMaps()->contains($extendMap))
205 205
 			{
206 206
 				$extendNode = $this->getElementByIdValue($this->_document, 'parameterMap', $extendMap);
207
-				if($extendNode !== null)
207
+				if ($extendNode !== null)
208 208
 					$this->loadParameterMap($extendNode);
209 209
 			}
210 210
 
211
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
211
+			if (!$this->_manager->getParameterMaps()->contains($extendMap))
212 212
 				throw new TSqlMapConfigurationException(
213 213
 					'sqlmap_unable_to_find_parent_parameter_map', $node, $this->_configFile, $extendMap);
214 214
 			$superMap = $this->_manager->getParameterMap($extendMap);
215 215
 			$index = 0;
216
-			foreach($superMap->getPropertyNames() as $propertyName)
216
+			foreach ($superMap->getPropertyNames() as $propertyName)
217 217
 				$parameterMap->insertProperty($index++, $superMap->getProperty($propertyName));
218 218
 		}
219 219
 		$this->_manager->addParameterMap($parameterMap);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	{
229 229
 		$parameterMap = new TParameterMap();
230 230
 		$this->setObjectPropFromNode($parameterMap, $node);
231
-		foreach($node->parameter as $parameter)
231
+		foreach ($node->parameter as $parameter)
232 232
 		{
233 233
 			$property = new TParameterProperty();
234 234
 			$this->setObjectPropFromNode($property, $parameter);
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	protected function processSqlStatement($statement, $node)
260 260
 	{
261
-		$commandText = (string)$node;
262
-		if(strlen($extend = $statement->getExtends()) > 0)
261
+		$commandText = (string) $node;
262
+		if (strlen($extend = $statement->getExtends()) > 0)
263 263
 		{
264 264
 			$superNode = $this->getElementByIdValue($this->_document, '*', $extend);
265
-			if($superNode !== null)
266
-				$commandText = (string)$superNode . $commandText;
265
+			if ($superNode !== null)
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);
@@ -285,23 +285,23 @@  discard block
 block discarded – undo
285 285
 		$scope['node'] = $node;
286 286
 
287 287
 		$sqlStatement = preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP, self::INLINE_PLACEHOLDER, $sqlStatement);
288
-		if($statement->parameterMap() === null)
288
+		if ($statement->parameterMap() === null)
289 289
 		{
290 290
 			// Build a Parametermap with the inline parameters.
291 291
 			// if they exist. Then delete inline infos from sqltext.
292 292
 			$parameterParser = new TInlineParameterMapParser;
293 293
 			$sqlText = $parameterParser->parse($sqlStatement, $scope);
294
-			if(count($sqlText['parameters']) > 0)
294
+			if (count($sqlText['parameters']) > 0)
295 295
 			{
296 296
 				$map = new TParameterMap();
297
-				$map->setID($statement->getID() . '-InLineParameterMap');
297
+				$map->setID($statement->getID().'-InLineParameterMap');
298 298
 				$statement->setInlineParameterMap($map);
299
-				foreach($sqlText['parameters'] as $property)
299
+				foreach ($sqlText['parameters'] as $property)
300 300
 					$map->addProperty($property);
301 301
 			}
302 302
 			$sqlStatement = $sqlText['sql'];
303 303
 		}
304
-		$sqlStatement = preg_replace('/' . self::INLINE_PLACEHOLDER . '/', self::INLINE_SYMBOL, $sqlStatement);
304
+		$sqlStatement = preg_replace('/'.self::INLINE_PLACEHOLDER.'/', self::INLINE_SYMBOL, $sqlStatement);
305 305
 
306 306
 		$this->prepareSql($statement, $sqlStatement, $node);
307 307
 	}
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 		$simpleDynamic = new TSimpleDynamicParser;
319 319
 		$sqlStatement = preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP, self::SIMPLE_PLACEHOLDER, $sqlStatement);
320 320
 		$dynamics = $simpleDynamic->parse($sqlStatement);
321
-		if(count($dynamics['parameters']) > 0)
321
+		if (count($dynamics['parameters']) > 0)
322 322
 		{
323 323
 			$sql = new TSimpleDynamicSql($dynamics['parameters']);
324 324
 			$sqlStatement = $dynamics['sql'];
325 325
 		}
326 326
 		else
327 327
 			$sql = new TStaticSql();
328
-		$sqlStatement = preg_replace('/' . self::SIMPLE_PLACEHOLDER . '/', self::SIMPLE_MARK, $sqlStatement);
328
+		$sqlStatement = preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/', self::SIMPLE_MARK, $sqlStatement);
329 329
 		$sql->buildPreparedStatement($statement, $sqlStatement);
330 330
 		$statement->setSqlText($sql);
331 331
 	}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 		$this->setObjectPropFromNode($select, $node);
341 341
 		$this->processSqlStatement($select, $node);
342 342
 		$mappedStatement = new TMappedStatement($this->_manager, $select);
343
-		if(strlen($select->getCacheModel()) > 0)
343
+		if (strlen($select->getCacheModel()) > 0)
344 344
 			$mappedStatement = new TCachingStatement($mappedStatement);
345 345
 
346 346
 		$this->_manager->addMappedStatement($mappedStatement);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	{
368 368
 		$insert = new TSqlMapInsert;
369 369
 		$this->setObjectPropFromNode($insert, $node);
370
-		if(isset($node->selectKey))
370
+		if (isset($node->selectKey))
371 371
 			$this->loadSelectKeyTag($insert, $node->selectKey);
372 372
 		return $insert;
373 373
 	}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		$selectKey = new TSqlMapSelectKey;
382 382
 		$this->setObjectPropFromNode($selectKey, $node);
383 383
 		$selectKey->setID($insert->getID());
384
-		$selectKey->setID($insert->getID() . '.SelectKey');
384
+		$selectKey->setID($insert->getID().'.SelectKey');
385 385
 		$this->processSqlStatement($selectKey, $node);
386 386
 		$insert->setSelectKey($selectKey);
387 387
 		$mappedStatement = new TMappedStatement($this->_manager, $selectKey);
@@ -431,24 +431,24 @@  discard block
 block discarded – undo
431 431
 	protected function loadCacheModel($node)
432 432
 	{
433 433
 		$cacheModel = new TSqlMapCacheModel;
434
-		$properties = ['id','implementation'];
435
-		foreach($node->attributes() as $name => $value)
434
+		$properties = ['id', 'implementation'];
435
+		foreach ($node->attributes() as $name => $value)
436 436
 		{
437
-			if(in_array(strtolower($name), $properties))
438
-				$cacheModel->{'set' . $name}((string)$value);
437
+			if (in_array(strtolower($name), $properties))
438
+				$cacheModel->{'set'.$name}((string) $value);
439 439
 		}
440 440
 		$cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
441 441
 		$this->setObjectPropFromNode($cache, $node, $properties);
442 442
 
443
-		foreach($node->xpath('property') as $propertyNode)
443
+		foreach ($node->xpath('property') as $propertyNode)
444 444
 		{
445 445
 			$name = $propertyNode->attributes()->name;
446
-			if($name === null || $name === '') continue;
446
+			if ($name === null || $name === '') continue;
447 447
 
448 448
 			$value = $propertyNode->attributes()->value;
449
-			if($value === null || $value === '') continue;
449
+			if ($value === null || $value === '') continue;
450 450
 
451
-			if(!TPropertyAccess::has($cache, $name)) continue;
451
+			if (!TPropertyAccess::has($cache, $name)) continue;
452 452
 
453 453
 			TPropertyAccess::set($cache, $name, $value);
454 454
 		}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 
458 458
 		$cacheModel->initialize($cache);
459 459
 		$this->_manager->addCacheModel($cacheModel);
460
-		foreach($node->xpath('flushOnExecute') as $flush)
460
+		foreach ($node->xpath('flushOnExecute') as $flush)
461 461
 			$this->loadFlushOnCache($cacheModel, $node, $flush);
462 462
 	}
463 463
 
@@ -469,26 +469,26 @@  discard block
 block discarded – undo
469 469
 	protected function loadFlushInterval($cacheModel, $node)
470 470
 	{
471 471
 		$flushInterval = $node->xpath('flushInterval');
472
-		if($flushInterval === null || count($flushInterval) === 0) return;
472
+		if ($flushInterval === null || count($flushInterval) === 0) return;
473 473
 		$duration = 0;
474
-		foreach($flushInterval[0]->attributes() as $name => $value)
474
+		foreach ($flushInterval[0]->attributes() as $name => $value)
475 475
 		{
476
-			switch(strToLower($name))
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
 		}
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 	protected function loadFlushOnCache($cacheModel, $parent, $node)
505 505
 	{
506 506
 		$id = $cacheModel->getID();
507
-		if(!isset($this->_FlushOnExecuteStatements[$id]))
507
+		if (!isset($this->_FlushOnExecuteStatements[$id]))
508 508
 			$this->_FlushOnExecuteStatements[$id] = [];
509
-		foreach($node->attributes() as $name => $value)
509
+		foreach ($node->attributes() as $name => $value)
510 510
 		{
511
-			if(strtolower($name) === 'statement')
512
-				$this->_FlushOnExecuteStatements[$id][] = (string)$value;
511
+			if (strtolower($name) === 'statement')
512
+				$this->_FlushOnExecuteStatements[$id][] = (string) $value;
513 513
 		}
514 514
 	}
515 515
 
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 	 */
519 519
 	protected function registerCacheTriggers()
520 520
 	{
521
-		foreach($this->_FlushOnExecuteStatements as $cacheID => $statementIDs)
521
+		foreach ($this->_FlushOnExecuteStatements as $cacheID => $statementIDs)
522 522
 		{
523 523
 			$cacheModel = $this->_manager->getCacheModel($cacheID);
524
-			foreach($statementIDs as $statementID)
524
+			foreach ($statementIDs as $statementID)
525 525
 			{
526 526
 				$statement = $this->_manager->getMappedStatement($statementID);
527 527
 				$cacheModel->registerTriggerStatement($statement);
Please login to merge, or discard this patch.
Braces   +98 added lines, -62 removed lines patch added patch discarded remove patch
@@ -77,40 +77,52 @@  discard block
 block discarded – undo
77 77
 		$this->_document = $document;
78 78
 
79 79
 		static $bCacheDependencies;
80
-		if($bCacheDependencies === null)
81
-			$bCacheDependencies = true; //Prado::getApplication()->getMode() !== TApplicationMode::Performance;
80
+		if($bCacheDependencies === null) {
81
+					$bCacheDependencies = true;
82
+		}
83
+		//Prado::getApplication()->getMode() !== TApplicationMode::Performance;
82 84
 
83
-		if($bCacheDependencies)
84
-			$this->_manager->getCacheDependencies()
85
+		if($bCacheDependencies) {
86
+					$this->_manager->getCacheDependencies()
85 87
 					->getDependencies()
86 88
 					->add(new TFileCacheDependency($filename));
89
+		}
87 90
 
88
-		foreach($document->xpath('//resultMap') as $node)
89
-			$this->loadResultMap($node);
91
+		foreach($document->xpath('//resultMap') as $node) {
92
+					$this->loadResultMap($node);
93
+		}
90 94
 
91
-		foreach($document->xpath('//parameterMap') as $node)
92
-			$this->loadParameterMap($node);
95
+		foreach($document->xpath('//parameterMap') as $node) {
96
+					$this->loadParameterMap($node);
97
+		}
93 98
 
94
-		foreach($document->xpath('//statement') as $node)
95
-			$this->loadStatementTag($node);
99
+		foreach($document->xpath('//statement') as $node) {
100
+					$this->loadStatementTag($node);
101
+		}
96 102
 
97
-		foreach($document->xpath('//select') as $node)
98
-			$this->loadSelectTag($node);
103
+		foreach($document->xpath('//select') as $node) {
104
+					$this->loadSelectTag($node);
105
+		}
99 106
 
100
-		foreach($document->xpath('//insert') as $node)
101
-			$this->loadInsertTag($node);
107
+		foreach($document->xpath('//insert') as $node) {
108
+					$this->loadInsertTag($node);
109
+		}
102 110
 
103
-		foreach($document->xpath('//update') as $node)
104
-			$this->loadUpdateTag($node);
111
+		foreach($document->xpath('//update') as $node) {
112
+					$this->loadUpdateTag($node);
113
+		}
105 114
 
106
-		foreach($document->xpath('//delete') as $node)
107
-			$this->loadDeleteTag($node);
115
+		foreach($document->xpath('//delete') as $node) {
116
+					$this->loadDeleteTag($node);
117
+		}
108 118
 
109
-		foreach($document->xpath('//procedure') as $node)
110
-			$this->loadProcedureTag($node);
119
+		foreach($document->xpath('//procedure') as $node) {
120
+					$this->loadProcedureTag($node);
121
+		}
111 122
 
112
-		foreach($document->xpath('//cacheModel') as $node)
113
-				$this->loadCacheModel($node);
123
+		foreach($document->xpath('//cacheModel') as $node) {
124
+						$this->loadCacheModel($node);
125
+		}
114 126
 
115 127
 		$this->registerCacheTriggers();
116 128
 	}
@@ -129,21 +141,24 @@  discard block
 block discarded – undo
129 141
 			if(!$this->_manager->getResultMaps()->contains($extendMap))
130 142
 			{
131 143
 				$extendNode = $this->getElementByIdValue($this->_document, 'resultMap', $extendMap);
132
-				if($extendNode !== null)
133
-					$this->loadResultMap($extendNode);
144
+				if($extendNode !== null) {
145
+									$this->loadResultMap($extendNode);
146
+				}
134 147
 			}
135 148
 
136
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
137
-				throw new TSqlMapConfigurationException(
149
+			if(!$this->_manager->getResultMaps()->contains($extendMap)) {
150
+							throw new TSqlMapConfigurationException(
138 151
 					'sqlmap_unable_to_find_parent_result_map', $node, $this->_configFile, $extendMap);
152
+			}
139 153
 
140 154
 			$superMap = $this->_manager->getResultMap($extendMap);
141 155
 			$resultMap->getColumns()->mergeWith($superMap->getColumns());
142 156
 		}
143 157
 
144 158
 		//add the result map
145
-		if(!$this->_manager->getResultMaps()->contains($resultMap->getID()))
146
-			$this->_manager->addResultMap($resultMap);
159
+		if(!$this->_manager->getResultMaps()->contains($resultMap->getID())) {
160
+					$this->_manager->addResultMap($resultMap);
161
+		}
147 162
 	}
148 163
 
149 164
 	/**
@@ -176,16 +191,18 @@  discard block
 block discarded – undo
176 191
 
177 192
 		foreach($node->xpath('subMap') as $subMapNode)
178 193
 		{
179
-			if($discriminator === null)
180
-				throw new TSqlMapConfigurationException(
194
+			if($discriminator === null) {
195
+							throw new TSqlMapConfigurationException(
181 196
 					'sqlmap_undefined_discriminator', $node, $this->_configFile, $subMapNode);
197
+			}
182 198
 			$subMap = new TSubMap;
183 199
 			$this->setObjectPropFromNode($subMap, $subMapNode);
184 200
 			$discriminator->addSubMap($subMap);
185 201
 		}
186 202
 
187
-		if($discriminator !== null)
188
-			$resultMap->setDiscriminator($discriminator);
203
+		if($discriminator !== null) {
204
+					$resultMap->setDiscriminator($discriminator);
205
+		}
189 206
 
190 207
 		return $resultMap;
191 208
 	}
@@ -204,17 +221,20 @@  discard block
 block discarded – undo
204 221
 			if(!$this->_manager->getParameterMaps()->contains($extendMap))
205 222
 			{
206 223
 				$extendNode = $this->getElementByIdValue($this->_document, 'parameterMap', $extendMap);
207
-				if($extendNode !== null)
208
-					$this->loadParameterMap($extendNode);
224
+				if($extendNode !== null) {
225
+									$this->loadParameterMap($extendNode);
226
+				}
209 227
 			}
210 228
 
211
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
212
-				throw new TSqlMapConfigurationException(
229
+			if(!$this->_manager->getParameterMaps()->contains($extendMap)) {
230
+							throw new TSqlMapConfigurationException(
213 231
 					'sqlmap_unable_to_find_parent_parameter_map', $node, $this->_configFile, $extendMap);
232
+			}
214 233
 			$superMap = $this->_manager->getParameterMap($extendMap);
215 234
 			$index = 0;
216
-			foreach($superMap->getPropertyNames() as $propertyName)
217
-				$parameterMap->insertProperty($index++, $superMap->getProperty($propertyName));
235
+			foreach($superMap->getPropertyNames() as $propertyName) {
236
+							$parameterMap->insertProperty($index++, $superMap->getProperty($propertyName));
237
+			}
218 238
 		}
219 239
 		$this->_manager->addParameterMap($parameterMap);
220 240
 	}
@@ -262,11 +282,12 @@  discard block
 block discarded – undo
262 282
 		if(strlen($extend = $statement->getExtends()) > 0)
263 283
 		{
264 284
 			$superNode = $this->getElementByIdValue($this->_document, '*', $extend);
265
-			if($superNode !== null)
266
-				$commandText = (string)$superNode . $commandText;
267
-			else
268
-				throw new TSqlMapConfigurationException(
285
+			if($superNode !== null) {
286
+							$commandText = (string)$superNode . $commandText;
287
+			} else {
288
+							throw new TSqlMapConfigurationException(
269 289
 						'sqlmap_unable_to_find_parent_sql', $extend, $this->_configFile, $node);
290
+			}
270 291
 		}
271 292
 		//$commandText = $this->_xmlConfig->replaceProperties($commandText);
272 293
 		$statement->initialize($this->_manager);
@@ -296,8 +317,9 @@  discard block
 block discarded – undo
296 317
 				$map = new TParameterMap();
297 318
 				$map->setID($statement->getID() . '-InLineParameterMap');
298 319
 				$statement->setInlineParameterMap($map);
299
-				foreach($sqlText['parameters'] as $property)
300
-					$map->addProperty($property);
320
+				foreach($sqlText['parameters'] as $property) {
321
+									$map->addProperty($property);
322
+				}
301 323
 			}
302 324
 			$sqlStatement = $sqlText['sql'];
303 325
 		}
@@ -322,9 +344,9 @@  discard block
 block discarded – undo
322 344
 		{
323 345
 			$sql = new TSimpleDynamicSql($dynamics['parameters']);
324 346
 			$sqlStatement = $dynamics['sql'];
347
+		} else {
348
+					$sql = new TStaticSql();
325 349
 		}
326
-		else
327
-			$sql = new TStaticSql();
328 350
 		$sqlStatement = preg_replace('/' . self::SIMPLE_PLACEHOLDER . '/', self::SIMPLE_MARK, $sqlStatement);
329 351
 		$sql->buildPreparedStatement($statement, $sqlStatement);
330 352
 		$statement->setSqlText($sql);
@@ -340,8 +362,9 @@  discard block
 block discarded – undo
340 362
 		$this->setObjectPropFromNode($select, $node);
341 363
 		$this->processSqlStatement($select, $node);
342 364
 		$mappedStatement = new TMappedStatement($this->_manager, $select);
343
-		if(strlen($select->getCacheModel()) > 0)
344
-			$mappedStatement = new TCachingStatement($mappedStatement);
365
+		if(strlen($select->getCacheModel()) > 0) {
366
+					$mappedStatement = new TCachingStatement($mappedStatement);
367
+		}
345 368
 
346 369
 		$this->_manager->addMappedStatement($mappedStatement);
347 370
 	}
@@ -367,8 +390,9 @@  discard block
 block discarded – undo
367 390
 	{
368 391
 		$insert = new TSqlMapInsert;
369 392
 		$this->setObjectPropFromNode($insert, $node);
370
-		if(isset($node->selectKey))
371
-			$this->loadSelectKeyTag($insert, $node->selectKey);
393
+		if(isset($node->selectKey)) {
394
+					$this->loadSelectKeyTag($insert, $node->selectKey);
395
+		}
372 396
 		return $insert;
373 397
 	}
374 398
 
@@ -434,8 +458,9 @@  discard block
 block discarded – undo
434 458
 		$properties = ['id','implementation'];
435 459
 		foreach($node->attributes() as $name => $value)
436 460
 		{
437
-			if(in_array(strtolower($name), $properties))
438
-				$cacheModel->{'set' . $name}((string)$value);
461
+			if(in_array(strtolower($name), $properties)) {
462
+							$cacheModel->{'set' . $name}((string)$value);
463
+			}
439 464
 		}
440 465
 		$cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
441 466
 		$this->setObjectPropFromNode($cache, $node, $properties);
@@ -443,12 +468,18 @@  discard block
 block discarded – undo
443 468
 		foreach($node->xpath('property') as $propertyNode)
444 469
 		{
445 470
 			$name = $propertyNode->attributes()->name;
446
-			if($name === null || $name === '') continue;
471
+			if($name === null || $name === '') {
472
+				continue;
473
+			}
447 474
 
448 475
 			$value = $propertyNode->attributes()->value;
449
-			if($value === null || $value === '') continue;
476
+			if($value === null || $value === '') {
477
+				continue;
478
+			}
450 479
 
451
-			if(!TPropertyAccess::has($cache, $name)) continue;
480
+			if(!TPropertyAccess::has($cache, $name)) {
481
+				continue;
482
+			}
452 483
 
453 484
 			TPropertyAccess::set($cache, $name, $value);
454 485
 		}
@@ -457,8 +488,9 @@  discard block
 block discarded – undo
457 488
 
458 489
 		$cacheModel->initialize($cache);
459 490
 		$this->_manager->addCacheModel($cacheModel);
460
-		foreach($node->xpath('flushOnExecute') as $flush)
461
-			$this->loadFlushOnCache($cacheModel, $node, $flush);
491
+		foreach($node->xpath('flushOnExecute') as $flush) {
492
+					$this->loadFlushOnCache($cacheModel, $node, $flush);
493
+		}
462 494
 	}
463 495
 
464 496
 	/**
@@ -469,7 +501,9 @@  discard block
 block discarded – undo
469 501
 	protected function loadFlushInterval($cacheModel, $node)
470 502
 	{
471 503
 		$flushInterval = $node->xpath('flushInterval');
472
-		if($flushInterval === null || count($flushInterval) === 0) return;
504
+		if($flushInterval === null || count($flushInterval) === 0) {
505
+			return;
506
+		}
473 507
 		$duration = 0;
474 508
 		foreach($flushInterval[0]->attributes() as $name => $value)
475 509
 		{
@@ -504,12 +538,14 @@  discard block
 block discarded – undo
504 538
 	protected function loadFlushOnCache($cacheModel, $parent, $node)
505 539
 	{
506 540
 		$id = $cacheModel->getID();
507
-		if(!isset($this->_FlushOnExecuteStatements[$id]))
508
-			$this->_FlushOnExecuteStatements[$id] = [];
541
+		if(!isset($this->_FlushOnExecuteStatements[$id])) {
542
+					$this->_FlushOnExecuteStatements[$id] = [];
543
+		}
509 544
 		foreach($node->attributes() as $name => $value)
510 545
 		{
511
-			if(strtolower($name) === 'statement')
512
-				$this->_FlushOnExecuteStatements[$id][] = (string)$value;
546
+			if(strtolower($name) === 'statement') {
547
+							$this->_FlushOnExecuteStatements[$id][] = (string)$value;
548
+			}
513 549
 		}
514 550
 	}
515 551
 
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 		$this->_configFile = $filename;
65 65
 		$document = $this->loadXmlDocument($filename, $this);
66 66
 
67
-		foreach($document->xpath('//property') as $property)
67
+		foreach ($document->xpath('//property') as $property)
68 68
 			$this->loadGlobalProperty($property);
69 69
 
70
-		foreach($document->xpath('//typeHandler') as $handler)
70
+		foreach ($document->xpath('//typeHandler') as $handler)
71 71
 			$this->loadTypeHandler($handler);
72 72
 
73
-		foreach($document->xpath('//connection[last()]') as $conn)
73
+		foreach ($document->xpath('//connection[last()]') as $conn)
74 74
 			$this->loadDatabaseConnection($conn);
75 75
 
76 76
 		//try to load configuration in the current config file.
77 77
 		$mapping = new TSqlMapXmlMappingConfiguration($this);
78 78
 		$mapping->configure($filename);
79 79
 
80
-		foreach($document->xpath('//sqlMap') as $sqlmap)
80
+		foreach ($document->xpath('//sqlMap') as $sqlmap)
81 81
 			$this->loadSqlMappingFiles($sqlmap);
82 82
 
83 83
 		$this->resolveResultMapping();
@@ -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,9 +119,9 @@  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
-			if(strpos($resource, '${') !== false)
124
+			if (strpos($resource, '${') !== false)
125 125
 				$resource = $this->replaceProperties($resource);
126 126
 
127 127
 			$mapping = new TSqlMapXmlMappingConfiguration($this);
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	protected function resolveResultMapping()
137 137
 	{
138 138
 		$maps = $this->_manager->getResultMaps();
139
-		foreach($maps as $entry)
139
+		foreach ($maps as $entry)
140 140
 		{
141
-			foreach($entry->getColumns() as $item)
141
+			foreach ($entry->getColumns() as $item)
142 142
 			{
143 143
 				$resultMap = $item->getResultMapping();
144
-				if(strlen($resultMap) > 0)
144
+				if (strlen($resultMap) > 0)
145 145
 				{
146
-					if($maps->contains($resultMap))
146
+					if ($maps->contains($resultMap))
147 147
 						$item->setNestedResultMap($maps[$resultMap]);
148 148
 					else
149 149
 						throw new TSqlMapConfigurationException(
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 								$resultMap, $this->_configFile, $entry->getID());
152 152
 				}
153 153
 			}
154
-			if($entry->getDiscriminator() !== null)
154
+			if ($entry->getDiscriminator() !== null)
155 155
 				$entry->getDiscriminator()->initialize($this->_manager);
156 156
 		}
157 157
 	}
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function attachCacheModels()
163 163
 	{
164
-		foreach($this->_manager->getMappedStatements() as $mappedStatement)
164
+		foreach ($this->_manager->getMappedStatements() as $mappedStatement)
165 165
 		{
166
-			if(strlen($model = $mappedStatement->getStatement()->getCacheModel()) > 0)
166
+			if (strlen($model = $mappedStatement->getStatement()->getCacheModel()) > 0)
167 167
 			{
168 168
 				$cache = $this->_manager->getCacheModel($model);
169 169
 				$mappedStatement->getStatement()->setCache($cache);
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function replaceProperties($string)
181 181
 	{
182
-		foreach($this->_properties as $find => $replace)
183
-			$string = str_replace('${' . $find . '}', $replace, $string);
182
+		foreach ($this->_properties as $find => $replace)
183
+			$string = str_replace('${'.$find.'}', $replace, $string);
184 184
 		return $string;
185 185
 	}
186 186
 }
187 187
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -64,21 +64,25 @@  discard block
 block discarded – undo
64 64
 		$this->_configFile = $filename;
65 65
 		$document = $this->loadXmlDocument($filename, $this);
66 66
 
67
-		foreach($document->xpath('//property') as $property)
68
-			$this->loadGlobalProperty($property);
67
+		foreach($document->xpath('//property') as $property) {
68
+					$this->loadGlobalProperty($property);
69
+		}
69 70
 
70
-		foreach($document->xpath('//typeHandler') as $handler)
71
-			$this->loadTypeHandler($handler);
71
+		foreach($document->xpath('//typeHandler') as $handler) {
72
+					$this->loadTypeHandler($handler);
73
+		}
72 74
 
73
-		foreach($document->xpath('//connection[last()]') as $conn)
74
-			$this->loadDatabaseConnection($conn);
75
+		foreach($document->xpath('//connection[last()]') as $conn) {
76
+					$this->loadDatabaseConnection($conn);
77
+		}
75 78
 
76 79
 		//try to load configuration in the current config file.
77 80
 		$mapping = new TSqlMapXmlMappingConfiguration($this);
78 81
 		$mapping->configure($filename);
79 82
 
80
-		foreach($document->xpath('//sqlMap') as $sqlmap)
81
-			$this->loadSqlMappingFiles($sqlmap);
83
+		foreach($document->xpath('//sqlMap') as $sqlmap) {
84
+					$this->loadSqlMappingFiles($sqlmap);
85
+		}
82 86
 
83 87
 		$this->resolveResultMapping();
84 88
 		$this->attachCacheModels();
@@ -121,8 +125,9 @@  discard block
 block discarded – undo
121 125
 	{
122 126
 		if(strlen($resource = (string)$node['resource']) > 0)
123 127
 		{
124
-			if(strpos($resource, '${') !== false)
125
-				$resource = $this->replaceProperties($resource);
128
+			if(strpos($resource, '${') !== false) {
129
+							$resource = $this->replaceProperties($resource);
130
+			}
126 131
 
127 132
 			$mapping = new TSqlMapXmlMappingConfiguration($this);
128 133
 			$filename = $this->getAbsoluteFilePath($this->_configFile, $resource);
@@ -143,16 +148,18 @@  discard block
 block discarded – undo
143 148
 				$resultMap = $item->getResultMapping();
144 149
 				if(strlen($resultMap) > 0)
145 150
 				{
146
-					if($maps->contains($resultMap))
147
-						$item->setNestedResultMap($maps[$resultMap]);
148
-					else
149
-						throw new TSqlMapConfigurationException(
151
+					if($maps->contains($resultMap)) {
152
+											$item->setNestedResultMap($maps[$resultMap]);
153
+					} else {
154
+											throw new TSqlMapConfigurationException(
150 155
 							'sqlmap_unable_to_find_result_mapping',
151 156
 								$resultMap, $this->_configFile, $entry->getID());
157
+					}
152 158
 				}
153 159
 			}
154
-			if($entry->getDiscriminator() !== null)
155
-				$entry->getDiscriminator()->initialize($this->_manager);
160
+			if($entry->getDiscriminator() !== null) {
161
+							$entry->getDiscriminator()->initialize($this->_manager);
162
+			}
156 163
 		}
157 164
 	}
158 165
 
@@ -179,8 +186,9 @@  discard block
 block discarded – undo
179 186
 	 */
180 187
 	public function replaceProperties($string)
181 188
 	{
182
-		foreach($this->_properties as $find => $replace)
183
-			$string = str_replace('${' . $find . '}', $replace, $string);
189
+		foreach($this->_properties as $find => $replace) {
190
+					$string = str_replace('${' . $find . '}', $replace, $string);
191
+		}
184 192
 		return $string;
185 193
 	}
186 194
 }
187 195
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function initialize($cache = null)
111 111
 	{
112
-		if($cache === null)
112
+		if ($cache === null)
113 113
 			$this->_cache = Prado::createComponent($this->getImplementationClass(), $this);
114 114
 		else
115 115
 			$this->_cache = $cache;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		$implementation = $this->_implementation;
124 124
 		if (isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
125 125
 
126
-		switch(TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
126
+		switch (TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
127 127
 		{
128 128
 			case TSqlMapCacheTypes::FIFO: return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapFifoCache';
129 129
 			case TSqlMapCacheTypes::LRU : return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapLruCache';
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function get($key)
156 156
 	{
157
-		if($key instanceof TSqlMapCacheKey)
157
+		if ($key instanceof TSqlMapCacheKey)
158 158
 			$key = $key->getHash();
159 159
 
160 160
 		//if flush ?
161 161
 		$value = $this->_cache->get($key);
162 162
 		$this->_requests++;
163
-		if($value !== null)
163
+		if ($value !== null)
164 164
 			$this->_hits++;
165 165
 		return $value;
166 166
 	}
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function set($key, $value)
173 173
 	{
174
-		if($key instanceof TSqlMapCacheKey)
174
+		if ($key instanceof TSqlMapCacheKey)
175 175
 			$key = $key->getHash();
176 176
 
177
-		if($value !== null)
177
+		if ($value !== null)
178 178
 			$this->_cache->set($key, $value, $this->_flushInterval);
179 179
 	}
180 180
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function getHitRatio()
185 185
 	{
186
-		if($this->_requests != 0)
186
+		if ($this->_requests != 0)
187 187
 			return $this->_hits / $this->_requests;
188 188
 		else
189 189
 			return 0;
Please login to merge, or discard this patch.
Braces   +30 added lines, -21 removed lines patch added patch discarded remove patch
@@ -81,10 +81,11 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function setImplementation($value)
83 83
 	{
84
-		if (isset(self::$_cacheTypes[$value]))
85
-			$this->_implementation = $value;
86
-		else
87
-			$this->_implementation = TPropertyValue::ensureEnum($value, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
84
+		if (isset(self::$_cacheTypes[$value])) {
85
+					$this->_implementation = $value;
86
+		} else {
87
+					$this->_implementation = TPropertyValue::ensureEnum($value, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
88
+		}
88 89
 	}
89 90
 
90 91
 	/**
@@ -109,10 +110,11 @@  discard block
 block discarded – undo
109 110
 	 */
110 111
 	public function initialize($cache = null)
111 112
 	{
112
-		if($cache === null)
113
-			$this->_cache = Prado::createComponent($this->getImplementationClass(), $this);
114
-		else
115
-			$this->_cache = $cache;
113
+		if($cache === null) {
114
+					$this->_cache = Prado::createComponent($this->getImplementationClass(), $this);
115
+		} else {
116
+					$this->_cache = $cache;
117
+		}
116 118
 	}
117 119
 
118 120
 	/**
@@ -121,7 +123,9 @@  discard block
 block discarded – undo
121 123
 	public function getImplementationClass()
122 124
 	{
123 125
 		$implementation = $this->_implementation;
124
-		if (isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
126
+		if (isset(self::$_cacheTypes[$implementation])) {
127
+			return self::$_cacheTypes[$implementation];
128
+		}
125 129
 
126 130
 		switch(TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
127 131
 		{
@@ -154,14 +158,16 @@  discard block
 block discarded – undo
154 158
 	 */
155 159
 	public function get($key)
156 160
 	{
157
-		if($key instanceof TSqlMapCacheKey)
158
-			$key = $key->getHash();
161
+		if($key instanceof TSqlMapCacheKey) {
162
+					$key = $key->getHash();
163
+		}
159 164
 
160 165
 		//if flush ?
161 166
 		$value = $this->_cache->get($key);
162 167
 		$this->_requests++;
163
-		if($value !== null)
164
-			$this->_hits++;
168
+		if($value !== null) {
169
+					$this->_hits++;
170
+		}
165 171
 		return $value;
166 172
 	}
167 173
 
@@ -171,11 +177,13 @@  discard block
 block discarded – undo
171 177
 	 */
172 178
 	public function set($key, $value)
173 179
 	{
174
-		if($key instanceof TSqlMapCacheKey)
175
-			$key = $key->getHash();
180
+		if($key instanceof TSqlMapCacheKey) {
181
+					$key = $key->getHash();
182
+		}
176 183
 
177
-		if($value !== null)
178
-			$this->_cache->set($key, $value, $this->_flushInterval);
184
+		if($value !== null) {
185
+					$this->_cache->set($key, $value, $this->_flushInterval);
186
+		}
179 187
 	}
180 188
 
181 189
 	/**
@@ -183,9 +191,10 @@  discard block
 block discarded – undo
183 191
 	 */
184 192
 	public function getHitRatio()
185 193
 	{
186
-		if($this->_requests != 0)
187
-			return $this->_hits / $this->_requests;
188
-		else
189
-			return 0;
194
+		if($this->_requests != 0) {
195
+					return $this->_hits / $this->_requests;
196
+		} else {
197
+					return 0;
198
+		}
190 199
 	}
191 200
 }
192 201
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TResultProperty.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function __construct($resultMap = null)
65 65
 	{
66
-		if($resultMap instanceof TResultMap)
66
+		if ($resultMap instanceof TResultMap)
67 67
 			$this->_hostResultMapID = $resultMap->getID();
68 68
 	}
69 69
 
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 		$value = null;
245 245
 		$index = $this->getColumnIndex();
246 246
 		$name = $this->getColumn();
247
-		if($index > 0 && isset($row[$index]))
247
+		if ($index > 0 && isset($row[$index]))
248 248
 			$value = $this->getTypedValue($registry, $row[$index]);
249
-		elseif(isset($row[$name]))
249
+		elseif (isset($row[$name]))
250 250
 			$value = $this->getTypedValue($registry, $row[$name]);
251
-		if(($value === null) && ($this->getNullValue() !== null))
251
+		if (($value === null) && ($this->getNullValue() !== null))
252 252
 			$value = $this->getTypedValue($registry, $this->getNullValue());
253 253
 		return $value;
254 254
 	}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	protected function getTypedValue($registry, $value)
262 262
 	{
263
-		if(($handler = $this->createTypeHandler($registry)) !== null)
263
+		if (($handler = $this->createTypeHandler($registry)) !== null)
264 264
 			return $handler->getResult($value);
265 265
 		else
266 266
 			return $registry->convertToType($this->getType(), $value);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	{
276 276
 		$type = $this->getTypeHandler() ? $this->getTypeHandler() : $this->getType();
277 277
 		$handler = $registry->getTypeHandler($type);
278
-		if($handler === null && $this->getTypeHandler())
278
+		if ($handler === null && $this->getTypeHandler())
279 279
 			$handler = Prado::createComponent($type);
280 280
 		return $handler;
281 281
 	}
@@ -286,17 +286,17 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	protected function getPropertyValueType()
288 288
 	{
289
-		if(class_exists($type = $this->getType(), false)) //NO force autoloading
289
+		if (class_exists($type = $this->getType(), false)) //NO force autoloading
290 290
 		{
291
-			if($type === 'TList')
291
+			if ($type === 'TList')
292 292
 				return self::LIST_TYPE;
293 293
 			$class = new ReflectionClass($type);
294
-			if($class->isSubclassOf('TList'))
294
+			if ($class->isSubclassOf('TList'))
295 295
 				return self::LIST_TYPE;
296
-			if($class->implementsInterface('ArrayAccess'))
296
+			if ($class->implementsInterface('ArrayAccess'))
297 297
 				return self::ARRAY_TYPE;
298 298
 		}
299
-		if(strtolower($type) == 'array')
299
+		if (strtolower($type) == 'array')
300 300
 			return self::ARRAY_TYPE;
301 301
 	}
302 302
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 */
309 309
 	public function instanceOfListType($target)
310 310
 	{
311
-		if($this->getType() === null)
311
+		if ($this->getType() === null)
312 312
 			return  TPropertyAccess::get($target, $this->getProperty()) instanceof TList;
313 313
 		return $this->getPropertyValueType() == self::LIST_TYPE;
314 314
 	}
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public function instanceOfArrayType($target)
323 323
 	{
324
-		if($this->getType() === null)
324
+		if ($this->getType() === null)
325 325
 		{
326 326
 			$prop = TPropertyAccess::get($target, $this->getProperty());
327
-			if(is_object($prop))
327
+			if (is_object($prop))
328 328
 				return $prop instanceof \ArrayAccess;
329 329
 			return is_array($prop);
330 330
 		}
Please login to merge, or discard this patch.
Braces   +67 added lines, -35 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function __construct($resultMap = null)
65 65
 	{
66
-		if($resultMap instanceof TResultMap)
67
-			$this->_hostResultMapID = $resultMap->getID();
66
+		if($resultMap instanceof TResultMap) {
67
+					$this->_hostResultMapID = $resultMap->getID();
68
+		}
68 69
 	}
69 70
 
70 71
 	/**
@@ -244,12 +245,14 @@  discard block
 block discarded – undo
244 245
 		$value = null;
245 246
 		$index = $this->getColumnIndex();
246 247
 		$name = $this->getColumn();
247
-		if($index > 0 && isset($row[$index]))
248
-			$value = $this->getTypedValue($registry, $row[$index]);
249
-		elseif(isset($row[$name]))
250
-			$value = $this->getTypedValue($registry, $row[$name]);
251
-		if(($value === null) && ($this->getNullValue() !== null))
252
-			$value = $this->getTypedValue($registry, $this->getNullValue());
248
+		if($index > 0 && isset($row[$index])) {
249
+					$value = $this->getTypedValue($registry, $row[$index]);
250
+		} elseif(isset($row[$name])) {
251
+					$value = $this->getTypedValue($registry, $row[$name]);
252
+		}
253
+		if(($value === null) && ($this->getNullValue() !== null)) {
254
+					$value = $this->getTypedValue($registry, $this->getNullValue());
255
+		}
253 256
 		return $value;
254 257
 	}
255 258
 
@@ -260,10 +263,11 @@  discard block
 block discarded – undo
260 263
 	 */
261 264
 	protected function getTypedValue($registry, $value)
262 265
 	{
263
-		if(($handler = $this->createTypeHandler($registry)) !== null)
264
-			return $handler->getResult($value);
265
-		else
266
-			return $registry->convertToType($this->getType(), $value);
266
+		if(($handler = $this->createTypeHandler($registry)) !== null) {
267
+					return $handler->getResult($value);
268
+		} else {
269
+					return $registry->convertToType($this->getType(), $value);
270
+		}
267 271
 	}
268 272
 
269 273
 	/**
@@ -275,8 +279,9 @@  discard block
 block discarded – undo
275 279
 	{
276 280
 		$type = $this->getTypeHandler() ? $this->getTypeHandler() : $this->getType();
277 281
 		$handler = $registry->getTypeHandler($type);
278
-		if($handler === null && $this->getTypeHandler())
279
-			$handler = Prado::createComponent($type);
282
+		if($handler === null && $this->getTypeHandler()) {
283
+					$handler = Prado::createComponent($type);
284
+		}
280 285
 		return $handler;
281 286
 	}
282 287
 
@@ -286,18 +291,23 @@  discard block
 block discarded – undo
286 291
 	 */
287 292
 	protected function getPropertyValueType()
288 293
 	{
289
-		if(class_exists($type = $this->getType(), false)) //NO force autoloading
294
+		if(class_exists($type = $this->getType(), false)) {
295
+			//NO force autoloading
290 296
 		{
291 297
 			if($type === 'TList')
292 298
 				return self::LIST_TYPE;
299
+		}
293 300
 			$class = new ReflectionClass($type);
294
-			if($class->isSubclassOf('TList'))
295
-				return self::LIST_TYPE;
296
-			if($class->implementsInterface('ArrayAccess'))
297
-				return self::ARRAY_TYPE;
301
+			if($class->isSubclassOf('TList')) {
302
+							return self::LIST_TYPE;
303
+			}
304
+			if($class->implementsInterface('ArrayAccess')) {
305
+							return self::ARRAY_TYPE;
306
+			}
307
+		}
308
+		if(strtolower($type) == 'array') {
309
+					return self::ARRAY_TYPE;
298 310
 		}
299
-		if(strtolower($type) == 'array')
300
-			return self::ARRAY_TYPE;
301 311
 	}
302 312
 
303 313
 	/**
@@ -308,8 +318,9 @@  discard block
 block discarded – undo
308 318
 	 */
309 319
 	public function instanceOfListType($target)
310 320
 	{
311
-		if($this->getType() === null)
312
-			return  TPropertyAccess::get($target, $this->getProperty()) instanceof TList;
321
+		if($this->getType() === null) {
322
+					return  TPropertyAccess::get($target, $this->getProperty()) instanceof TList;
323
+		}
313 324
 		return $this->getPropertyValueType() == self::LIST_TYPE;
314 325
 	}
315 326
 
@@ -324,8 +335,9 @@  discard block
 block discarded – undo
324 335
 		if($this->getType() === null)
325 336
 		{
326 337
 			$prop = TPropertyAccess::get($target, $this->getProperty());
327
-			if(is_object($prop))
328
-				return $prop instanceof \ArrayAccess;
338
+			if(is_object($prop)) {
339
+							return $prop instanceof \ArrayAccess;
340
+			}
329 341
 			return is_array($prop);
330 342
 		}
331 343
 		return $this->getPropertyValueType() == self::ARRAY_TYPE;
@@ -334,16 +346,36 @@  discard block
 block discarded – undo
334 346
 	public function __sleep()
335 347
 	{
336 348
 		$exprops = []; $cn = 'TResultProperty';
337
-		if ($this->_nullValue === null) $exprops[] = "\0$cn\0_nullValue";
338
-		if ($this->_propertyName === null) $exprops[] = "\0$cn\0_propertyNama";
339
-		if ($this->_columnName === null) $exprops[] = "\0$cn\0_columnName";
340
-		if ($this->_columnIndex == -1) $exprops[] = "\0$cn\0_columnIndex";
341
-		if ($this->_nestedResultMapName === null) $exprops[] = "\0$cn\0_nestedResultMapName";
342
-		if ($this->_nestedResultMap === null) $exprops[] = "\0$cn\0_nestedResultMap";
343
-		if ($this->_valueType === null) $exprops[] = "\0$cn\0_valueType";
344
-		if ($this->_typeHandler === null) $exprops[] = "\0$cn\0_typeHandler";
345
-		if ($this->_isLazyLoad === false) $exprops[] = "\0$cn\0_isLazyLoad";
346
-		if ($this->_select === null) $exprops[] = "\0$cn\0_select";
349
+		if ($this->_nullValue === null) {
350
+			$exprops[] = "\0$cn\0_nullValue";
351
+		}
352
+		if ($this->_propertyName === null) {
353
+			$exprops[] = "\0$cn\0_propertyNama";
354
+		}
355
+		if ($this->_columnName === null) {
356
+			$exprops[] = "\0$cn\0_columnName";
357
+		}
358
+		if ($this->_columnIndex == -1) {
359
+			$exprops[] = "\0$cn\0_columnIndex";
360
+		}
361
+		if ($this->_nestedResultMapName === null) {
362
+			$exprops[] = "\0$cn\0_nestedResultMapName";
363
+		}
364
+		if ($this->_nestedResultMap === null) {
365
+			$exprops[] = "\0$cn\0_nestedResultMap";
366
+		}
367
+		if ($this->_valueType === null) {
368
+			$exprops[] = "\0$cn\0_valueType";
369
+		}
370
+		if ($this->_typeHandler === null) {
371
+			$exprops[] = "\0$cn\0_typeHandler";
372
+		}
373
+		if ($this->_isLazyLoad === false) {
374
+			$exprops[] = "\0$cn\0_isLazyLoad";
375
+		}
376
+		if ($this->_select === null) {
377
+			$exprops[] = "\0$cn\0_select";
378
+		}
347 379
 		return array_diff(parent::__sleep(), $exprops);
348 380
 	}
349 381
 }
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapStatement.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function initialize($manager)
250 250
 	{
251
-		if(strlen($this->_resultMapName) > 0)
251
+		if (strlen($this->_resultMapName) > 0)
252 252
 			$this->_resultMap = $manager->getResultMap($this->_resultMapName);
253
-		if(strlen($this->_parameterMapName) > 0)
253
+		if (strlen($this->_parameterMapName) > 0)
254 254
 			$this->_parameterMap = $manager->getParameterMap($this->_parameterMapName);
255 255
 	}
256 256
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function createInstanceOfListClass($registry)
262 262
 	{
263
-		if(strlen($type = $this->getListClass()) > 0)
263
+		if (strlen($type = $this->getListClass()) > 0)
264 264
 			return $this->createInstanceOf($registry, $type);
265 265
 		return [];
266 266
 	}
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	protected function createInstanceOf($registry, $type, $row = null)
276 276
 	{
277 277
 		$handler = $registry->getTypeHandler($type);
278
-		if($handler !== null)
278
+		if ($handler !== null)
279 279
 			return $handler->createNewInstance($row);
280 280
 		else
281 281
 			return $registry->createInstanceOf($type);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function createInstanceOfResultClass($registry, $row)
291 291
 	{
292
-		if(strlen($type = $this->getResultClass()) > 0)
292
+		if (strlen($type = $this->getResultClass()) > 0)
293 293
 			return $this->createInstanceOf($registry, $type, $row);
294 294
 	}
295 295
 
Please login to merge, or discard this patch.
Braces   +53 added lines, -24 removed lines patch added patch discarded remove patch
@@ -248,10 +248,12 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function initialize($manager)
250 250
 	{
251
-		if(strlen($this->_resultMapName) > 0)
252
-			$this->_resultMap = $manager->getResultMap($this->_resultMapName);
253
-		if(strlen($this->_parameterMapName) > 0)
254
-			$this->_parameterMap = $manager->getParameterMap($this->_parameterMapName);
251
+		if(strlen($this->_resultMapName) > 0) {
252
+					$this->_resultMap = $manager->getResultMap($this->_resultMapName);
253
+		}
254
+		if(strlen($this->_parameterMapName) > 0) {
255
+					$this->_parameterMap = $manager->getParameterMap($this->_parameterMapName);
256
+		}
255 257
 	}
256 258
 
257 259
 	/**
@@ -260,8 +262,9 @@  discard block
 block discarded – undo
260 262
 	 */
261 263
 	public function createInstanceOfListClass($registry)
262 264
 	{
263
-		if(strlen($type = $this->getListClass()) > 0)
264
-			return $this->createInstanceOf($registry, $type);
265
+		if(strlen($type = $this->getListClass()) > 0) {
266
+					return $this->createInstanceOf($registry, $type);
267
+		}
265 268
 		return [];
266 269
 	}
267 270
 
@@ -275,10 +278,11 @@  discard block
 block discarded – undo
275 278
 	protected function createInstanceOf($registry, $type, $row = null)
276 279
 	{
277 280
 		$handler = $registry->getTypeHandler($type);
278
-		if($handler !== null)
279
-			return $handler->createNewInstance($row);
280
-		else
281
-			return $registry->createInstanceOf($type);
281
+		if($handler !== null) {
282
+					return $handler->createNewInstance($row);
283
+		} else {
284
+					return $registry->createInstanceOf($type);
285
+		}
282 286
 	}
283 287
 
284 288
 	/**
@@ -289,26 +293,51 @@  discard block
 block discarded – undo
289 293
 	 */
290 294
 	public function createInstanceOfResultClass($registry, $row)
291 295
 	{
292
-		if(strlen($type = $this->getResultClass()) > 0)
293
-			return $this->createInstanceOf($registry, $type, $row);
296
+		if(strlen($type = $this->getResultClass()) > 0) {
297
+					return $this->createInstanceOf($registry, $type, $row);
298
+		}
294 299
 	}
295 300
 
296 301
 	public function __sleep()
297 302
 	{
298 303
 		$cn = __CLASS__;
299 304
 		$exprops = ["\0$cn\0_resultMap"];
300
-		if (!$this->_parameterMapName) $exprops[] = "\0$cn\0_parameterMapName";
301
-		if (!$this->_parameterMap) $exprops[] = "\0$cn\0_parameterMap";
302
-		if (!$this->_parameterClassName) $exprops[] = "\0$cn\0_parameterClassName";
303
-		if (!$this->_resultMapName) $exprops[] = "\0$cn\0_resultMapName";
304
-		if (!$this->_resultMap) $exprops[] = "\0$cn\0_resultMap";
305
-		if (!$this->_resultClassName) $exprops[] = "\0$cn\0_resultClassName";
306
-		if (!$this->_cacheModelName) $exprops[] = "\0$cn\0_cacheModelName";
307
-		if (!$this->_SQL) $exprops[] = "\0$cn\0_SQL";
308
-		if (!$this->_listClass) $exprops[] = "\0$cn\0_listClass";
309
-		if (!$this->_typeHandler) $exprops[] = "\0$cn\0_typeHandler";
310
-		if (!$this->_extendStatement) $exprops[] = "\0$cn\0_extendStatement";
311
-		if (!$this->_cache) $exprops[] = "\0$cn\0_cache";
305
+		if (!$this->_parameterMapName) {
306
+			$exprops[] = "\0$cn\0_parameterMapName";
307
+		}
308
+		if (!$this->_parameterMap) {
309
+			$exprops[] = "\0$cn\0_parameterMap";
310
+		}
311
+		if (!$this->_parameterClassName) {
312
+			$exprops[] = "\0$cn\0_parameterClassName";
313
+		}
314
+		if (!$this->_resultMapName) {
315
+			$exprops[] = "\0$cn\0_resultMapName";
316
+		}
317
+		if (!$this->_resultMap) {
318
+			$exprops[] = "\0$cn\0_resultMap";
319
+		}
320
+		if (!$this->_resultClassName) {
321
+			$exprops[] = "\0$cn\0_resultClassName";
322
+		}
323
+		if (!$this->_cacheModelName) {
324
+			$exprops[] = "\0$cn\0_cacheModelName";
325
+		}
326
+		if (!$this->_SQL) {
327
+			$exprops[] = "\0$cn\0_SQL";
328
+		}
329
+		if (!$this->_listClass) {
330
+			$exprops[] = "\0$cn\0_listClass";
331
+		}
332
+		if (!$this->_typeHandler) {
333
+			$exprops[] = "\0$cn\0_typeHandler";
334
+		}
335
+		if (!$this->_extendStatement) {
336
+			$exprops[] = "\0$cn\0_extendStatement";
337
+		}
338
+		if (!$this->_cache) {
339
+			$exprops[] = "\0$cn\0_cache";
340
+		}
312 341
 
313 342
 		return array_diff(parent::__sleep(), $exprops);
314 343
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/TSqlMapConfig.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	private function getCacheKey()
45 45
 	{
46
-		return $this->getID() . $this->getConfigFile();
46
+		return $this->getID().$this->getConfigFile();
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	public function clearCache()
53 53
 	{
54 54
 		$cache = $this->getApplication()->getCache();
55
-		if($cache !== null) {
55
+		if ($cache !== null) {
56 56
 			$cache->delete($this->getCacheKey());
57 57
 		}
58 58
 	}
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 	 * @since 3.1.7
67 67
 	 */
68 68
 	public function getSqlMapManager() {
69
-		if(($manager = $this->loadCachedSqlMapManager()) === null)
69
+		if (($manager = $this->loadCachedSqlMapManager()) === null)
70 70
 		{
71 71
 			$manager = new TSqlMapManager($this->getDbConnection());
72
-			if(strlen($file = $this->getConfigFile()) > 0)
72
+			if (strlen($file = $this->getConfigFile()) > 0)
73 73
 			{
74 74
 				$manager->configureXml($file);
75 75
 				$this->cacheSqlMapManager($manager);
76 76
 			}
77 77
 		}
78
-		elseif($this->getConnectionID() !== '') {
78
+		elseif ($this->getConnectionID() !== '') {
79 79
 			$manager->setDbConnection($this->getDbConnection());
80 80
 		}
81 81
 		return $manager;
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	protected function cacheSqlMapManager($manager)
89 89
 	{
90
-		if($this->getEnableCache())
90
+		if ($this->getEnableCache())
91 91
 		{
92 92
 			$cache = $this->getApplication()->getCache();
93
-			if($cache !== null) {
93
+			if ($cache !== null) {
94 94
 				$dependencies = null;
95
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
95
+				if ($this->getApplication()->getMode() !== TApplicationMode::Performance)
96 96
 					$dependencies = $manager->getCacheDependencies();
97 97
 				return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
98 98
 			}
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function loadCachedSqlMapManager()
108 108
 	{
109
-		if($this->getEnableCache())
109
+		if ($this->getEnableCache())
110 110
 		{
111 111
 			$cache = $this->getApplication()->getCache();
112
-			if($cache !== null)
112
+			if ($cache !== null)
113 113
 			{
114 114
 				$manager = $cache->get($this->getCacheKey());
115
-				if($manager instanceof TSqlMapManager)
115
+				if ($manager instanceof TSqlMapManager)
116 116
 					return $manager;
117 117
 			}
118 118
 		}
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function setConfigFile($value)
136 136
 	{
137
-		if(is_file($value))
137
+		if (is_file($value))
138 138
 			$this->_configFile = $value;
139 139
 		else
140 140
 		{
141 141
 			$file = Prado::getPathOfNamespace($value, self::CONFIG_FILE_EXT);
142
-			if($file === null || !is_file($file))
142
+			if ($file === null || !is_file($file))
143 143
 				throw new TConfigurationException('sqlmap_configfile_invalid', $value);
144 144
 			else
145 145
 				$this->_configFile = $file;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	public function getClient()
179 179
 	{
180
-		if($this->_sqlmap === null)
180
+		if ($this->_sqlmap === null)
181 181
 			$this->_sqlmap = $this->createSqlMapGateway();
182 182
 		return $this->_sqlmap;
183 183
 	}
Please login to merge, or discard this patch.
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@  discard block
 block discarded – undo
74 74
 				$manager->configureXml($file);
75 75
 				$this->cacheSqlMapManager($manager);
76 76
 			}
77
-		}
78
-		elseif($this->getConnectionID() !== '') {
77
+		} elseif($this->getConnectionID() !== '') {
79 78
 			$manager->setDbConnection($this->getDbConnection());
80 79
 		}
81 80
 		return $manager;
@@ -92,8 +91,9 @@  discard block
 block discarded – undo
92 91
 			$cache = $this->getApplication()->getCache();
93 92
 			if($cache !== null) {
94 93
 				$dependencies = null;
95
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
96
-					$dependencies = $manager->getCacheDependencies();
94
+				if($this->getApplication()->getMode() !== TApplicationMode::Performance) {
95
+									$dependencies = $manager->getCacheDependencies();
96
+				}
97 97
 				return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
98 98
 			}
99 99
 		}
@@ -112,8 +112,9 @@  discard block
 block discarded – undo
112 112
 			if($cache !== null)
113 113
 			{
114 114
 				$manager = $cache->get($this->getCacheKey());
115
-				if($manager instanceof TSqlMapManager)
116
-					return $manager;
115
+				if($manager instanceof TSqlMapManager) {
116
+									return $manager;
117
+				}
117 118
 			}
118 119
 		}
119 120
 		return null;
@@ -134,15 +135,16 @@  discard block
 block discarded – undo
134 135
 	 */
135 136
 	public function setConfigFile($value)
136 137
 	{
137
-		if(is_file($value))
138
-			$this->_configFile = $value;
139
-		else
138
+		if(is_file($value)) {
139
+					$this->_configFile = $value;
140
+		} else
140 141
 		{
141 142
 			$file = Prado::getPathOfNamespace($value, self::CONFIG_FILE_EXT);
142
-			if($file === null || !is_file($file))
143
-				throw new TConfigurationException('sqlmap_configfile_invalid', $value);
144
-			else
145
-				$this->_configFile = $file;
143
+			if($file === null || !is_file($file)) {
144
+							throw new TConfigurationException('sqlmap_configfile_invalid', $value);
145
+			} else {
146
+							$this->_configFile = $file;
147
+			}
146 148
 		}
147 149
 	}
148 150
 
@@ -177,8 +179,9 @@  discard block
 block discarded – undo
177 179
 	 */
178 180
 	public function getClient()
179 181
 	{
180
-		if($this->_sqlmap === null)
181
-			$this->_sqlmap = $this->createSqlMapGateway();
182
+		if($this->_sqlmap === null) {
183
+					$this->_sqlmap = $this->createSqlMapGateway();
184
+		}
182 185
 		return $this->_sqlmap;
183 186
 	}
184 187
 }
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TSimpleDynamicSql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
 
33 33
 	public function replaceDynamicParameter($sql, $parameter)
34 34
 	{
35
-		foreach($this->_mappings as $property)
35
+		foreach ($this->_mappings as $property)
36 36
 		{
37 37
 			$value = TPropertyAccess::get($parameter, $property);
38
-			$sql = preg_replace('/' . TSimpleDynamicParser::DYNAMIC_TOKEN . '/', str_replace('$', '\$', $value), $sql, 1);
38
+			$sql = preg_replace('/'.TSimpleDynamicParser::DYNAMIC_TOKEN.'/', str_replace('$', '\$', $value), $sql, 1);
39 39
 		}
40 40
 		return $sql;
41 41
 	}
Please login to merge, or discard this patch.