@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getSubMap($value) |
150 | 150 | { |
151 | - if (isset($this->_resultMaps[$value])) { |
|
151 | + if(isset($this->_resultMaps[$value])) { |
|
152 | 152 | return $this->_resultMaps[$value]; |
153 | 153 | } |
154 | 154 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function initialize($manager) |
175 | 175 | { |
176 | - foreach ($this->_subMaps as $subMap) { |
|
176 | + foreach($this->_subMaps as $subMap) { |
|
177 | 177 | $this->_resultMaps[$subMap->getValue()] = |
178 | 178 | $manager->getResultMap($subMap->getResultMapping()); |
179 | 179 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function setImplementation($value) |
83 | 83 | { |
84 | - if (isset(self::$_cacheTypes[$value])) { |
|
84 | + if(isset(self::$_cacheTypes[$value])) { |
|
85 | 85 | $this->_implementation = $value; |
86 | 86 | } else { |
87 | 87 | $this->_implementation = TPropertyValue::ensureEnum($value, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function initialize($cache = null) |
112 | 112 | { |
113 | - if ($cache === null) { |
|
113 | + if($cache === null) { |
|
114 | 114 | $this->_cache = Prado::createComponent($this->getImplementationClass(), $this); |
115 | 115 | } else { |
116 | 116 | $this->_cache = $cache; |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | public function getImplementationClass() |
124 | 124 | { |
125 | 125 | $implementation = $this->_implementation; |
126 | - if (isset(self::$_cacheTypes[$implementation])) { |
|
126 | + if(isset(self::$_cacheTypes[$implementation])) { |
|
127 | 127 | return self::$_cacheTypes[$implementation]; |
128 | 128 | } |
129 | 129 | |
130 | - switch (TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes')) { |
|
130 | + switch(TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes')) { |
|
131 | 131 | case TSqlMapCacheTypes::FIFO: return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapFifoCache'; |
132 | 132 | case TSqlMapCacheTypes::LRU: return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapLruCache'; |
133 | 133 | case TSqlMapCacheTypes::Basic: return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapApplicationCache'; |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function get($key) |
159 | 159 | { |
160 | - if ($key instanceof TSqlMapCacheKey) { |
|
160 | + if($key instanceof TSqlMapCacheKey) { |
|
161 | 161 | $key = $key->getHash(); |
162 | 162 | } |
163 | 163 | |
164 | 164 | //if flush ? |
165 | 165 | $value = $this->_cache->get($key); |
166 | 166 | $this->_requests++; |
167 | - if ($value !== null) { |
|
167 | + if($value !== null) { |
|
168 | 168 | $this->_hits++; |
169 | 169 | } |
170 | 170 | return $value; |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function set($key, $value) |
178 | 178 | { |
179 | - if ($key instanceof TSqlMapCacheKey) { |
|
179 | + if($key instanceof TSqlMapCacheKey) { |
|
180 | 180 | $key = $key->getHash(); |
181 | 181 | } |
182 | 182 | |
183 | - if ($value !== null) { |
|
183 | + if($value !== null) { |
|
184 | 184 | $this->_cache->set($key, $value, $this->_flushInterval); |
185 | 185 | } |
186 | 186 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getHitRatio() |
192 | 192 | { |
193 | - if ($this->_requests != 0) { |
|
193 | + if($this->_requests != 0) { |
|
194 | 194 | return $this->_hits / $this->_requests; |
195 | 195 | } else { |
196 | 196 | return 0; |
@@ -77,49 +77,49 @@ discard block |
||
77 | 77 | $this->_document = $document; |
78 | 78 | |
79 | 79 | static $bCacheDependencies; |
80 | - if ($bCacheDependencies === null) { |
|
80 | + if($bCacheDependencies === null) { |
|
81 | 81 | $bCacheDependencies = true; |
82 | 82 | } //Prado::getApplication()->getMode() !== TApplicationMode::Performance; |
83 | 83 | |
84 | - if ($bCacheDependencies) { |
|
84 | + if($bCacheDependencies) { |
|
85 | 85 | $this->_manager->getCacheDependencies() |
86 | 86 | ->getDependencies() |
87 | 87 | ->add(new TFileCacheDependency($filename)); |
88 | 88 | } |
89 | 89 | |
90 | - foreach ($document->xpath('//resultMap') as $node) { |
|
90 | + foreach($document->xpath('//resultMap') as $node) { |
|
91 | 91 | $this->loadResultMap($node); |
92 | 92 | } |
93 | 93 | |
94 | - foreach ($document->xpath('//parameterMap') as $node) { |
|
94 | + foreach($document->xpath('//parameterMap') as $node) { |
|
95 | 95 | $this->loadParameterMap($node); |
96 | 96 | } |
97 | 97 | |
98 | - foreach ($document->xpath('//statement') as $node) { |
|
98 | + foreach($document->xpath('//statement') as $node) { |
|
99 | 99 | $this->loadStatementTag($node); |
100 | 100 | } |
101 | 101 | |
102 | - foreach ($document->xpath('//select') as $node) { |
|
102 | + foreach($document->xpath('//select') as $node) { |
|
103 | 103 | $this->loadSelectTag($node); |
104 | 104 | } |
105 | 105 | |
106 | - foreach ($document->xpath('//insert') as $node) { |
|
106 | + foreach($document->xpath('//insert') as $node) { |
|
107 | 107 | $this->loadInsertTag($node); |
108 | 108 | } |
109 | 109 | |
110 | - foreach ($document->xpath('//update') as $node) { |
|
110 | + foreach($document->xpath('//update') as $node) { |
|
111 | 111 | $this->loadUpdateTag($node); |
112 | 112 | } |
113 | 113 | |
114 | - foreach ($document->xpath('//delete') as $node) { |
|
114 | + foreach($document->xpath('//delete') as $node) { |
|
115 | 115 | $this->loadDeleteTag($node); |
116 | 116 | } |
117 | 117 | |
118 | - foreach ($document->xpath('//procedure') as $node) { |
|
118 | + foreach($document->xpath('//procedure') as $node) { |
|
119 | 119 | $this->loadProcedureTag($node); |
120 | 120 | } |
121 | 121 | |
122 | - foreach ($document->xpath('//cacheModel') as $node) { |
|
122 | + foreach($document->xpath('//cacheModel') as $node) { |
|
123 | 123 | $this->loadCacheModel($node); |
124 | 124 | } |
125 | 125 | |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | $resultMap = $this->createResultMap($node); |
136 | 136 | |
137 | 137 | //find extended result map. |
138 | - if (strlen($extendMap = $resultMap->getExtends()) > 0) { |
|
139 | - if (!$this->_manager->getResultMaps()->contains($extendMap)) { |
|
138 | + if(strlen($extendMap = $resultMap->getExtends()) > 0) { |
|
139 | + if(!$this->_manager->getResultMaps()->contains($extendMap)) { |
|
140 | 140 | $extendNode = $this->getElementByIdValue($this->_document, 'resultMap', $extendMap); |
141 | - if ($extendNode !== null) { |
|
141 | + if($extendNode !== null) { |
|
142 | 142 | $this->loadResultMap($extendNode); |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - if (!$this->_manager->getResultMaps()->contains($extendMap)) { |
|
146 | + if(!$this->_manager->getResultMaps()->contains($extendMap)) { |
|
147 | 147 | throw new TSqlMapConfigurationException( |
148 | 148 | 'sqlmap_unable_to_find_parent_result_map', |
149 | 149 | $node, |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | //add the result map |
160 | - if (!$this->_manager->getResultMaps()->contains($resultMap->getID())) { |
|
160 | + if(!$this->_manager->getResultMaps()->contains($resultMap->getID())) { |
|
161 | 161 | $this->_manager->addResultMap($resultMap); |
162 | 162 | } |
163 | 163 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->setObjectPropFromNode($resultMap, $node); |
175 | 175 | |
176 | 176 | //result nodes |
177 | - foreach ($node->result as $result) { |
|
177 | + foreach($node->result as $result) { |
|
178 | 178 | $property = new TResultProperty($resultMap); |
179 | 179 | $this->setObjectPropFromNode($property, $result); |
180 | 180 | $resultMap->addResultProperty($property); |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | |
183 | 183 | //create the discriminator |
184 | 184 | $discriminator = null; |
185 | - if (isset($node->discriminator)) { |
|
185 | + if(isset($node->discriminator)) { |
|
186 | 186 | $discriminator = new TDiscriminator(); |
187 | 187 | $this->setObjectPropFromNode($discriminator, $node->discriminator); |
188 | 188 | $discriminator->initMapping($resultMap); |
189 | 189 | } |
190 | 190 | |
191 | - foreach ($node->xpath('subMap') as $subMapNode) { |
|
192 | - if ($discriminator === null) { |
|
191 | + foreach($node->xpath('subMap') as $subMapNode) { |
|
192 | + if($discriminator === null) { |
|
193 | 193 | throw new TSqlMapConfigurationException( |
194 | 194 | 'sqlmap_undefined_discriminator', |
195 | 195 | $node, |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $discriminator->addSubMap($subMap); |
203 | 203 | } |
204 | 204 | |
205 | - if ($discriminator !== null) { |
|
205 | + if($discriminator !== null) { |
|
206 | 206 | $resultMap->setDiscriminator($discriminator); |
207 | 207 | } |
208 | 208 | |
@@ -218,15 +218,15 @@ discard block |
||
218 | 218 | { |
219 | 219 | $parameterMap = $this->createParameterMap($node); |
220 | 220 | |
221 | - if (strlen($extendMap = $parameterMap->getExtends()) > 0) { |
|
222 | - if (!$this->_manager->getParameterMaps()->contains($extendMap)) { |
|
221 | + if(strlen($extendMap = $parameterMap->getExtends()) > 0) { |
|
222 | + if(!$this->_manager->getParameterMaps()->contains($extendMap)) { |
|
223 | 223 | $extendNode = $this->getElementByIdValue($this->_document, 'parameterMap', $extendMap); |
224 | - if ($extendNode !== null) { |
|
224 | + if($extendNode !== null) { |
|
225 | 225 | $this->loadParameterMap($extendNode); |
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | - if (!$this->_manager->getParameterMaps()->contains($extendMap)) { |
|
229 | + if(!$this->_manager->getParameterMaps()->contains($extendMap)) { |
|
230 | 230 | throw new TSqlMapConfigurationException( |
231 | 231 | 'sqlmap_unable_to_find_parent_parameter_map', |
232 | 232 | $node, |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } |
237 | 237 | $superMap = $this->_manager->getParameterMap($extendMap); |
238 | 238 | $index = 0; |
239 | - foreach ($superMap->getPropertyNames() as $propertyName) { |
|
239 | + foreach($superMap->getPropertyNames() as $propertyName) { |
|
240 | 240 | $parameterMap->insertProperty($index++, $superMap->getProperty($propertyName)); |
241 | 241 | } |
242 | 242 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | { |
253 | 253 | $parameterMap = new TParameterMap(); |
254 | 254 | $this->setObjectPropFromNode($parameterMap, $node); |
255 | - foreach ($node->parameter as $parameter) { |
|
255 | + foreach($node->parameter as $parameter) { |
|
256 | 256 | $property = new TParameterProperty(); |
257 | 257 | $this->setObjectPropFromNode($property, $parameter); |
258 | 258 | $parameterMap->addProperty($property); |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | */ |
282 | 282 | protected function processSqlStatement($statement, $node) |
283 | 283 | { |
284 | - $commandText = (string)$node; |
|
285 | - if (strlen($extend = $statement->getExtends()) > 0) { |
|
284 | + $commandText = (string) $node; |
|
285 | + if(strlen($extend = $statement->getExtends()) > 0) { |
|
286 | 286 | $superNode = $this->getElementByIdValue($this->_document, '*', $extend); |
287 | - if ($superNode !== null) { |
|
288 | - $commandText = (string)$superNode . $commandText; |
|
287 | + if($superNode !== null) { |
|
288 | + $commandText = (string) $superNode . $commandText; |
|
289 | 289 | } else { |
290 | 290 | throw new TSqlMapConfigurationException( |
291 | 291 | 'sqlmap_unable_to_find_parent_sql', |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | $scope['node'] = $node; |
313 | 313 | |
314 | 314 | $sqlStatement = preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP, self::INLINE_PLACEHOLDER, $sqlStatement); |
315 | - if ($statement->parameterMap() === null) { |
|
315 | + if($statement->parameterMap() === null) { |
|
316 | 316 | // Build a Parametermap with the inline parameters. |
317 | 317 | // if they exist. Then delete inline infos from sqltext. |
318 | 318 | $parameterParser = new TInlineParameterMapParser; |
319 | 319 | $sqlText = $parameterParser->parse($sqlStatement, $scope); |
320 | - if (count($sqlText['parameters']) > 0) { |
|
320 | + if(count($sqlText['parameters']) > 0) { |
|
321 | 321 | $map = new TParameterMap(); |
322 | 322 | $map->setID($statement->getID() . '-InLineParameterMap'); |
323 | 323 | $statement->setInlineParameterMap($map); |
324 | - foreach ($sqlText['parameters'] as $property) { |
|
324 | + foreach($sqlText['parameters'] as $property) { |
|
325 | 325 | $map->addProperty($property); |
326 | 326 | } |
327 | 327 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $simpleDynamic = new TSimpleDynamicParser; |
345 | 345 | $sqlStatement = preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP, self::SIMPLE_PLACEHOLDER, $sqlStatement); |
346 | 346 | $dynamics = $simpleDynamic->parse($sqlStatement); |
347 | - if (count($dynamics['parameters']) > 0) { |
|
347 | + if(count($dynamics['parameters']) > 0) { |
|
348 | 348 | $sql = new TSimpleDynamicSql($dynamics['parameters']); |
349 | 349 | $sqlStatement = $dynamics['sql']; |
350 | 350 | } else { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $this->setObjectPropFromNode($select, $node); |
366 | 366 | $this->processSqlStatement($select, $node); |
367 | 367 | $mappedStatement = new TMappedStatement($this->_manager, $select); |
368 | - if (strlen($select->getCacheModel()) > 0) { |
|
368 | + if(strlen($select->getCacheModel()) > 0) { |
|
369 | 369 | $mappedStatement = new TCachingStatement($mappedStatement); |
370 | 370 | } |
371 | 371 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | { |
394 | 394 | $insert = new TSqlMapInsert; |
395 | 395 | $this->setObjectPropFromNode($insert, $node); |
396 | - if (isset($node->selectKey)) { |
|
396 | + if(isset($node->selectKey)) { |
|
397 | 397 | $this->loadSelectKeyTag($insert, $node->selectKey); |
398 | 398 | } |
399 | 399 | return $insert; |
@@ -458,27 +458,27 @@ discard block |
||
458 | 458 | protected function loadCacheModel($node) |
459 | 459 | { |
460 | 460 | $cacheModel = new TSqlMapCacheModel; |
461 | - $properties = ['id','implementation']; |
|
462 | - foreach ($node->attributes() as $name => $value) { |
|
463 | - if (in_array(strtolower($name), $properties)) { |
|
464 | - $cacheModel->{'set' . $name}((string)$value); |
|
461 | + $properties = ['id', 'implementation']; |
|
462 | + foreach($node->attributes() as $name => $value) { |
|
463 | + if(in_array(strtolower($name), $properties)) { |
|
464 | + $cacheModel->{'set' . $name}((string) $value); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | $cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel); |
468 | 468 | $this->setObjectPropFromNode($cache, $node, $properties); |
469 | 469 | |
470 | - foreach ($node->xpath('property') as $propertyNode) { |
|
470 | + foreach($node->xpath('property') as $propertyNode) { |
|
471 | 471 | $name = $propertyNode->attributes()->name; |
472 | - if ($name === null || $name === '') { |
|
472 | + if($name === null || $name === '') { |
|
473 | 473 | continue; |
474 | 474 | } |
475 | 475 | |
476 | 476 | $value = $propertyNode->attributes()->value; |
477 | - if ($value === null || $value === '') { |
|
477 | + if($value === null || $value === '') { |
|
478 | 478 | continue; |
479 | 479 | } |
480 | 480 | |
481 | - if (!TPropertyAccess::has($cache, $name)) { |
|
481 | + if(!TPropertyAccess::has($cache, $name)) { |
|
482 | 482 | continue; |
483 | 483 | } |
484 | 484 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | $cacheModel->initialize($cache); |
491 | 491 | $this->_manager->addCacheModel($cacheModel); |
492 | - foreach ($node->xpath('flushOnExecute') as $flush) { |
|
492 | + foreach($node->xpath('flushOnExecute') as $flush) { |
|
493 | 493 | $this->loadFlushOnCache($cacheModel, $node, $flush); |
494 | 494 | } |
495 | 495 | } |
@@ -502,26 +502,26 @@ discard block |
||
502 | 502 | protected function loadFlushInterval($cacheModel, $node) |
503 | 503 | { |
504 | 504 | $flushInterval = $node->xpath('flushInterval'); |
505 | - if ($flushInterval === null || count($flushInterval) === 0) { |
|
505 | + if($flushInterval === null || count($flushInterval) === 0) { |
|
506 | 506 | return; |
507 | 507 | } |
508 | 508 | $duration = 0; |
509 | - foreach ($flushInterval[0]->attributes() as $name => $value) { |
|
510 | - switch (strToLower($name)) { |
|
509 | + foreach($flushInterval[0]->attributes() as $name => $value) { |
|
510 | + switch(strToLower($name)) { |
|
511 | 511 | case 'seconds': |
512 | - $duration += (integer)$value; |
|
512 | + $duration += (integer) $value; |
|
513 | 513 | break; |
514 | 514 | case 'minutes': |
515 | - $duration += 60 * (integer)$value; |
|
515 | + $duration += 60 * (integer) $value; |
|
516 | 516 | break; |
517 | 517 | case 'hours': |
518 | - $duration += 3600 * (integer)$value; |
|
518 | + $duration += 3600 * (integer) $value; |
|
519 | 519 | break; |
520 | 520 | case 'days': |
521 | - $duration += 86400 * (integer)$value; |
|
521 | + $duration += 86400 * (integer) $value; |
|
522 | 522 | break; |
523 | 523 | case 'duration': |
524 | - $duration = (integer)$value; |
|
524 | + $duration = (integer) $value; |
|
525 | 525 | break 2; // switch, foreach |
526 | 526 | } |
527 | 527 | } |
@@ -537,12 +537,12 @@ discard block |
||
537 | 537 | protected function loadFlushOnCache($cacheModel, $parent, $node) |
538 | 538 | { |
539 | 539 | $id = $cacheModel->getID(); |
540 | - if (!isset($this->_FlushOnExecuteStatements[$id])) { |
|
540 | + if(!isset($this->_FlushOnExecuteStatements[$id])) { |
|
541 | 541 | $this->_FlushOnExecuteStatements[$id] = []; |
542 | 542 | } |
543 | - foreach ($node->attributes() as $name => $value) { |
|
544 | - if (strtolower($name) === 'statement') { |
|
545 | - $this->_FlushOnExecuteStatements[$id][] = (string)$value; |
|
543 | + foreach($node->attributes() as $name => $value) { |
|
544 | + if(strtolower($name) === 'statement') { |
|
545 | + $this->_FlushOnExecuteStatements[$id][] = (string) $value; |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | } |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | */ |
553 | 553 | protected function registerCacheTriggers() |
554 | 554 | { |
555 | - foreach ($this->_FlushOnExecuteStatements as $cacheID => $statementIDs) { |
|
555 | + foreach($this->_FlushOnExecuteStatements as $cacheID => $statementIDs) { |
|
556 | 556 | $cacheModel = $this->_manager->getCacheModel($cacheID); |
557 | - foreach ($statementIDs as $statementID) { |
|
557 | + foreach($statementIDs as $statementID) { |
|
558 | 558 | $statement = $this->_manager->getMappedStatement($statementID); |
559 | 559 | $cacheModel->registerTriggerStatement($statement); |
560 | 560 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function getTypeHandlers() |
93 | 93 | { |
94 | - if ($this->_typeHandlers === null) { |
|
94 | + if($this->_typeHandlers === null) { |
|
95 | 95 | $this->_typeHandlers = new TSqlMapTypeHandlerRegistry(); |
96 | 96 | } |
97 | 97 | return $this->_typeHandlers; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function getSqlmapGateway() |
104 | 104 | { |
105 | - if ($this->_gateway === null) { |
|
105 | + if($this->_gateway === null) { |
|
106 | 106 | $this->_gateway = $this->createSqlMapGateway(); |
107 | 107 | } |
108 | 108 | return $this->_gateway; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getCacheDependencies() |
126 | 126 | { |
127 | - if ($this->_cacheDependencies === null) { |
|
127 | + if($this->_cacheDependencies === null) { |
|
128 | 128 | $this->_cacheDependencies = new TChainedCacheDependency(); |
129 | 129 | } |
130 | 130 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function getMappedStatement($name) |
159 | 159 | { |
160 | - if ($this->_mappedStatements->contains($name) == false) { |
|
160 | + if($this->_mappedStatements->contains($name) == false) { |
|
161 | 161 | throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name); |
162 | 162 | } |
163 | 163 | return $this->_mappedStatements[$name]; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function addMappedStatement(IMappedStatement $statement) |
173 | 173 | { |
174 | 174 | $key = $statement->getID(); |
175 | - if ($this->_mappedStatements->contains($key) == true) { |
|
175 | + if($this->_mappedStatements->contains($key) == true) { |
|
176 | 176 | throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key); |
177 | 177 | } |
178 | 178 | $this->_mappedStatements->add($key, $statement); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function getResultMap($name) |
196 | 196 | { |
197 | - if ($this->_resultMaps->contains($name) == false) { |
|
197 | + if($this->_resultMaps->contains($name) == false) { |
|
198 | 198 | throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name); |
199 | 199 | } |
200 | 200 | return $this->_resultMaps[$name]; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public function addResultMap(TResultMap $result) |
208 | 208 | { |
209 | 209 | $key = $result->getID(); |
210 | - if ($this->_resultMaps->contains($key) == true) { |
|
210 | + if($this->_resultMaps->contains($key) == true) { |
|
211 | 211 | throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key); |
212 | 212 | } |
213 | 213 | $this->_resultMaps->add($key, $result); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function getParameterMap($name) |
230 | 230 | { |
231 | - if ($this->_parameterMaps->contains($name) == false) { |
|
231 | + if($this->_parameterMaps->contains($name) == false) { |
|
232 | 232 | throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name); |
233 | 233 | } |
234 | 234 | return $this->_parameterMaps[$name]; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | public function addParameterMap(TParameterMap $parameter) |
242 | 242 | { |
243 | 243 | $key = $parameter->getID(); |
244 | - if ($this->_parameterMaps->contains($key) == true) { |
|
244 | + if($this->_parameterMaps->contains($key) == true) { |
|
245 | 245 | throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key); |
246 | 246 | } |
247 | 247 | $this->_parameterMaps->add($key, $parameter); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function addCacheModel(TSqlMapCacheModel $cacheModel) |
256 | 256 | { |
257 | - if ($this->_cacheModels->contains($cacheModel->getID())) { |
|
257 | + if($this->_cacheModels->contains($cacheModel->getID())) { |
|
258 | 258 | throw new TSqlMapConfigurationException('sqlmap_cache_model_already_exists', $cacheModel->getID()); |
259 | 259 | } else { |
260 | 260 | $this->_cacheModels->add($cacheModel->getID(), $cacheModel); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function getCacheModel($name) |
271 | 271 | { |
272 | - if (!$this->_cacheModels->contains($name)) { |
|
272 | + if(!$this->_cacheModels->contains($name)) { |
|
273 | 273 | throw new TSqlMapConfigurationException('sqlmap_unable_to_find_cache_model', $name); |
274 | 274 | } |
275 | 275 | return $this->_cacheModels[$name]; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public function flushCacheModels() |
282 | 282 | { |
283 | - foreach ($this->_cacheModels as $cache) { |
|
283 | + foreach($this->_cacheModels as $cache) { |
|
284 | 284 | $cache->flush(); |
285 | 285 | } |
286 | 286 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | public function getType() |
52 | 52 | { |
53 | - if ($this->_type === null) { |
|
53 | + if($this->_type === null) { |
|
54 | 54 | return get_class($this); |
55 | 55 | } else { |
56 | 56 | return $this->_type; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $this->_cache->add($key, $value); |
42 | 42 | $this->_keyList->add($key); |
43 | - if ($this->_keyList->getCount() > $this->_cacheSize) { |
|
43 | + if($this->_keyList->getCount() > $this->_cacheSize) { |
|
44 | 44 | $oldestKey = $this->_keyList->removeAt(0); |
45 | 45 | $this->_cache->remove($oldestKey); |
46 | 46 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function get($key) |
29 | 29 | { |
30 | - if ($this->_keyList->contains($key)) { |
|
30 | + if($this->_keyList->contains($key)) { |
|
31 | 31 | $this->_keyList->remove($key); |
32 | 32 | $this->_keyList->add($key); |
33 | 33 | return $this->_cache->itemAt($key); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $this->_cache->add($key, $value); |
46 | 46 | $this->_keyList->add($key); |
47 | - if ($this->_keyList->getCount() > $this->_cacheSize) { |
|
47 | + if($this->_keyList->getCount() > $this->_cacheSize) { |
|
48 | 48 | $oldestKey = $this->_keyList->removeAt(0); |
49 | 49 | $this->_cache->remove($oldestKey); |
50 | 50 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | array_shift($args); |
31 | 31 | $n = count($args); |
32 | 32 | $tokens = []; |
33 | - for ($i = 0;$i < $n;++$i) { |
|
34 | - if ($args[$i] instanceof SimpleXMLElement) { |
|
33 | + for($i = 0; $i < $n; ++$i) { |
|
34 | + if($args[$i] instanceof SimpleXMLElement) { |
|
35 | 35 | $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
36 | 36 | } else { |
37 | 37 | $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | protected function implodeNode($node) |
48 | 48 | { |
49 | 49 | $attributes = []; |
50 | - foreach ($node->attributes() as $k => $v) { |
|
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
50 | + foreach($node->attributes() as $k => $v) { |
|
51 | + $attributes[] = $k . '="' . (string) $v . '"'; |
|
52 | 52 | } |
53 | 53 | return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
54 | 54 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $lang = Prado::getPreferredLanguage(); |
62 | 62 | $dir = dirname(__FILE__); |
63 | 63 | $msgFile = $dir . '/messages-' . $lang . '.txt'; |
64 | - if (!is_file($msgFile)) { |
|
64 | + if(!is_file($msgFile)) { |
|
65 | 65 | $msgFile = $dir . '/messages.txt'; |
66 | 66 | } |
67 | 67 | return $msgFile; |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | { |
126 | 126 | $total = $data instanceof TList ? $data->getCount() : count($data); |
127 | 127 | $pageSize = $this->getPageSize(); |
128 | - if ($total < 1) { |
|
128 | + if($total < 1) { |
|
129 | 129 | $param->setData($data); |
130 | 130 | $this->_prevPageList = null; |
131 | 131 | $this->_nextPageList = null; |
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if ($param->getNewPageIndex() < 1) { |
|
135 | + if($param->getNewPageIndex() < 1) { |
|
136 | 136 | $this->_prevPageList = null; |
137 | - if ($total <= $pageSize) { |
|
137 | + if($total <= $pageSize) { |
|
138 | 138 | $param->setData($data); |
139 | 139 | $this->_nextPageList = null; |
140 | 140 | } else { |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | $this->_nextPageList = array_slice($data, $pageSize - 1, $total); |
143 | 143 | } |
144 | 144 | } else { |
145 | - if ($total <= $pageSize) { |
|
145 | + if($total <= $pageSize) { |
|
146 | 146 | $this->_prevPageList = array_slice($data, 0, $total); |
147 | 147 | $param->setData([]); |
148 | 148 | $this->_nextPageList = null; |
149 | - } elseif ($total <= $pageSize * 2) { |
|
149 | + } elseif($total <= $pageSize * 2) { |
|
150 | 150 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
151 | 151 | $param->setData(array_slice($data, $pageSize, $total)); |
152 | 152 | $this->_nextPageList = null; |