@@ -99,8 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $found = true; |
| 101 | 101 | $childs[$key][$node] = []; |
| 102 | - } |
|
| 103 | - else |
|
| 102 | + } else |
|
| 104 | 103 | { |
| 105 | 104 | $found = $found || $this->addNode($childs[$key], $parent, $node); |
| 106 | 105 | } |
@@ -113,8 +112,9 @@ discard block |
||
| 113 | 112 | */ |
| 114 | 113 | public function collect() |
| 115 | 114 | { |
| 116 | - while(count($this->_tree) > 0) |
|
| 117 | - $this->collectChildren(null, $this->_tree); |
|
| 115 | + while(count($this->_tree) > 0) { |
|
| 116 | + $this->collectChildren(null, $this->_tree); |
|
| 117 | + } |
|
| 118 | 118 | return $this->getCollection(); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -147,8 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $childs[] = $key; |
| 149 | 149 | unset($nodes[$key]); |
| 150 | - } |
|
| 151 | - else |
|
| 150 | + } else |
|
| 152 | 151 | $this->collectChildren($key, $nodes[$key]); |
| 153 | 152 | } |
| 154 | 153 | if(count($childs) > 0) |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | $object = $object[$prop]; |
| 66 | 66 | else |
| 67 | 67 | throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
| 68 | - } |
|
| 69 | - elseif(is_object($object)) |
|
| 68 | + } elseif(is_object($object)) |
|
| 70 | 69 | { |
| 71 | 70 | $getter = 'get' . $prop; |
| 72 | 71 | if(method_exists($object, $getter) && is_callable([$object, $getter])) |
@@ -77,8 +76,7 @@ discard block |
||
| 77 | 76 | $object = $object->{$prop}; |
| 78 | 77 | else |
| 79 | 78 | throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
| 80 | - } |
|
| 81 | - else |
|
| 79 | + } else |
|
| 82 | 80 | throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
| 83 | 81 | } |
| 84 | 82 | return $object; |
@@ -102,8 +100,7 @@ discard block |
||
| 102 | 100 | $object = $object[$prop]; |
| 103 | 101 | else |
| 104 | 102 | return false; |
| 105 | - } |
|
| 106 | - elseif(is_object($object)) |
|
| 103 | + } elseif(is_object($object)) |
|
| 107 | 104 | { |
| 108 | 105 | $getter = 'get' . $prop; |
| 109 | 106 | if(method_exists($object, $getter) && is_callable([$object, $getter])) |
@@ -114,8 +111,7 @@ discard block |
||
| 114 | 111 | $object = $object->{$prop}; |
| 115 | 112 | else |
| 116 | 113 | return false; |
| 117 | - } |
|
| 118 | - else |
|
| 114 | + } else |
|
| 119 | 115 | return false; |
| 120 | 116 | } |
| 121 | 117 | return true; |
@@ -140,16 +136,14 @@ discard block |
||
| 140 | 136 | if(is_array($object) || $object instanceof \ArrayAccess) |
| 141 | 137 | { |
| 142 | 138 | $object[$prop] = $value; |
| 143 | - } |
|
| 144 | - elseif(is_object($object)) |
|
| 139 | + } elseif(is_object($object)) |
|
| 145 | 140 | { |
| 146 | 141 | $setter = 'set' . $prop; |
| 147 | 142 | if (method_exists($object, $setter) && is_callable([$object, $setter])) |
| 148 | 143 | $object->{$setter}($value); |
| 149 | 144 | else |
| 150 | 145 | $object->{$prop} = $value; |
| 151 | - } |
|
| 152 | - else |
|
| 146 | + } else |
|
| 153 | 147 | throw new TInvalidPropertyException('sqlmap_invalid_property_type', $path); |
| 154 | 148 | } |
| 155 | 149 | |
@@ -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); |
@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | $am = self::$_application->getAssetManager(); |
| 162 | 162 | $url = $am->publishFilePath(self::getPathOfNamespace('Prado\\' . $logoName, '.gif')); |
| 163 | - } |
|
| 164 | - else |
|
| 163 | + } else |
|
| 165 | 164 | $url = 'http://pradosoft.github.io/docs/' . $logoName . '.gif'; |
| 166 | 165 | return '<a title="Powered by PRADO" href="https://github.com/pradosoft/prado" target="_blank"><img src="' . $url . '" style="border-width:0px;" alt="Powered by PRADO" /></a>'; |
| 167 | 166 | } |
@@ -213,8 +212,7 @@ discard block |
||
| 213 | 212 | if(self::$_application !== null && ($errorHandler = self::$_application->getErrorHandler()) !== null) |
| 214 | 213 | { |
| 215 | 214 | $errorHandler->handleError(null, $exception); |
| 216 | - } |
|
| 217 | - else |
|
| 215 | + } else |
|
| 218 | 216 | { |
| 219 | 217 | echo $exception; |
| 220 | 218 | } |
@@ -328,8 +326,7 @@ discard block |
||
| 328 | 326 | return $component; |
| 329 | 327 | break; |
| 330 | 328 | } |
| 331 | - } |
|
| 332 | - else |
|
| 329 | + } else |
|
| 333 | 330 | return new $type; |
| 334 | 331 | } |
| 335 | 332 | |
@@ -383,8 +380,7 @@ discard block |
||
| 383 | 380 | if($className === '*') // a directory |
| 384 | 381 | { |
| 385 | 382 | self::$_usings[substr($namespace, 0, $pos)] = $path; |
| 386 | - } |
|
| 387 | - else // a file |
|
| 383 | + } else // a file |
|
| 388 | 384 | { |
| 389 | 385 | //self::$_usings[$namespace]=$path; |
| 390 | 386 | if(!$checkClassExistence || (!class_exists($className, false) && !interface_exists($className, false))) |
@@ -394,8 +390,7 @@ discard block |
||
| 394 | 390 | include_once($path); |
| 395 | 391 | if(class_exists($namespace, false) || interface_exists($namespace, false)) |
| 396 | 392 | class_alias($namespace, $className); |
| 397 | - } |
|
| 398 | - catch(\Exception $e) |
|
| 393 | + } catch(\Exception $e) |
|
| 399 | 394 | { |
| 400 | 395 | if($checkClassExistence && !class_exists($className, false)) |
| 401 | 396 | throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage()); |
@@ -471,8 +466,7 @@ discard block |
||
| 471 | 466 | self::$_aliases[$alias] = $rp; |
| 472 | 467 | else |
| 473 | 468 | throw new TInvalidDataValueException('prado_aliasname_invalid', $alias); |
| 474 | - } |
|
| 475 | - else |
|
| 469 | + } else |
|
| 476 | 470 | throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path); |
| 477 | 471 | } |
| 478 | 472 | |
@@ -517,8 +511,7 @@ discard block |
||
| 517 | 511 | echo "'" . substr($str, 0, 70) . "...'"; |
| 518 | 512 | else |
| 519 | 513 | echo "'" . $str . "'"; |
| 520 | - } |
|
| 521 | - elseif (is_int($item) || is_float($item)) |
|
| 514 | + } elseif (is_int($item) || is_float($item)) |
|
| 522 | 515 | echo $item; |
| 523 | 516 | elseif (is_object($item)) |
| 524 | 517 | echo get_class($item); |
@@ -613,8 +606,7 @@ discard block |
||
| 613 | 606 | if(isset($trace[0]['file']) && isset($trace[0]['line'])) |
| 614 | 607 | $msg .= " (line {$trace[0]['line']}, {$trace[0]['file']})"; |
| 615 | 608 | $level = TLogger::DEBUG; |
| 616 | - } |
|
| 617 | - else |
|
| 609 | + } else |
|
| 618 | 610 | $level = TLogger::INFO; |
| 619 | 611 | self::log($msg, $level, $category, $ctl); |
| 620 | 612 | } |
@@ -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 | |