@@ -79,16 +79,14 @@ |
||
| 79 | 79 | throw new TActiveRecordException('ar_invalid_tablename_property', |
| 80 | 80 | get_class($record), self::TABLE_CONST); |
| 81 | 81 | return $value; |
| 82 | - } |
|
| 83 | - elseif ($class->hasMethod(self::TABLE_METHOD)) |
|
| 82 | + } elseif ($class->hasMethod(self::TABLE_METHOD)) |
|
| 84 | 83 | { |
| 85 | 84 | $value = $record->{self::TABLE_METHOD}(); |
| 86 | 85 | if(empty($value)) |
| 87 | 86 | throw new TActiveRecordException('ar_invalid_tablename_method', |
| 88 | 87 | get_class($record), self::TABLE_METHOD); |
| 89 | 88 | return $value; |
| 90 | - } |
|
| 91 | - else |
|
| 89 | + } else |
|
| 92 | 90 | return strtolower(get_class($record)); |
| 93 | 91 | } |
| 94 | 92 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | get_class($record), self::TABLE_CONST); |
| 81 | 81 | return $value; |
| 82 | 82 | } |
| 83 | - elseif ($class->hasMethod(self::TABLE_METHOD)) |
|
| 83 | + elseif($class->hasMethod(self::TABLE_METHOD)) |
|
| 84 | 84 | { |
| 85 | 85 | $value = $record->{self::TABLE_METHOD}(); |
| 86 | 86 | if(empty($value)) |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | else |
| 362 | 362 | $values[$name] = $value; |
| 363 | 363 | } |
| 364 | - return [$values,$primary]; |
|
| 364 | + return [$values, $primary]; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | protected function updateAssociatedRecords(TActiveRecord $record, $updateBelongsTo = false) |
@@ -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 | |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | elseif(is_object($object)) |
| 145 | 145 | { |
| 146 | 146 | $setter = 'set' . $prop; |
| 147 | - if (method_exists($object, $setter) && is_callable([$object, $setter])) |
|
| 147 | + if(method_exists($object, $setter) && is_callable([$object, $setter])) |
|
| 148 | 148 | $object->{$setter}($value); |
| 149 | 149 | else |
| 150 | 150 | $object->{$prop} = $value; |
@@ -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 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $this -> getApplication() -> setGlobalState($key, time()); |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | - catch(\Exception $e) |
|
| 209 | + catch (\Exception $e) |
|
| 210 | 210 | { |
| 211 | 211 | // DB table not exists |
| 212 | 212 | if($this->_autoCreate) |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | $key = 'TDbCache:' . $this->_cacheTable . ':flushed'; |
| 251 | 251 | $now = time(); |
| 252 | - $next = $interval + (integer)$this -> getApplication() -> getGlobalState($key, 0); |
|
| 252 | + $next = $interval + (integer) $this -> getApplication() -> getGlobalState($key, 0); |
|
| 253 | 253 | |
| 254 | 254 | if($force || $next <= $now) |
| 255 | 255 | { |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | $command = $this->getDbConnection()->createCommand($sql); |
| 470 | 470 | return unserialize($command->queryScalar()); |
| 471 | 471 | } |
| 472 | - catch(\Exception $e) |
|
| 472 | + catch (\Exception $e) |
|
| 473 | 473 | { |
| 474 | 474 | $this->initializeCache(true); |
| 475 | 475 | return unserialize($command->queryScalar()); |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | protected function addValue($key, $value, $expire) |
| 504 | 504 | { |
| 505 | 505 | if(!$this->_cacheInitialized) $this->initializeCache(); |
| 506 | - $expire = ($expire <= 0)?0:time() + $expire; |
|
| 506 | + $expire = ($expire <= 0) ? 0 : time() + $expire; |
|
| 507 | 507 | $sql = "INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)"; |
| 508 | 508 | try |
| 509 | 509 | { |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $command->execute(); |
| 514 | 514 | return true; |
| 515 | 515 | } |
| 516 | - catch(\Exception $e) |
|
| 516 | + catch (\Exception $e) |
|
| 517 | 517 | { |
| 518 | 518 | try |
| 519 | 519 | { |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | $command->execute(); |
| 522 | 522 | return true; |
| 523 | 523 | } |
| 524 | - catch(\Exception $e) |
|
| 524 | + catch (\Exception $e) |
|
| 525 | 525 | { |
| 526 | 526 | return false; |
| 527 | 527 | } |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $command->execute(); |
| 545 | 545 | return true; |
| 546 | 546 | } |
| 547 | - catch(\Exception $e) |
|
| 547 | + catch (\Exception $e) |
|
| 548 | 548 | { |
| 549 | 549 | $this->initializeCache(true); |
| 550 | 550 | $command->execute(); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); |
| 565 | 565 | $command->execute(); |
| 566 | 566 | } |
| 567 | - catch(\Exception $e) |
|
| 567 | + catch (\Exception $e) |
|
| 568 | 568 | { |
| 569 | 569 | try |
| 570 | 570 | { |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | $command->execute(); |
| 573 | 573 | return true; |
| 574 | 574 | } |
| 575 | - catch(\Exception $e) |
|
| 575 | + catch (\Exception $e) |
|
| 576 | 576 | { |
| 577 | 577 | return false; |
| 578 | 578 | } |
@@ -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) |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | foreach($this->_servers as $server) |
| 165 | 165 | { |
| 166 | 166 | Prado::trace('Adding server ' . $server['Host'] . ' from serverlist', '\Prado\Caching\TMemCache'); |
| 167 | - if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'], |
|
| 167 | + if($this->_cache->addServer($server['Host'], $server['Port'], $server['Persistent'], |
|
| 168 | 168 | $server['Weight'], $server['Timeout'], $server['RetryInterval']) === false) |
| 169 | 169 | throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']); |
| 170 | 170 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | throw new TConfigurationException('memcache_serverport_required'); |
| 200 | 200 | if(!is_numeric($port)) |
| 201 | 201 | throw new TConfigurationException('memcache_serverport_invalid'); |
| 202 | - $server = ['Host' => $host,'Port' => $port,'Weight' => 1,'Timeout' => 1800,'RetryInterval' => 15,'Persistent' => true]; |
|
| 202 | + $server = ['Host' => $host, 'Port' => $port, 'Weight' => 1, 'Timeout' => 1800, 'RetryInterval' => 15, 'Persistent' => true]; |
|
| 203 | 203 | $checks = [ |
| 204 | 204 | 'Weight' => 'memcache_serverweight_invalid', |
| 205 | 205 | 'Timeout' => 'memcache_servertimeout_invalid', |
@@ -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(); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | $content = $this->getErrorTemplate($statusCode, $exception); |
| 197 | 197 | |
| 198 | - $serverAdmin = isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:''; |
|
| 198 | + $serverAdmin = isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : ''; |
|
| 199 | 199 | |
| 200 | 200 | $isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug; |
| 201 | 201 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | if($exception instanceof TTemplateException) |
| 263 | 263 | { |
| 264 | 264 | $fileName = $exception->getTemplateFile(); |
| 265 | - $lines = empty($fileName)?explode("\n", $exception->getTemplateSource()):@file($fileName); |
|
| 265 | + $lines = empty($fileName) ?explode("\n", $exception->getTemplateSource()) : @file($fileName); |
|
| 266 | 266 | $source = $this->getSourceCode($lines, $exception->getLineNumber()); |
| 267 | 267 | if($fileName === '') |
| 268 | 268 | $fileName = '---embedded template---'; |
@@ -425,11 +425,11 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | private function getSourceCode($lines, $errorLine) |
| 427 | 427 | { |
| 428 | - $beginLine = $errorLine - self::SOURCE_LINES >= 0?$errorLine - self::SOURCE_LINES:0; |
|
| 429 | - $endLine = $errorLine + self::SOURCE_LINES <= count($lines)?$errorLine + self::SOURCE_LINES:count($lines); |
|
| 428 | + $beginLine = $errorLine - self::SOURCE_LINES >= 0 ? $errorLine - self::SOURCE_LINES : 0; |
|
| 429 | + $endLine = $errorLine + self::SOURCE_LINES <= count($lines) ? $errorLine + self::SOURCE_LINES : count($lines); |
|
| 430 | 430 | |
| 431 | 431 | $source = ''; |
| 432 | - for($i = $beginLine;$i < $endLine;++$i) |
|
| 432 | + for($i = $beginLine; $i < $endLine; ++$i) |
|
| 433 | 433 | { |
| 434 | 434 | if($i === $errorLine - 1) |
| 435 | 435 | { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | private function addLink($message) { |
| 446 | - if (null !== ($class = $this->getErrorClassNameSpace($message))) { |
|
| 446 | + if(null !== ($class = $this->getErrorClassNameSpace($message))) { |
|
| 447 | 447 | return str_replace($class['name'], '<a href="' . $class['url'] . '" target="_blank">' . $class['name'] . '</a>', $message); |
| 448 | 448 | } |
| 449 | 449 | return $message; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | private function getErrorClassNameSpace($message) { |
| 453 | 453 | $matches = []; |
| 454 | 454 | preg_match('/\b(T[A-Z]\w+)\b/', $message, $matches); |
| 455 | - if (is_array($matches) && count($matches) > 0) { |
|
| 455 | + if(is_array($matches) && count($matches) > 0) { |
|
| 456 | 456 | $class = $matches[0]; |
| 457 | 457 | try { |
| 458 | 458 | $function = new \ReflectionClass($class); |
@@ -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 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | unset($module['properties']); |
| 260 | 260 | } |
| 261 | 261 | $properties['id'] = $id; |
| 262 | - $this->_modules[$id] = [$type,$properties,$module]; |
|
| 262 | + $this->_modules[$id] = [$type, $properties, $module]; |
|
| 263 | 263 | $this->_empty = false; |
| 264 | 264 | } |
| 265 | 265 | } |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | throw new TConfigurationException('appconfig_moduletype_required', $id); |
| 283 | 283 | $element->setParent(null); |
| 284 | 284 | if($id === null) |
| 285 | - $this->_modules[] = [$type,$properties->toArray(),$element]; |
|
| 285 | + $this->_modules[] = [$type, $properties->toArray(), $element]; |
|
| 286 | 286 | else |
| 287 | - $this->_modules[$id] = [$type,$properties->toArray(),$element]; |
|
| 287 | + $this->_modules[$id] = [$type, $properties->toArray(), $element]; |
|
| 288 | 288 | $this->_empty = false; |
| 289 | 289 | } |
| 290 | 290 | else |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $properties = isset($service['properties']) ? $service['properties'] : []; |
| 308 | 308 | unset($service['properties']); |
| 309 | 309 | $properties['id'] = $id; |
| 310 | - $this->_services[$id] = [$type,$properties,$service]; |
|
| 310 | + $this->_services[$id] = [$type, $properties, $service]; |
|
| 311 | 311 | $this->_empty = false; |
| 312 | 312 | } |
| 313 | 313 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | if(($type = $properties->remove('class')) === null) |
| 330 | 330 | throw new TConfigurationException('appconfig_servicetype_required', $id); |
| 331 | 331 | $element->setParent(null); |
| 332 | - $this->_services[$id] = [$type,$properties->toArray(),$element]; |
|
| 332 | + $this->_services[$id] = [$type, $properties->toArray(), $element]; |
|
| 333 | 333 | $this->_empty = false; |
| 334 | 334 | } |
| 335 | 335 | else |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | unset($parameter['class']); |
| 355 | 355 | $properties = isset($service['properties']) ? $service['properties'] : []; |
| 356 | 356 | $properties['id'] = $id; |
| 357 | - $this->_parameters[$id] = [$type,$properties]; |
|
| 357 | + $this->_parameters[$id] = [$type, $properties]; |
|
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | else |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | $this->_parameters[$id] = $value; |
| 387 | 387 | } |
| 388 | 388 | else |
| 389 | - $this->_parameters[$id] = [$type,$properties->toArray()]; |
|
| 389 | + $this->_parameters[$id] = [$type, $properties->toArray()]; |
|
| 390 | 390 | $this->_empty = false; |
| 391 | 391 | } |
| 392 | 392 | else |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | { |
| 404 | 404 | foreach($includeNode as $include) |
| 405 | 405 | { |
| 406 | - $when = isset($include['when'])?true:false; |
|
| 406 | + $when = isset($include['when']) ?true:false; |
|
| 407 | 407 | if(!isset($include['file'])) |
| 408 | 408 | throw new TConfigurationException('appconfig_includefile_required'); |
| 409 | 409 | $filePath = $include['file']; |
@@ -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 | |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $userFile = include $this->_userFile; |
| 119 | 119 | $this->loadUserDataFromPhp($userFile); |
| 120 | - } |
|
| 121 | - else |
|
| 120 | + } else |
|
| 122 | 121 | { |
| 123 | 122 | $dom = new TXmlDocument; |
| 124 | 123 | $dom->loadFromFile($this->_userFile); |
@@ -314,8 +313,7 @@ discard block |
||
| 314 | 313 | $user = new TUser($this); |
| 315 | 314 | $user->setIsGuest(true); |
| 316 | 315 | return $user; |
| 317 | - } |
|
| 318 | - else |
|
| 316 | + } else |
|
| 319 | 317 | { |
| 320 | 318 | $username = strtolower($username); |
| 321 | 319 | if(isset($this->_users[$username])) |
@@ -326,8 +324,7 @@ discard block |
||
| 326 | 324 | if(isset($this->_roles[$username])) |
| 327 | 325 | $user->setRoles($this->_roles[$username]); |
| 328 | 326 | return $user; |
| 329 | - } |
|
| 330 | - else |
|
| 327 | + } else |
|
| 331 | 328 | return null; |
| 332 | 329 | } |
| 333 | 330 | } |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | foreach($config['users'] as $user) |
| 152 | 152 | { |
| 153 | - $name = trim(strtolower(isset($user['name'])?$user['name']:'')); |
|
| 154 | - $password = isset($user['password'])?$user['password']:''; |
|
| 153 | + $name = trim(strtolower(isset($user['name']) ? $user['name'] : '')); |
|
| 154 | + $password = isset($user['password']) ? $user['password'] : ''; |
|
| 155 | 155 | $this->_users[$name] = $password; |
| 156 | - $roles = isset($user['roles'])?$user['roles']:''; |
|
| 156 | + $roles = isset($user['roles']) ? $user['roles'] : ''; |
|
| 157 | 157 | if($roles !== '') |
| 158 | 158 | { |
| 159 | 159 | foreach(explode(',', $roles) as $role) |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | foreach($config['roles'] as $role) |
| 170 | 170 | { |
| 171 | - $name = isset($role['name'])?$role['name']:''; |
|
| 172 | - $users = isset($role['users'])?$role['users']:''; |
|
| 171 | + $name = isset($role['name']) ? $role['name'] : ''; |
|
| 172 | + $users = isset($role['users']) ? $role['users'] : ''; |
|
| 173 | 173 | foreach(explode(',', $users) as $user) |
| 174 | 174 | { |
| 175 | 175 | if(($user = trim($user)) !== '') |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $username = strtolower($user->getName()); |
| 365 | 365 | if(isset($this->_users[$username])) |
| 366 | 366 | { |
| 367 | - $data = [$username,md5($username . $this->_users[$username])]; |
|
| 367 | + $data = [$username, md5($username . $this->_users[$username])]; |
|
| 368 | 368 | $cookie->setValue(serialize($data)); |
| 369 | 369 | } |
| 370 | 370 | } |