Passed
Push — master ( c061fa...c1447f )
by 世昌
02:22
created
nebula/src/component/debug/log/logger/FileLogger.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
      * @throws FileLoggerException
47 47
      * @param array $config
48 48
      */
49
-    public function __construct(array $config=[])
49
+    public function __construct(array $config = [])
50 50
     {
51 51
         $this->applyConfig($config);
52 52
         $temp = tmpfile();
53 53
         if ($temp === false) {
54
-            $this->tempname = $this->getConfig('save-path').'/log-'. microtime(true).'.tmp';
54
+            $this->tempname = $this->getConfig('save-path').'/log-'.microtime(true).'.tmp';
55 55
             $temp = fopen($this->tempname, 'w+');
56 56
         }
57 57
         if ($temp !== false) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             throw new FileLoggerException(__CLASS__.':'.sprintf('cannot create log file'));
61 61
         }
62 62
         $this->latest = $this->getConfig('save-path').'/'.$this->getConfig('file-name');
63
-        \register_shutdown_function([$this,'save']);
63
+        \register_shutdown_function([$this, 'save']);
64 64
     }
65 65
 
66 66
     public function getDefaultConfig():array
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
     
79 79
     protected function packLogFile()
80 80
     {
81
-        $logFile= $this->latest;
82
-        $path=preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path') .'/'.date('Y-m-d').'.zip');
81
+        $logFile = $this->latest;
82
+        $path = preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path').'/'.date('Y-m-d').'.zip');
83 83
         $zip = new ZipArchive;
84 84
         $res = $zip->open($path, ZipArchive::CREATE);
85 85
         if ($res === true) {
86
-            if ($zip->addFile($logFile, date('Y-m-d'). '-'. $zip->numFiles .'.log')) {
86
+            if ($zip->addFile($logFile, date('Y-m-d').'-'.$zip->numFiles.'.log')) {
87 87
                 array_push($this->removeFiles, $logFile);
88 88
             }
89 89
             if (\is_dir($this->getConfig('save-pack-path'))) {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $zip->close();
98 98
         } else {
99 99
             if (is_file($logFile) && file_exists($logFile)) {
100
-                rename($logFile, $this->getConfig('save-path') . '/' . date('Y-m-d'). '-'. substr(md5_file($logFile), 0, 8).'.log');
100
+                rename($logFile, $this->getConfig('save-path').'/'.date('Y-m-d').'-'.substr(md5_file($logFile), 0, 8).'.log');
101 101
             }
102 102
         }
103 103
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     protected function checkSize():bool
111 111
     {
112
-        $logFile= $this->latest;
112
+        $logFile = $this->latest;
113 113
         if (file_exists($logFile)) {
114 114
             if (filesize($logFile) > $this->getConfig('max-file-size')) {
115 115
                 return true;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     public function log($level, string $message, array $context = [])
123 123
     {
124
-        if (LogLevel::compare($level, $this->getConfig('log-level')) >=0) {
124
+        if (LogLevel::compare($level, $this->getConfig('log-level')) >= 0) {
125 125
             $replace = [];
126 126
             $message = $this->interpolate($message, $context);
127 127
             $replace['%level%'] = $level;
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
     protected function rollLatest()
135 135
     {
136 136
         if (isset($this->latest)) {
137
-            $size=ftell($this->temp);
137
+            $size = ftell($this->temp);
138 138
             fseek($this->temp, 0);
139 139
             if ($size > 0) {
140
-                $body=fread($this->temp, $size);
140
+                $body = fread($this->temp, $size);
141 141
                 file_put_contents($this->latest, $body, FILE_APPEND);
142 142
             }
143 143
             fclose($this->temp);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             } elseif (is_null($val)) {
175 175
                 $val = 'null';
176 176
             }
177
-            $replace['{' . $key . '}'] = $val;
177
+            $replace['{'.$key.'}'] = $val;
178 178
         }
179 179
         return strtr($message, $replace);
180 180
     }
Please login to merge, or discard this patch.
nebula/src/application/route/MatchResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
             $object = $class->getMethod('instance')->invoke(null);
164 164
             $context->setResponse($object);
165 165
             $class->getMethod('proccess')->invokeArgs($object, [
166
-                new Runnable([$object,'onRequest']),
166
+                new Runnable([$object, 'onRequest']),
167 167
                 $context->getRequest(),
168 168
                 $this->matcher->getAttribute('buffer', true),
169 169
                 $context->isDebug(),
Please login to merge, or discard this patch.
nebula/src/application/response/Response.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function setStatus(int $code)
86 86
     {
87
-        $this->header->sendHeaderRaw('HTTP/1.1 '.$code.' '. Status::toText($code));
88
-        $this->header->sendHeader('Status', $code.' '. Status::toText($code));
87
+        $this->header->sendHeaderRaw('HTTP/1.1 '.$code.' '.Status::toText($code));
88
+        $this->header->sendHeader('Status', $code.' '.Status::toText($code));
89 89
     }
90 90
 
91 91
     /**
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
     {
129 129
         list($echo, $value) = $this->getRenderInfo($runnable, $request, $buffer);
130 130
         $this->header->send();
131
-        $wantEcho = strlen($echo) > 0 ;
131
+        $wantEcho = strlen($echo) > 0;
132 132
         $noReturn = $wantEcho && is_null($value);
133 133
         if ($noReturn && $wantEcho) {
134 134
             $this->send($echo);
135 135
         } else {
136
-            if ($allowEcho &&  $wantEcho) {
136
+            if ($allowEcho && $wantEcho) {
137 137
                 echo $echo;
138 138
             }
139 139
             Content::send($this, $value);
Please login to merge, or discard this patch.