Passed
Push — dev ( 5026e0...59bedf )
by 世昌
02:20
created
suda/src/framework/debug/Caller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
     protected $ignorePath = [__FILE__];
12 12
     protected $backtrace;
13 13
 
14
-    public function __construct(array $backtrace, array $ignorePath =[])
14
+    public function __construct(array $backtrace, array $ignorePath = [])
15 15
     {
16 16
         $this->ignorePath = array_merge($this->ignorePath, $ignorePath);
17 17
         $this->backtrace = $backtrace;
18 18
     }
19 19
 
20
-    public function getCallerTrace():?array
20
+    public function getCallerTrace(): ?array
21 21
     {
22 22
         foreach ($this->backtrace as $trace) {
23 23
             if (array_key_exists('file', $trace)) {
Please login to merge, or discard this patch.
suda/src/framework/debug/attach/DumpTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
     protected static function valueToString(string $key, $value, int $deep):string
68 68
     {
69 69
         if (is_string($value) && strlen($value) > static::$dumpStringLength) {
70
-            return  $key.'='.json_encode(substr($value, 0, static::$dumpStringLength), JSON_UNESCAPED_UNICODE) .'... ,';
70
+            return  $key.'='.json_encode(substr($value, 0, static::$dumpStringLength), JSON_UNESCAPED_UNICODE).'... ,';
71 71
         } elseif (is_bool($value)) {
72 72
             return $key.'='.($value ? 'true' : 'false').' ,';
73 73
         } else {
74
-            return $key.'='.self::parameterToString($value, $deep - 1) .' ,';
74
+            return $key.'='.self::parameterToString($value, $deep - 1).' ,';
75 75
         }
76 76
     }
77 77
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         $argsDump = '';
120 120
         if (!empty($trace['args'])) {
121 121
             foreach ($trace['args'] as $arg) {
122
-                $argsDump .= self::parameterToString($arg) .',';
122
+                $argsDump .= self::parameterToString($arg).',';
123 123
             }
124 124
             $argsDump = rtrim($argsDump, ',');
125 125
         }
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 
130 130
     public static function dumpThrowable(Throwable $e)
131 131
     {
132
-        $dump = get_class($e).':'. $e->getMessage() .PHP_EOL;
133
-        $dump .= 'At: ' . $e->getFile().':'.$e->getLine().PHP_EOL;
132
+        $dump = get_class($e).':'.$e->getMessage().PHP_EOL;
133
+        $dump .= 'At: '.$e->getFile().':'.$e->getLine().PHP_EOL;
134 134
         $dump .= static::dumpTrace($e->getTrace());
135 135
         return $dump;
136 136
     }
Please login to merge, or discard this patch.
suda/src/framework/debug/attach/DumpInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  */
9 9
 interface DumpInterface 
10 10
 {
11
-    public static function parameterToString($object, int $deep=2);
11
+    public static function parameterToString($object, int $deep = 2);
12 12
     public static function dumpThrowable(Throwable $e);
13
-    public static function dumpTrace(array $backtrace, bool $str=true, string $perfix='');
13
+    public static function dumpTrace(array $backtrace, bool $str = true, string $perfix = '');
14 14
 }
Please login to merge, or discard this patch.
suda/src/framework/request/UriParser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             parse_str($query, $this->query);
39 39
         }
40 40
         $url = parse_url($url, PHP_URL_PATH);
41
-        $this->uri = '/' . trim($url, '\/');
41
+        $this->uri = '/'.trim($url, '\/');
42 42
     }
43 43
 
44 44
     public function getQuery():array
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         }
59 59
         if (strpos($url, $indexFile) === 0) {
60 60
             // for /index.php/
61
-            $url = substr($url, strlen($indexFile));// for /index.php?/
61
+            $url = substr($url, strlen($indexFile)); // for /index.php?/
62 62
             if (strpos($url, '?/') === 0) {
63 63
                 $url = ltrim($url, '?');
64 64
             }
Please login to merge, or discard this patch.
suda/src/framework/loader/Path.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
      * @param string $path 目标路径
17 17
      * @return string|null 返回格式化结果,如果路径不存在则返回NULL
18 18
      */
19
-    public static function format(string $path):?string
19
+    public static function format(string $path): ?string
20 20
     {
21
-        return static::existCharset($path, ['GBK','GB2312','BIG5']);
21
+        return static::existCharset($path, ['GBK', 'GB2312', 'BIG5']);
22 22
     }
23 23
 
24 24
     /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      * @param array $charset
27 27
      * @return string|null
28 28
      */
29
-    public static function existCharset(string $path, array $charset):?string
29
+    public static function existCharset(string $path, array $charset): ?string
30 30
     {
31 31
         $abspath = static::toAbsolutePath($path);
32 32
         if (static::existCase($abspath)) {
Please login to merge, or discard this patch.
suda/src/framework/loader/PathInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,5 +23,5 @@
 block discarded – undo
23 23
     /**
24 24
      * @return string|null
25 25
      */
26
-    public static function getHomePath():?string;
26
+    public static function getHomePath(): ?string;
27 27
 }
Please login to merge, or discard this patch.
suda/src/framework/filesystem/FileHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public static function delete(string $filename):bool
29 29
     {
30
-        if (($path=Path::format($filename)) !== null) {
30
+        if (($path = Path::format($filename)) !== null) {
31 31
             if (!is_writable($path)) {
32 32
                 return false;
33 33
             }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public static function move(string $src, string $dest):bool
47 47
     {
48
-        if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) {
48
+        if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) {
49 49
             return rename($path, $dest);
50 50
         }
51 51
         return false;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public static function copy(string $src, string $dest):bool
62 62
     {
63
-        if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) {
63
+        if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) {
64 64
             return copy($path, $dest);
65 65
         }
66 66
         return false;
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      * @param string $filename
89 89
      * @return string|null
90 90
      */
91
-    public static function get(string $filename):?string
91
+    public static function get(string $filename): ?string
92 92
     {
93
-        if (is_readable($filename) && ($path=Path::format($filename)) !== null) {
93
+        if (is_readable($filename) && ($path = Path::format($filename)) !== null) {
94 94
             return file_get_contents($path);
95 95
         }
96 96
         return null;
Please login to merge, or discard this patch.
suda/resource/suda_panic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 function suda_panic($error_type, $error_message, $error_code = 500)
3 3
 {
4
-    date_default_timezone_set(defined('DEFAULT_TIMEZONE')?constant('DEFAULT_TIMEZONE'):'PRC');
4
+    date_default_timezone_set(defined('DEFAULT_TIMEZONE') ?constant('DEFAULT_TIMEZONE') : 'PRC');
5 5
     header('HTTP/1.1 500 Internal Server Error');
6 6
     header('Status:500 Internal Server Error');
7 7
     ob_start();
8 8
     $error_sort_type = strpos($error_type, '\\') === false ? $error_type : substr($error_type, strrpos($error_type, '\\') + 1);
9
-    include __DIR__ .'/error.php';
9
+    include __DIR__.'/error.php';
10 10
     header('Content-Type:text/html; charset=UTF-8');
11 11
     header('Content-Length:'.ob_get_length());
12 12
     die(ob_get_clean());
Please login to merge, or discard this patch.
suda/src/framework/loader/Loader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param string $className
42 42
      * @return string|null
43 43
      */
44
-    public function getClassPath(string $className):?string
44
+    public function getClassPath(string $className): ?string
45 45
     {
46 46
         // 搜索路径
47 47
         foreach ($this->includePath as $includeNamespace => $includePaths) {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param string $filename
59 59
      * @return string|null
60 60
      */
61
-    public function import(string $filename):?string
61
+    public function import(string $filename): ?string
62 62
     {
63 63
         if ($filename = static::realPath($filename)) {
64 64
             @require_once $filename;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param string $className
102 102
      * @return string|null
103 103
      */
104
-    protected function getClassPathByAlias(string $includePath, string $className):?string
104
+    protected function getClassPathByAlias(string $includePath, string $className): ?string
105 105
     {
106 106
         $namepath = static::formatSeparator($className);
107 107
         $className = static::realName($className);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param string $className
127 127
      * @return string|null
128 128
      */
129
-    protected function getClassPathByName(string $includeNamespace, string $includePath, string $className):?string
129
+    protected function getClassPathByName(string $includeNamespace, string $includePath, string $className): ?string
130 130
     {
131 131
         if (is_numeric($includeNamespace)) {
132 132
             $path = $includePath.DIRECTORY_SEPARATOR.static::formatSeparator($className).'.php';
Please login to merge, or discard this patch.