Passed
Push — master ( dd091e...934657 )
by 世昌
02:26
created
nebula/src/component/request/file/UploadedFile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 /**
8 8
  * HTTP请求文件
9 9
  */
10
-class UploadedFile  extends File  {
10
+class UploadedFile  extends File {
11 11
 
12 12
     private $originalName;
13 13
     private $mimeType;
Please login to merge, or discard this patch.
nebula/src/component/request/file/File.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 /**
6 6
  * HTTP请求文件
7 7
  */
8
-class File  extends \SplFileInfo  {
8
+class File  extends \SplFileInfo {
9 9
     /**
10 10
      * 创建文件
11 11
      *
Please login to merge, or discard this patch.
nebula/src/component/request/header/HeaderItem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @var array
29 29
      */
30
-    protected static $headers =[
30
+    protected static $headers = [
31 31
         'content-type' => ContentTypeItem::class,
32 32
     ];
33 33
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             if ($value instanceof HeaderItem) {
70 70
                 $header = $value;
71 71
             } elseif (array_key_exists($name, static::$headers)) {
72
-                $class =static::$headers[$name];
72
+                $class = static::$headers[$name];
73 73
                 $header = new $class($name, $value);
74 74
             } else {
75 75
                 $header = new HeaderItem($name, $value);
Please login to merge, or discard this patch.
nebula/src/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.
nebula/src/application/config/Config.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class Config extends ConfigLoader
11 11
 {
12
-    public $config=[];
12
+    public $config = [];
13 13
 
14
-    public function load(string $path, array $extra =[])
14
+    public function load(string $path, array $extra = [])
15 15
     {
16 16
         $data = $this->loadConfig($path, $extra);
17 17
         if ($data) {
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function assign(array $config)
28 28
     {
29
-        return $this->config=array_merge($this->config, $config);
29
+        return $this->config = array_merge($this->config, $config);
30 30
     }
31 31
 
32
-    public function get(string $name=null, $default=null)
32
+    public function get(string $name = null, $default = null)
33 33
     {
34 34
         if (is_null($name)) {
35 35
             return $this->config;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         return ArrayDotAccess::get($this->config, $name, $default);
38 38
     }
39 39
 
40
-    public function set(string $name, $value, $combine=null)
40
+    public function set(string $name, $value, $combine = null)
41 41
     {
42 42
         return ArrayDotAccess::set($this->config, $name, $value, $combine);
43 43
     }
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
         return ArrayDotAccess::exist($this->config, $name);
48 48
     }
49 49
 
50
-    public function parseValue(string $content, array $extra =[]):string
50
+    public function parseValue(string $content, array $extra = []):string
51 51
     {
52
-        return preg_replace_callback('/\$\{(.+?)\}/', function ($matchs) use ($extra) {
52
+        return preg_replace_callback('/\$\{(.+?)\}/', function($matchs) use ($extra) {
53 53
             $name = $matchs[1];
54
-            if (($value = ArrayDotAccess::get($extra, $name, null))!==null) {
54
+            if (($value = ArrayDotAccess::get($extra, $name, null)) !== null) {
55 55
             } elseif (defined($name)) {
56 56
                 $value = constant($name);
57 57
             } else {
58 58
                 $value = $this->get($name, $matchs[0]);
59 59
             }
60
-            return is_string($value)?trim(json_encode($value), '"'):$value;
60
+            return is_string($value) ?trim(json_encode($value), '"') : $value;
61 61
         }, $content);
62 62
     }
63 63
 }
Please login to merge, or discard this patch.
nebula/src/component/request/Request.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param mixed $default
67 67
      * @return mixed
68 68
      */
69
-    public function getHeader(string $name, $default =null)
69
+    public function getHeader(string $name, $default = null)
70 70
     {
71 71
         if (array_key_exists(strtolower($name), $this->headers)) {
72 72
             return $this->headers[$name];
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function ip()
94 94
     {
95
-        static $ipFrom = ['HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP','HTTP_FORWARDED_FOR','HTTP_FORWARDED','REMOTE_ADDR'];
95
+        static $ipFrom = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'];
96 96
         foreach ($ipFrom as $key) {
97 97
             if (array_key_exists($key, $_SERVER)) {
98 98
                 foreach (explode(',', $_SERVER[$key]) as $ip) {
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
         }
122 122
         $method = strtoupper($server['REQUEST_METHOD'] ?? 'GET');
123 123
         $uri = $server['REQUEST_URI']??'/';
124
-        $headers  = HeaderItem::buildFromServer($server ?: $_SERVER);
125
-        $request =  new Request($method, $uri, $headers);
124
+        $headers = HeaderItem::buildFromServer($server ?: $_SERVER);
125
+        $request = new Request($method, $uri, $headers);
126 126
         $request->setDocumentRoot($server['DOCUMENT_ROOT']);
127 127
         if ($simulate && $server !== null) {
128 128
             $request->setServer($server);
Please login to merge, or discard this patch.
nebula/src/component/loader/Path.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
14 14
      * @param string $path 目标路径 
15 15
      * @return string|null 返回格式化结果,如果路径不存在则返回NULL
16 16
      */
17
-    public static function format(string $path):?string
17
+    public static function format(string $path): ?string
18 18
     {
19
-        return static::existCharset($path, ['GBK','GB2312','BIG5']);
19
+        return static::existCharset($path, ['GBK', 'GB2312', 'BIG5']);
20 20
     }
21 21
  
22
-    public static function existCharset(string $path, array $charset):?string
22
+    public static function existCharset(string $path, array $charset): ?string
23 23
     {
24 24
         $abspath = static::toAbsolutePath($path);
25 25
         if (static::existCase($abspath)) {
Please login to merge, or discard this patch.
nebula/src/application/filesystem/FileSystemInterface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param string $name
57 57
      * @return string|null
58 58
      */
59
-    public static function get(string $filename):?string;
59
+    public static function get(string $filename): ?string;
60 60
 
61 61
 
62 62
     /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @param boolean $full
78 78
      * @return \Iterator
79 79
      */
80
-    public static function readFiles(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator;
80
+    public static function readFiles(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator;
81 81
     
82 82
     /**
83 83
      * 读目录下文件夹
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @param boolean $full
89 89
      * @return \Iterator
90 90
      */
91
-    public static function readDirs(string $path, bool $recursive=false, ?string $regex=null, bool $full=false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
91
+    public static function readDirs(string $path, bool $recursive = false, ?string $regex = null, bool $full = false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
92 92
     
93 93
     /**
94 94
      * 读目录,包括文件,文件夹
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param boolean $full
100 100
      * @return \Iterator
101 101
      */
102
-    public static function read(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
102
+    public static function read(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
103 103
 
104 104
     /**
105 105
      * 截断部分目录
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * @param boolean $move
120 120
      * @return boolean
121 121
      */
122
-    public static function copyDir(string $path, string $toPath, ?string $regex=null, bool $move = false):bool;
122
+    public static function copyDir(string $path, string $toPath, ?string $regex = null, bool $move = false):bool;
123 123
     
124 124
     /**
125 125
      * 移动文件夹
@@ -129,5 +129,5 @@  discard block
 block discarded – undo
129 129
      * @param string|null $regex
130 130
      * @return boolean
131 131
      */
132
-    public static function moveDir(string $path, string $toPath, ?string $regex=null):bool;
132
+    public static function moveDir(string $path, string $toPath, ?string $regex = null):bool;
133 133
 }
Please login to merge, or discard this patch.
nebula/src/application/filesystem/FileHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function delete(string $filename):bool
27 27
     {
28
-        if (($path=Path::format($filename)) !== null) {
28
+        if (($path = Path::format($filename)) !== null) {
29 29
             if (!is_writable($path)) {
30 30
                 return false;
31 31
             }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */    
44 44
     public static function move(string $src, string $dest):bool
45 45
     {
46
-        if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) {
46
+        if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) {
47 47
             return rename($path, $dest);
48 48
         }
49 49
         return false;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public static function copy(string $src, string $dest):bool
60 60
     {
61
-        if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) {
61
+        if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) {
62 62
             return copy($path, $dest);
63 63
         }
64 64
         return false;
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      * @param string $name
87 87
      * @return string|null
88 88
      */
89
-    public static function get(string $filename):?string
89
+    public static function get(string $filename): ?string
90 90
     {
91
-        if (is_readable($filename) && ($path=Path::format($filename)) !== null) {
91
+        if (is_readable($filename) && ($path = Path::format($filename)) !== null) {
92 92
             return file_get_contents($path);
93 93
         }
94 94
         return null;
Please login to merge, or discard this patch.