Passed
Push — master ( bd72d4...a51a38 )
by 世昌
02:21
created
nebula/component/debug/log/logger/FileLogger.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected $attach;
35 35
 
36
-    public function __construct(array $config=[], array $attribute=[])
36
+    public function __construct(array $config = [], array $attribute = [])
37 37
     {
38 38
         $this->applyConfig($config);
39 39
         $this->attribute = $attribute;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
         $this->attribute['message'] = $this->interpolate($message, $context);
64 64
         $write = $this->interpolate($this->config['log-format'], $replace);
65 65
         foreach ($this->attach as $name => $value) {
66
-            $write.=PHP_EOL.$name .'<' . get_class($val).'>'.PHP_EOL;
66
+            $write .= PHP_EOL.$name.'<'.get_class($val).'>'.PHP_EOL;
67 67
             if ($value instanceof AttachAttribute) {
68
-                $write.= $value->getLogAttach().PHP_EOL;
68
+                $write .= $value->getLogAttach().PHP_EOL;
69 69
             } elseif ($value instanceof \Exception) {
70
-                $write.= AttachTrait::dumpException($value).PHP_EOL;
70
+                $write .= AttachTrait::dumpException($value).PHP_EOL;
71 71
             } else {
72
-                $write.= AttachTrait::parameterToString($value).PHP_EOL;
72
+                $write .= AttachTrait::parameterToString($value).PHP_EOL;
73 73
             }
74 74
         }
75 75
         // write file
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $replace = [];
81 81
         foreach ($context as $key => $val) {
82 82
             if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
83
-                $replace['{' . $key . '}'] = $val;
83
+                $replace['{'.$key.'}'] = $val;
84 84
             } else {
85 85
                 $this->attach[$key] = $val;
86 86
             }
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $replace = [];
94 94
         foreach ($context as $key => $val) {
95
-            $replace['{' . $key . '}'] = $val;
95
+            $replace['{'.$key.'}'] = $val;
96 96
         }
97 97
         foreach ($this->attribute as $key => $val) {
98
-            $replace['%' . $key . '%'] = $val;
98
+            $replace['%'.$key.'%'] = $val;
99 99
         }
100 100
         return strtr($message, $replace);
101 101
     }
Please login to merge, or discard this patch.
nebula/component/debug/log/logger/filelogger/AttachAttribute.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 interface AttachAttribute 
8 8
 {
9 9
     public function getLogAttach():string;
10
-    public static function parameterToString($object, int $deep=2);
10
+    public static function parameterToString($object, int $deep = 2);
11 11
     public static function dumpException(\Exception $e);
12
-    public static function dumpTrace(array $backtrace, bool $str=true, string $perfix='');
12
+    public static function dumpTrace(array $backtrace, bool $str = true, string $perfix = '');
13 13
 }
