Passed
Push — master ( c4f942...fa5a0e )
by 世昌
03:00
created
nebula/src/component/debug/Debug.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 class Debug implements LoggerInterface, LoggerAwareInterface, DumpInterface, AttachInterface, ConfigInterface
18 18
 {
19
-    use LoggerTrait,LoggerAwareTrait,DumpTrait,AttachTrait,ConfigTrait;
19
+    use LoggerTrait, LoggerAwareTrait, DumpTrait, AttachTrait, ConfigTrait;
20 20
 
21 21
     /**
22 22
      * 时间记录
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $replace = [];
53 53
         foreach ($context as $key => $val) {
54
-            $replace['{' . $key . '}'] = $val;
54
+            $replace['{'.$key.'}'] = $val;
55 55
         }
56 56
         return strtr($message, $replace);
57 57
     }
@@ -67,26 +67,26 @@  discard block
 block discarded – undo
67 67
         return $attribute;
68 68
     }
69 69
 
70
-    protected static function formatBytes(int $bytes, int $precision=0)
70
+    protected static function formatBytes(int $bytes, int $precision = 0)
71 71
     {
72
-        $human= ['B', 'KB', 'MB', 'GB', 'TB'];
72
+        $human = ['B', 'KB', 'MB', 'GB', 'TB'];
73 73
         $bytes = max($bytes, 0);
74
-        $pow = floor(($bytes?log($bytes):0)/log(1024));
75
-        $pos = min($pow, count($human)-1);
76
-        $bytes /= (1 << (10* $pos));
74
+        $pow = floor(($bytes ?log($bytes) : 0) / log(1024));
75
+        $pos = min($pow, count($human) - 1);
76
+        $bytes /= (1 << (10 * $pos));
77 77
         return round($bytes, $precision).' '.$human[$pos];
78 78
     }
79 79
 
80
-    public function time(string $name, string $type= LogLevel::INFO)
80
+    public function time(string $name, string $type = LogLevel::INFO)
81 81
     {
82
-        $this->timeRecord[$name]=['time'=>microtime(true),'level'=>$type];
82
+        $this->timeRecord[$name] = ['time'=>microtime(true), 'level'=>$type];
83 83
     }
84 84
 
85 85
     public function timeEnd(string $name)
86 86
     {
87 87
         if (\array_key_exists($name, $this->timeRecord)) {
88
-            $pass=microtime(true)-$this->timeRecord[$name]['time'];
89
-            $this->log($this->timeRecord[$name]['level'], 'process cost '. $name.' '. number_format($pass, 5).'s');
88
+            $pass = microtime(true) - $this->timeRecord[$name]['time'];
89
+            $this->log($this->timeRecord[$name]['level'], 'process cost '.$name.' '.number_format($pass, 5).'s');
90 90
             return $pass;
91 91
         }
92 92
         return 0;
Please login to merge, or discard this patch.
nebula/src/component/debug/Caller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
     protected $ignorePath = [__FILE__];
10 10
     protected $backtrace;
11 11
 
12
-    public function __construct(array $backtrace, array $ignorePath =[])
12
+    public function __construct(array $backtrace, array $ignorePath = [])
13 13
     {
14 14
         $this->ignorePath = \array_merge($this->ignorePath, $ignorePath);
15 15
         $this->backtrace = $backtrace;
16 16
     }
17 17
 
18
-    public function getCallerTrace():?array
18
+    public function getCallerTrace(): ?array
19 19
     {
20 20
         foreach ($this->backtrace as $trace) {
21 21
             if (array_key_exists('file', $trace)) {
Please login to merge, or discard this patch.
nebula/src/component/debug/log/logger/ConsoleLogger.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
 {
11 11
     public function log($level, string $message, array $context = [])
12 12
     {
13
-        print date('Y-m-d H:i:s') .' ' . $this->interpolate($message, $context) . PHP_EOL;
13
+        print date('Y-m-d H:i:s').' '.$this->interpolate($message, $context).PHP_EOL;
14 14
     }
15 15
     public function interpolate(string $message, array $context)
16 16
     {
17 17
         $replace = [];
18 18
         foreach ($context as $key => $val) {
19
-            $replace['{' . $key . '}'] = $val;
19
+            $replace['{'.$key.'}'] = $val;
20 20
         }
21 21
         return strtr($message, $replace);
22 22
     }
Please login to merge, or discard this patch.
nebula/src/component/debug/ConfigInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace nebula\component\debug;
3 3
 
4
-interface ConfigInterface  {
4
+interface ConfigInterface {
5 5
     public function applyConfig(array $config);
6 6
 }
Please login to merge, or discard this patch.
nebula/src/component/debug/ConfigTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     }
21 21
     public function getConfig(string $name) {
22 22
         $defaultConfig = $this->getDefaultConfig();
23
-        return $this->config[$name] ?? $defaultConfig[$name];;
23
+        return $this->config[$name] ?? $defaultConfig[$name]; ;
24 24
     }
25 25
 
26 26
     abstract public function getDefaultConfig():array;
Please login to merge, or discard this patch.
nebula/src/component/cacheable/CacheInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
      * @param int $expire 过期时间
16 16
      * @return bool
17 17
      */
18
-    public function set(string $name, $value, int $expire=null):bool;
18
+    public function set(string $name, $value, int $expire = null):bool;
19 19
 
20 20
     /**
21 21
      * 获取值
22 22
      * @param string $name 名
23 23
      * @return mixed|null
24 24
      */
25
-    public function get(string $name, $defalut=null);
25
+    public function get(string $name, $defalut = null);
26 26
 
27 27
     /**
28 28
      * 删除值
Please login to merge, or discard this patch.
nebula/src/component/arrayobject/ArrayDump.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
         $exstr = '';
41 41
         foreach ($array as $key => $value) {
42 42
             $line = '';
43
-            $current=$arrname."['".addslashes($key)."']";
43
+            $current = $arrname."['".addslashes($key)."']";
44 44
             if (is_array($value)) {
45 45
                 $line .= self::parserArraySub($current, $value);
46 46
             } else {
47
-                $line =  $current;
47
+                $line = $current;
48 48
                 if (is_string($value)) {
49 49
                     $line .= "='".addslashes($value).'\';'.PHP_EOL;
50 50
                 } elseif (is_bool($value)) {
Please login to merge, or discard this patch.
nebula/src/component/arrayobject/ArrayDotAccess.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @param mixed $def
88 88
      * @return array 设置后的数组
89 89
      */
90
-    public static function set(array &$array, string $name, $value, $def=null):array
90
+    public static function set(array &$array, string $name, $value, $def = null):array
91 91
     {
92 92
         $path = explode('.', $name);
93 93
         $root = &$array;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                     $array[$key] = [];
99 99
                 }
100 100
             } else {
101
-                $array=[];
101
+                $array = [];
102 102
             }
103 103
             $array = &$array[$key];
104 104
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                     $array[$key] = [];
122 122
                 }
123 123
             } else {
124
-                $array=[];
124
+                $array = [];
125 125
             }
126 126
             $array = &$array[$key];
127 127
         }
Please login to merge, or discard this patch.
nebula/src/component/filesystem/ReadLineIterator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
             while (!feof($fp)) {
41 41
                 fseek($fp, $offset);
42 42
                 $content = fread($fp, $this->bufferSize);
43
-                $content.=(feof($fp))? "\n":'';
43
+                $content .= (feof($fp)) ? "\n" : '';
44 44
                 $size = strpos($content, "\n");
45 45
                 $offset += $size;
46 46
                 if ($content[$size - 1] === "\r") {
47
-                    $content = substr($content, 0, $size -1);
47
+                    $content = substr($content, 0, $size - 1);
48 48
                 } else {
49 49
                     $content = substr($content, 0, $size);
50 50
                 }
Please login to merge, or discard this patch.