@@ -8,25 +8,25 @@ discard block |
||
8 | 8 | use suda\application\builder\ApplicationBuilder; |
9 | 9 | use suda\framework\http\HTTPResponse as Response; |
10 | 10 | |
11 | -require_once __DIR__ . '/loader.php'; |
|
11 | +require_once __DIR__.'/loader.php'; |
|
12 | 12 | |
13 | 13 | // 初始化系统加载器 |
14 | 14 | $loader = new Loader; |
15 | 15 | $loader->register(); |
16 | -$loader->addIncludePath(SUDA_SYSTEM . '/src', 'suda'); |
|
16 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
17 | 17 | // 初始化数据目录 |
18 | 18 | defined('SUDA_DATA') or define('SUDA_DATA', Path::toAbsolutePath('~/data')); |
19 | -defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP . '/manifest'); |
|
19 | +defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest'); |
|
20 | 20 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_APP_MANIFEST, SUDA_DATA); |
21 | 21 | // 日志路径 |
22 | -defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', $application->getDataPath() . '/logs'); |
|
22 | +defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', $application->getDataPath().'/logs'); |
|
23 | 23 | // 文件日志 |
24 | 24 | $logger = new FileLogger( |
25 | 25 | [ |
26 | 26 | 'log-level' => SUDA_DEBUG_LEVEL, |
27 | 27 | 'save-path' => SUDA_DEBUG_LOG_PATH, |
28 | - 'save-dump-path' => SUDA_DEBUG_LOG_PATH . '/dump', |
|
29 | - 'save-zip-path' => SUDA_DEBUG_LOG_PATH . '/zip', |
|
28 | + 'save-dump-path' => SUDA_DEBUG_LOG_PATH.'/dump', |
|
29 | + 'save-zip-path' => SUDA_DEBUG_LOG_PATH.'/zip', |
|
30 | 30 | 'log-format' => '%message%', |
31 | 31 | ] |
32 | 32 | ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'start-time' => defined('SUDA_START_TIME') ? constant('SUDA_START_TIME') : microtime(true), |
38 | 38 | 'start-memory' => defined('SUDA_START_MEMORY') ? constant('SUDA_START_MEMORY') : memory_get_usage(), |
39 | 39 | ]); |
40 | -$application->getConfig()->set('save-dump-path', SUDA_DEBUG_LOG_PATH . '/dump'); |
|
40 | +$application->getConfig()->set('save-dump-path', SUDA_DEBUG_LOG_PATH.'/dump'); |
|
41 | 41 | $application->getConfig()->set('response-timing', SUDA_DEBUG); |
42 | 42 | $application->run(Request::create(), new Response); |
43 | 43 | exit; |
@@ -47,7 +47,7 @@ |
||
47 | 47 | { |
48 | 48 | $this->count++; |
49 | 49 | $query = $connection->prefix($statement->getString()); |
50 | - $this->debug->recordTiming('query', $timeSpend, $this->count . ' queries'); |
|
50 | + $this->debug->recordTiming('query', $timeSpend, $this->count.' queries'); |
|
51 | 51 | $status = $result ? 'OK' : 'Err'; |
52 | 52 | if ($result) { |
53 | 53 | $effect = $statement->getStatement()->rowCount(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->config = $config; |
79 | 79 | $this->name = $name ?? 'anonymous'; |
80 | 80 | $this->observer = new NullObserver; |
81 | - register_shutdown_function(function () { |
|
81 | + register_shutdown_function(function() { |
|
82 | 82 | $this->onBeforeSystemShutdown(); |
83 | 83 | }); |
84 | 84 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->pdo = $this->createPDO(); |
109 | 109 | $this->observer->connectionDatabase(microtime(true) - $time); |
110 | 110 | $this->id = static::$connectionCount; |
111 | - static::$connectionCount ++; |
|
111 | + static::$connectionCount++; |
|
112 | 112 | } catch (PDOException $e) { |
113 | 113 | throw new SQLException(sprintf( |
114 | 114 | "%s connect database error:%s", |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function beginTransaction() |
183 | 183 | { |
184 | - $this->transaction ++; |
|
184 | + $this->transaction++; |
|
185 | 185 | if ($this->transaction == 1) { |
186 | 186 | $this->pdo->beginTransaction(); |
187 | 187 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . '/loader.php'; |
|
2 | +require_once __DIR__.'/loader.php'; |
|
3 | 3 | |
4 | 4 | use suda\framework\debug\log\logger\NullLogger; |
5 | 5 | use Swoole\Http\Server; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | // 初始化系统加载器 |
19 | 19 | $loader = new Loader; |
20 | 20 | $loader->register(); |
21 | -$loader->addIncludePath(SUDA_SYSTEM . '/src', 'suda'); |
|
21 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
22 | 22 | // 创建应用 |
23 | 23 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_APP_MANIFEST, SUDA_DATA); |
24 | 24 | // 不复制资源 |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | 'log_file' => $logger->getConfig('save-dump-path').'/swoole.log', |
43 | 43 | ]); |
44 | 44 | |
45 | -$application->config()->set('save-dump-path', SUDA_DEBUG_LOG_PATH . '/dump'); |
|
45 | +$application->config()->set('save-dump-path', SUDA_DEBUG_LOG_PATH.'/dump'); |
|
46 | 46 | $application->config()->set('response-timing', SUDA_DEBUG); |
47 | 47 | |
48 | 48 | $application->setDebug(new Debugger($application, new NullLogger())); |
49 | 49 | |
50 | -$http->on('request', function ($request, $response) use ($application, $logger) { |
|
50 | +$http->on('request', function($request, $response) use ($application, $logger) { |
|
51 | 51 | // 拷贝副本 |
52 | 52 | $runApplication = clone $application; |
53 | 53 | $runLogger = clone $logger; |
@@ -65,9 +65,9 @@ |
||
65 | 65 | $desc = $info['description']; |
66 | 66 | $ms = number_format($time * 1000, 3); |
67 | 67 | if (strlen($desc)) { |
68 | - $timing[] = $name . ';desc="' . $desc . '";dur=' . $ms; |
|
68 | + $timing[] = $name.';desc="'.$desc.'";dur='.$ms; |
|
69 | 69 | } else { |
70 | - $timing[] = $name . ';dur=' . $ms; |
|
70 | + $timing[] = $name.';dur='.$ms; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | $response->setHeader('server-timing', implode(',', $timing)); |