Please login to merge, or discard this patch.
nebula/component/debug/log/logger/filelogger/AttachTrait.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 trait AttachTrait 
8 8
 {
9
-    public static function parameterToString($object, int $deep=2)
9
+    public static function parameterToString($object, int $deep = 2)
10 10
     {
11 11
         if (is_null($object)) {
12 12
             return 'NULL';
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
             if ($deep > 0) {
18 18
                 $vars = get_class_vars($objectName);
19 19
                 foreach ($vars as $key => $value) {
20
-                    if (is_string($value) && strlen($value) >  self::$strLength) {
21
-                        $parameterString .= $key.'='.json_encode(substr($value, 0, 80), JSON_UNESCAPED_UNICODE) .'...,';
20
+                    if (is_string($value) && strlen($value) > self::$strLength) {
21
+                        $parameterString .= $key.'='.json_encode(substr($value, 0, 80), JSON_UNESCAPED_UNICODE).'...,';
22 22
                     } else {
23
-                        $parameterString .= $key.'='.self::parameterToString($value, $deep-1) .',';
23
+                        $parameterString .= $key.'='.self::parameterToString($value, $deep - 1).',';
24 24
                     }
25 25
                 }
26 26
             } else {
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
             if ($deep > 0) {
34 34
                 foreach ($object as $key => $value) {
35 35
                     if (is_string($value) && strlen($value) > self::$strLength) {
36
-                        $parameterString .=  json_encode(substr($value, 0, 80), JSON_UNESCAPED_UNICODE) .'...,';
36
+                        $parameterString .= json_encode(substr($value, 0, 80), JSON_UNESCAPED_UNICODE).'...,';
37 37
                     } else {
38
-                        $parameterString .= static::parameterToString($value, $deep-1) .',';
38
+                        $parameterString .= static::parameterToString($value, $deep - 1).',';
39 39
                     }
40 40
                 }
41 41
             } else {
@@ -46,33 +46,33 @@  discard block
 block discarded – undo
46 46
         return $object;
47 47
     }
48 48
 
49
-    public static function printTrace(array $backtrace, bool $str=true, string $perfix='')
49
+    public static function printTrace(array $backtrace, bool $str = true, string $perfix = '')
50 50
     {
51
-        $tracesConsole=[];
51
+        $tracesConsole = [];
52 52
         foreach ($backtrace as $trace) {
53 53
             $printDump = null;
54 54
             if (isset($trace['file'])) {
55
-                $printDump=$trace['file'].':'.$trace['line'];
55
+                $printDump = $trace['file'].':'.$trace['line'];
56 56
             }
57 57
             if (isset($trace['class'])) {
58 58
                 $function = $trace['class'].$trace['type'].$trace['function'];
59 59
             } else {
60 60
                 $function = $trace['function'];
61 61
             }
62
-            $argsDump='';
62
+            $argsDump = '';
63 63
             if (!empty($trace['args'])) {
64 64
                 foreach ($trace['args'] as $arg) {
65
-                    $argsDump.= self::parameterToString($arg) .',';
65
+                    $argsDump .= self::parameterToString($arg).',';
66 66
                 }
67 67
                 $argsDump = rtrim($argsDump, ',');
68 68
             }
69
-            $printDump.=' '.$function.'('.$argsDump.')';
70
-            $tracesConsole[]=$printDump;
69
+            $printDump .= ' '.$function.'('.$argsDump.')';
70
+            $tracesConsole[] = $printDump;
71 71
         }
72 72
         if ($str) {
73
-            $str='';
73
+            $str = '';
74 74
             foreach ($tracesConsole as $trace_info) {
75
-                $str.=$perfix.preg_replace('/\n/', "\n".$perfix."\t", $trace_info).PHP_EOL;
75
+                $str .= $perfix.preg_replace('/\n/', "\n".$perfix."\t", $trace_info).PHP_EOL;
76 76
             }
77 77
             return $str;
78 78
         }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     }
81 81
 
82 82
     public static function dumpException(\Exception $e) {
83
-        $dump = $e->getMessage() .PHP_EOL;
84
-        $dump.= 'At: ' . $e->getFile().':'.$e->getLine().PHP_EOL;
85
-        $dump.= static::printTrace($e->getTrace());
83
+        $dump = $e->getMessage().PHP_EOL;
84
+        $dump .= 'At: '.$e->getFile().':'.$e->getLine().PHP_EOL;
85
+        $dump .= static::printTrace($e->getTrace());
86 86
         return $dump;
87 87
     } 
88 88
 }
Please login to merge, or discard this patch.
nebula/component/database/connector/Connector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
         if (is_null($this->pdo)) {
86 86
             try {
87 87
                 $this->pdo = new PDO($this->getDsn(), $this->config['database-user'], $this->config['database-password']);
88
-                static::$connetionCount ++;
88
+                static::$connetionCount++;
89 89
             } catch (PDOException $e) {
90 90
                 throw new ConnectionException($e->getMessage(), $e->getCode());
91 91
             }
Please login to merge, or discard this patch.