@@ -265,8 +265,9 @@ |
||
| 265 | 265 | */ |
| 266 | 266 | public function flushCacheModels() |
| 267 | 267 | { |
| 268 | - foreach($this->_cacheModels as $cache) |
|
| 269 | - $cache->flush(); |
|
| 268 | + foreach($this->_cacheModels as $cache) { |
|
| 269 | + $cache->flush(); |
|
| 270 | + } |
|
| 270 | 271 | } |
| 271 | 272 | } |
| 272 | 273 | |
@@ -40,8 +40,9 @@ |
||
| 40 | 40 | |
| 41 | 41 | protected function createParametersForTextCommand() |
| 42 | 42 | { |
| 43 | - foreach($this->_statement->ParameterMap()->getProperties() as $prop) |
|
| 44 | - $this->_preparedStatement->getParameterNames()->add($prop->getProperty()); |
|
| 43 | + foreach($this->_statement->ParameterMap()->getProperties() as $prop) { |
|
| 44 | + $this->_preparedStatement->getParameterNames()->add($prop->getProperty()); |
|
| 45 | + } |
|
| 45 | 46 | } |
| 46 | 47 | } |
| 47 | 48 | |
@@ -55,8 +55,9 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function flushContent() |
| 57 | 57 | { |
| 58 | - foreach($this->_writers as $writer) |
|
| 59 | - echo $writer->flush(); |
|
| 58 | + foreach($this->_writers as $writer) { |
|
| 59 | + echo $writer->flush(); |
|
| 60 | + } |
|
| 60 | 61 | parent::flushContent(); |
| 61 | 62 | } |
| 62 | 63 | |
@@ -205,8 +205,7 @@ discard block |
||
| 205 | 205 | $this -> _createCheck = true; |
| 206 | 206 | $this -> getApplication() -> setGlobalState($key, time()); |
| 207 | 207 | } |
| 208 | - } |
|
| 209 | - catch(\Exception $e) |
|
| 208 | + } catch(\Exception $e) |
|
| 210 | 209 | { |
| 211 | 210 | // DB table not exists |
| 212 | 211 | if($this->_autoCreate) |
@@ -229,8 +228,7 @@ discard block |
||
| 229 | 228 | |
| 230 | 229 | $this -> _createCheck = true; |
| 231 | 230 | $this -> getApplication() -> setGlobalState($key, time()); |
| 232 | - } |
|
| 233 | - else |
|
| 231 | + } else |
|
| 234 | 232 | throw new TConfigurationException('db_cachetable_inexistent', $this->_cacheTable); |
| 235 | 233 | } |
| 236 | 234 | $this->_cacheInitialized = true; |
@@ -299,8 +297,7 @@ discard block |
||
| 299 | 297 | return $config->getDbConnection(); |
| 300 | 298 | else |
| 301 | 299 | throw new TConfigurationException('dbcache_connectionid_invalid', $this->_connID); |
| 302 | - } |
|
| 303 | - else |
|
| 300 | + } else |
|
| 304 | 301 | { |
| 305 | 302 | $db = new TDbConnection; |
| 306 | 303 | if($this->_connectionString !== '') |
@@ -310,8 +307,7 @@ discard block |
||
| 310 | 307 | $db->setUsername($this->_username); |
| 311 | 308 | if($this->_password !== '') |
| 312 | 309 | $db->setPassword($this->_password); |
| 313 | - } |
|
| 314 | - else |
|
| 310 | + } else |
|
| 315 | 311 | { |
| 316 | 312 | // default to SQLite3 database |
| 317 | 313 | $dbFile = $this->getApplication()->getRuntimePath() . '/sqlite3.cache'; |
@@ -468,8 +464,7 @@ discard block |
||
| 468 | 464 | $sql = 'SELECT value FROM ' . $this->_cacheTable . ' WHERE itemkey=\'' . $key . '\' AND (expire=0 OR expire>' . time() . ') ORDER BY expire DESC'; |
| 469 | 465 | $command = $this->getDbConnection()->createCommand($sql); |
| 470 | 466 | return unserialize($command->queryScalar()); |
| 471 | - } |
|
| 472 | - catch(\Exception $e) |
|
| 467 | + } catch(\Exception $e) |
|
| 473 | 468 | { |
| 474 | 469 | $this->initializeCache(true); |
| 475 | 470 | return unserialize($command->queryScalar()); |
@@ -512,16 +507,14 @@ discard block |
||
| 512 | 507 | $command->bindValue(':value', serialize($value), \PDO::PARAM_LOB); |
| 513 | 508 | $command->execute(); |
| 514 | 509 | return true; |
| 515 | - } |
|
| 516 | - catch(\Exception $e) |
|
| 510 | + } catch(\Exception $e) |
|
| 517 | 511 | { |
| 518 | 512 | try |
| 519 | 513 | { |
| 520 | 514 | $this->initializeCache(true); |
| 521 | 515 | $command->execute(); |
| 522 | 516 | return true; |
| 523 | - } |
|
| 524 | - catch(\Exception $e) |
|
| 517 | + } catch(\Exception $e) |
|
| 525 | 518 | { |
| 526 | 519 | return false; |
| 527 | 520 | } |
@@ -543,8 +536,7 @@ discard block |
||
| 543 | 536 | $command->bindValue(':key', $key, \PDO::PARAM_STR); |
| 544 | 537 | $command->execute(); |
| 545 | 538 | return true; |
| 546 | - } |
|
| 547 | - catch(\Exception $e) |
|
| 539 | + } catch(\Exception $e) |
|
| 548 | 540 | { |
| 549 | 541 | $this->initializeCache(true); |
| 550 | 542 | $command->execute(); |
@@ -563,16 +555,14 @@ discard block |
||
| 563 | 555 | { |
| 564 | 556 | $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); |
| 565 | 557 | $command->execute(); |
| 566 | - } |
|
| 567 | - catch(\Exception $e) |
|
| 558 | + } catch(\Exception $e) |
|
| 568 | 559 | { |
| 569 | 560 | try |
| 570 | 561 | { |
| 571 | 562 | $this->initializeCache(true); |
| 572 | 563 | $command->execute(); |
| 573 | 564 | return true; |
| 574 | - } |
|
| 575 | - catch(\Exception $e) |
|
| 565 | + } catch(\Exception $e) |
|
| 576 | 566 | { |
| 577 | 567 | return false; |
| 578 | 568 | } |
@@ -168,8 +168,7 @@ |
||
| 168 | 168 | $server['Weight'], $server['Timeout'], $server['RetryInterval']) === false) |
| 169 | 169 | throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']); |
| 170 | 170 | } |
| 171 | - } |
|
| 172 | - else |
|
| 171 | + } else |
|
| 173 | 172 | { |
| 174 | 173 | Prado::trace('Adding server ' . $this->_host, '\Prado\Caching\TMemCache'); |
| 175 | 174 | if($this->_cache->addServer($this->_host, $this->_port) === false) |
@@ -166,8 +166,7 @@ |
||
| 166 | 166 | { |
| 167 | 167 | if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path)) |
| 168 | 168 | $timestamps = array_merge($this->generateTimestamps($path, $level + 1)); |
| 169 | - } |
|
| 170 | - elseif($this->validateFile($path)) |
|
| 169 | + } elseif($this->validateFile($path)) |
|
| 171 | 170 | $timestamps[$path] = filemtime($path); |
| 172 | 171 | } |
| 173 | 172 | closedir($dir); |
@@ -235,8 +235,7 @@ discard block |
||
| 235 | 235 | echo "<body><h1>Recursive Error</h1>\n"; |
| 236 | 236 | echo "<pre>" . $exception->__toString() . "</pre>\n"; |
| 237 | 237 | echo "</body></html>"; |
| 238 | - } |
|
| 239 | - else |
|
| 238 | + } else |
|
| 240 | 239 | { |
| 241 | 240 | error_log("Error happened while processing an existing error:\n" . $exception->__toString()); |
| 242 | 241 | header('HTTP/1.0 500 Internal Error'); |
@@ -267,15 +266,13 @@ discard block |
||
| 267 | 266 | if($fileName === '') |
| 268 | 267 | $fileName = '---embedded template---'; |
| 269 | 268 | $errorLine = $exception->getLineNumber(); |
| 270 | - } |
|
| 271 | - else |
|
| 269 | + } else |
|
| 272 | 270 | { |
| 273 | 271 | if(($trace = $this->getExactTrace($exception)) !== null) |
| 274 | 272 | { |
| 275 | 273 | $fileName = $trace['file']; |
| 276 | 274 | $errorLine = $trace['line']; |
| 277 | - } |
|
| 278 | - else |
|
| 275 | + } else |
|
| 279 | 276 | { |
| 280 | 277 | $fileName = $exception->getFile(); |
| 281 | 278 | $errorLine = $exception->getLine(); |
@@ -435,8 +432,7 @@ discard block |
||
| 435 | 432 | { |
| 436 | 433 | $line = htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", ' ', $lines[$i]))); |
| 437 | 434 | $source .= "<div class=\"error\">" . $line . "</div>"; |
| 438 | - } |
|
| 439 | - else |
|
| 435 | + } else |
|
| 440 | 436 | $source .= htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", ' ', $lines[$i]))); |
| 441 | 437 | } |
| 442 | 438 | return $source; |
@@ -456,8 +452,7 @@ discard block |
||
| 456 | 452 | $class = $matches[0]; |
| 457 | 453 | try { |
| 458 | 454 | $function = new \ReflectionClass($class); |
| 459 | - } |
|
| 460 | - catch (\Exception $e) { |
|
| 455 | + } catch (\Exception $e) { |
|
| 461 | 456 | return null; |
| 462 | 457 | } |
| 463 | 458 | $classname = $function->getNamespaceName(); |
@@ -70,8 +70,7 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | $fcontent = include $fname; |
| 72 | 72 | $this->loadFromPhp($fcontent, dirname($fname)); |
| 73 | - } |
|
| 74 | - else |
|
| 73 | + } else |
|
| 75 | 74 | { |
| 76 | 75 | $dom = new TXmlDocument; |
| 77 | 76 | $dom->loadFromFile($fname); |
@@ -218,8 +217,7 @@ discard block |
||
| 218 | 217 | if(isset($this->_aliases[$id])) |
| 219 | 218 | throw new TConfigurationException('appconfig_alias_redefined', $id); |
| 220 | 219 | $this->_aliases[$id] = $p; |
| 221 | - } |
|
| 222 | - else |
|
| 220 | + } else |
|
| 223 | 221 | throw new TConfigurationException('appconfig_alias_invalid'); |
| 224 | 222 | $this->_empty = false; |
| 225 | 223 | break; |
@@ -286,8 +284,7 @@ discard block |
||
| 286 | 284 | else |
| 287 | 285 | $this->_modules[$id] = [$type,$properties->toArray(),$element]; |
| 288 | 286 | $this->_empty = false; |
| 289 | - } |
|
| 290 | - else |
|
| 287 | + } else |
|
| 291 | 288 | throw new TConfigurationException('appconfig_modules_invalid', $element->getTagName()); |
| 292 | 289 | } |
| 293 | 290 | } |
@@ -331,8 +328,7 @@ discard block |
||
| 331 | 328 | $element->setParent(null); |
| 332 | 329 | $this->_services[$id] = [$type,$properties->toArray(),$element]; |
| 333 | 330 | $this->_empty = false; |
| 334 | - } |
|
| 335 | - else |
|
| 331 | + } else |
|
| 336 | 332 | throw new TConfigurationException('appconfig_services_invalid', $element->getTagName()); |
| 337 | 333 | } |
| 338 | 334 | } |
@@ -356,8 +352,7 @@ discard block |
||
| 356 | 352 | $properties['id'] = $id; |
| 357 | 353 | $this->_parameters[$id] = [$type,$properties]; |
| 358 | 354 | } |
| 359 | - } |
|
| 360 | - else |
|
| 355 | + } else |
|
| 361 | 356 | { |
| 362 | 357 | $this->_parameters[$id] = $parameter; |
| 363 | 358 | } |
@@ -384,12 +379,10 @@ discard block |
||
| 384 | 379 | $this->_parameters[$id] = $element; |
| 385 | 380 | else |
| 386 | 381 | $this->_parameters[$id] = $value; |
| 387 | - } |
|
| 388 | - else |
|
| 382 | + } else |
|
| 389 | 383 | $this->_parameters[$id] = [$type,$properties->toArray()]; |
| 390 | 384 | $this->_empty = false; |
| 391 | - } |
|
| 392 | - else |
|
| 385 | + } else |
|
| 393 | 386 | throw new TConfigurationException('appconfig_parameters_invalid', $element->getTagName()); |
| 394 | 387 | } |
| 395 | 388 | } |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | return ($decision > 0); |
| 42 | 42 | } |
| 43 | 43 | return true; |
| 44 | - } |
|
| 45 | - else |
|
| 44 | + } else |
|
| 46 | 45 | return false; |
| 47 | 46 | } |
| 48 | 47 | |