Passed
Push — dev ( 704976...a02dd0 )
by 世昌
02:38
created
suda/src/framework/filesystem/FileSystem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $absolute = PathTrait::toAbsolutePath($target);
39 39
         $root = PathTrait::toAbsolutePath($root);
40
-        return strpos($absolute, $root . DIRECTORY_SEPARATOR) !== 0;
40
+        return strpos($absolute, $root.DIRECTORY_SEPARATOR) !== 0;
41 41
     }
42 42
 
43 43
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
     protected static function tryWriteDirectory(string $path): bool
102 102
     {
103
-        $path = rtrim($path, '/') . '/' . md5(mt_rand(1, 100) . mt_rand(1, 100));
103
+        $path = rtrim($path, '/').'/'.md5(mt_rand(1, 100).mt_rand(1, 100));
104 104
         if (($fp = fopen($path, 'ab')) === false) {
105 105
             return false;
106 106
         }
Please login to merge, or discard this patch.
suda/loader/swoole.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . '/loader.php';
2
+require_once __DIR__.'/loader.php';
3 3
 
4 4
 use Swoole\Http\Server;
5 5
 use suda\swoole\Request;
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 // 初始化系统加载器
17 17
 $loader = new Loader;
18 18
 $loader->register();
19
-$loader->addIncludePath(SUDA_SYSTEM . '/src', 'suda');
19
+$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda');
20 20
 
21 21
 // 创建应用
22 22
 $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_APP_MANIFEST, SUDA_DATA);
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 $logger = new FileLogger(
31 31
     [
32 32
         'log-level' => SUDA_DEBUG_LEVEL,
33
-        'save-path' => $application->getDataPath() . '/logs',
34
-        'save-zip-path' => $application->getDataPath() . '/logs/zip',
35
-        'save-dump-path' => $application->getDataPath() . '/logs/dump',
33
+        'save-path' => $application->getDataPath().'/logs',
34
+        'save-zip-path' => $application->getDataPath().'/logs/zip',
35
+        'save-dump-path' => $application->getDataPath().'/logs/dump',
36 36
         'log-format' => '%message%',
37 37
     ]
38 38
 );
39 39
 
40 40
 $http = new Server(SUDA_SWOOLE_IP, SUDA_SWOOLE_PORT);
41 41
 
42
-$http->on('request', function ($request, $response) use ($application, $logger) {
42
+$http->on('request', function($request, $response) use ($application, $logger) {
43 43
     // 拷贝副本
44 44
     $runApplication = clone $application;
45 45
     $runLogger = clone $logger;
Please login to merge, or discard this patch.
server.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 $host = $argv[1] ?? '127.0.0.1:9501';
3 3
 list($ip, $port) = explode(':', $host);
4 4
 
5
-define('SUDA_APP', __DIR__ . '/app');
6
-define('SUDA_DATA', __DIR__ . '/data');
7
-define('SUDA_SYSTEM', __DIR__ . '/suda');
5
+define('SUDA_APP', __DIR__.'/app');
6
+define('SUDA_DATA', __DIR__.'/data');
7
+define('SUDA_SYSTEM', __DIR__.'/suda');
8 8
 define('SUDA_PUBLIC', __DIR__);
9 9
 define('SUDA_DEBUG', true);
10 10
 define('SUDA_DEBUG_LEVEL', 'debug');
11
-define('SUDA_APP_MANIFEST', SUDA_APP . '/manifest');
11
+define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest');
12 12
 
13 13
 // 设置IP或者端口
14 14
 define('SUDA_SWOOLE_IP', $ip);
Please login to merge, or discard this patch.
suda/src/framework/debug/log/logger/FileLogger.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $unique = substr(md5(uniqid()), 0, 8);
93 93
         $save = $this->getConfig('save-path');
94
-        $this->tempName = $save . '/' . date('YmdHis') . '.' . $unique . '.log';
94
+        $this->tempName = $save.'/'.date('YmdHis').'.'.$unique.'.log';
95 95
         $temp = fopen($this->tempName, 'w+');
96 96
         if ($temp !== false) {
97 97
             $this->temp = $temp;
98 98
         } else {
99
-            throw new FileLoggerException(__METHOD__ . ':' . sprintf('cannot create log file'));
99
+            throw new FileLoggerException(__METHOD__.':'.sprintf('cannot create log file'));
100 100
         }
101
-        $this->latest = $save . '/' . $this->getConfig('file-name');
101
+        $this->latest = $save.'/'.$this->getConfig('file-name');
102 102
     }
103 103
 
104 104
     /**
@@ -126,18 +126,18 @@  discard block
 block discarded – undo
126 126
         $path = preg_replace(
127 127
             '/[\\\\]+/',
128 128
             '/',
129
-            $this->getConfig('save-zip-path') . '/' . date('Y-m-d') . '.zip'
129
+            $this->getConfig('save-zip-path').'/'.date('Y-m-d').'.zip'
130 130
         );
131 131
         $zip = $this->getZipArchive($path);
132 132
         if ($zip !== null) {
133
-            $add = $zip->addFile($logFile, date('Y-m-d') . '-' . $zip->numFiles . '.log');
133
+            $add = $zip->addFile($logFile, date('Y-m-d').'-'.$zip->numFiles.'.log');
134 134
             if (is_dir($this->getConfig('save-dump-path'))) {
135 135
                 $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(
136 136
                     $this->getConfig('save-dump-path'),
137 137
                     RecursiveDirectoryIterator::SKIP_DOTS
138 138
                 ));
139 139
                 foreach ($it as $dumpLog) {
140
-                    if ($zip->addFile($dumpLog, 'dump/' . basename($dumpLog))) {
140
+                    if ($zip->addFile($dumpLog, 'dump/'.basename($dumpLog))) {
141 141
                         array_push($this->removeFiles, $dumpLog);
142 142
                     }
143 143
                 }
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
                 $this->safeMoveKeep(
152 152
                     $logFile,
153 153
                     $this->getConfig('save-path')
154
-                    . '/' . date('Y-m-d')
155
-                    . '-' . substr(md5(uniqid()), 0, 8). '.log'
154
+                    . '/'.date('Y-m-d')
155
+                    . '-'.substr(md5(uniqid()), 0, 8).'.log'
156 156
                 );
157 157
             }
158 158
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $fromFile = fopen($from, 'r');
168 168
         $toFile = fopen($to, 'w+');
169
-        if ($fromFile !== false  && $toFile !== false) {
169
+        if ($fromFile !== false && $toFile !== false) {
170 170
             flock($toFile, LOCK_EX);
171 171
             // 复制内容
172 172
             stream_copy_to_stream($fromFile, $toFile);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             $replace['%level%'] = $level;
244 244
             $replace['%message%'] = $message;
245 245
             $write = strtr($this->getConfig('log-format'), $replace);
246
-            fwrite($this->getAvailableWrite(), $write . PHP_EOL);
246
+            fwrite($this->getAvailableWrite(), $write.PHP_EOL);
247 247
         }
248 248
     }
249 249
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             } elseif (null === $val) {
321 321
                 $val = 'null';
322 322
             }
323
-            $replace['{' . $key . '}'] = $val;
323
+            $replace['{'.$key.'}'] = $val;
324 324
         }
325 325
         return strtr($message, $replace);
326 326
     }
Please login to merge, or discard this patch.