Passed
Push — master ( 093846...a50b30 )
by 世昌
05:11 queued 10s
created
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/runnable/target/MethodTarget.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->method = $method;
61 61
         $static = $this->isStatic() ? '->' : '::';
62 62
         $name = is_object($object) ? get_class($object) : $object;
63
-        $this->name = $name . $static . $method;
63
+        $this->name = $name.$static.$method;
64 64
     }
65 65
 
66 66
     /**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         if (null === $this->requireFile) {
122 122
             $this->requireFile = $requireFile;
123
-            $this->name = $this->name . '@' . $requireFile;
123
+            $this->name = $this->name.'@'.$requireFile;
124 124
         }
125 125
         return $this;
126 126
     }
Please login to merge, or discard this patch.
suda/src/framework/filesystem/FileSystemInterface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param string $filename
62 62
      * @return string|null
63 63
      */
64
-    public static function get(string $filename):?string;
64
+    public static function get(string $filename): ?string;
65 65
 
66 66
 
67 67
     /**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param int $mode
85 85
      * @return Iterator
86 86
      */
87
-    public static function readFiles(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : Iterator;
87
+    public static function readFiles(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : Iterator;
88 88
 
89 89
     /**
90 90
      * 读目录下文件夹
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param int $mode
97 97
      * @return Iterator
98 98
      */
99
-    public static function readDirs(string $path, bool $recursive=false, ?string $regex=null, bool $full=false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
99
+    public static function readDirs(string $path, bool $recursive = false, ?string $regex = null, bool $full = false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
100 100
 
101 101
     /**
102 102
      * 读目录,包括文件,文件夹
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param int $mode
109 109
      * @return Iterator
110 110
      */
111
-    public static function read(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
111
+    public static function read(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
112 112
 
113 113
     /**
114 114
      * 截断部分目录
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param boolean $move
129 129
      * @return boolean
130 130
      */
131
-    public static function copyDir(string $path, string $toPath, ?string $regex=null, bool $move = false):bool;
131
+    public static function copyDir(string $path, string $toPath, ?string $regex = null, bool $move = false):bool;
132 132
     
133 133
     /**
134 134
      * 移动文件夹
@@ -138,5 +138,5 @@  discard block
 block discarded – undo
138 138
      * @param string|null $regex
139 139
      * @return boolean
140 140
      */
141
-    public static function moveDir(string $path, string $toPath, ?string $regex=null):bool;
141
+    public static function moveDir(string $path, string $toPath, ?string $regex = null):bool;
142 142
 }
Please login to merge, or discard this patch.
suda/src/application/template/compiler/EchoValueTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         // 任意变量名: 中文点下划线英文数字
16 16
         $code = preg_replace_callback(
17 17
             '/\B[$](\?)?[:]([.\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )?/ux',
18
-            [$this,'echoValueCallback'],
18
+            [$this, 'echoValueCallback'],
19 19
             $var
20 20
         );
21 21
         $error = preg_last_error();
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
     
28 28
     protected function echoValueCallback($matchs)
29 29
     {
30
-        $name=$matchs[2];
31
-        if ($matchs[1]==='?') {
30
+        $name = $matchs[2];
31
+        if ($matchs[1] === '?') {
32 32
             return '$this->has("'.$name.'")';
33 33
         }
34 34
         if (isset($matchs[4])) {
35 35
             if (preg_match('/\((.+)\)/', $matchs[4], $v)) {
36 36
                 $args = trim($v[1]);
37
-                $args= strlen($args) ?','.$args:'';
37
+                $args = strlen($args) ? ','.$args : '';
38 38
                 return '$this->get("'.$name.'"'.$args.')';
39 39
             }
40 40
         }
Please login to merge, or discard this patch.
suda/src/framework/http/Status.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     public static $statusTexts = [
10 10
         100 => 'Continue',
11 11
         101 => 'Switching Protocols',
12
-        102 => 'Processing',            // RFC2518
12
+        102 => 'Processing', // RFC2518
13 13
         103 => 'Early Hints',
14 14
         200 => 'OK',
15 15
         201 => 'Created',
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
         204 => 'No Content',
19 19
         205 => 'Reset Content',
20 20
         206 => 'Partial Content',
21
-        207 => 'Multi-Status',          // RFC4918
22
-        208 => 'Already Reported',      // RFC5842
23
-        226 => 'IM Used',               // RFC3229
21
+        207 => 'Multi-Status', // RFC4918
22
+        208 => 'Already Reported', // RFC5842
23
+        226 => 'IM Used', // RFC3229
24 24
         300 => 'Multiple Choices',
25 25
         301 => 'Moved Permanently',
26 26
         302 => 'Found',
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         304 => 'Not Modified',
29 29
         305 => 'Use Proxy',
30 30
         307 => 'Temporary Redirect',
31
-        308 => 'Permanent Redirect',    // RFC7238
31
+        308 => 'Permanent Redirect', // RFC7238
32 32
         400 => 'Bad Request',
33 33
         401 => 'Unauthorized',
34 34
         402 => 'Payment Required',
@@ -47,34 +47,34 @@  discard block
 block discarded – undo
47 47
         415 => 'Unsupported Media Type',
48 48
         416 => 'Range Not Satisfiable',
49 49
         417 => 'Expectation Failed',
50
-        418 => 'I\'m a teapot',                                               // RFC2324
51
-        421 => 'Misdirected Request',                                         // RFC7540
52
-        422 => 'Unprocessable Entity',                                        // RFC4918
53
-        423 => 'Locked',                                                      // RFC4918
54
-        424 => 'Failed Dependency',                                           // RFC4918
55
-        425 => 'Too Early',                                                   // RFC-ietf-httpbis-replay-04
56
-        426 => 'Upgrade Required',                                            // RFC2817
57
-        428 => 'Precondition Required',                                       // RFC6585
58
-        429 => 'Too Many Requests',                                           // RFC6585
59
-        431 => 'Request Header TableStruct Too Large',                             // RFC6585
60
-        451 => 'Unavailable For Legal Reasons',                               // RFC7725
50
+        418 => 'I\'m a teapot', // RFC2324
51
+        421 => 'Misdirected Request', // RFC7540
52
+        422 => 'Unprocessable Entity', // RFC4918
53
+        423 => 'Locked', // RFC4918
54
+        424 => 'Failed Dependency', // RFC4918
55
+        425 => 'Too Early', // RFC-ietf-httpbis-replay-04
56
+        426 => 'Upgrade Required', // RFC2817
57
+        428 => 'Precondition Required', // RFC6585
58
+        429 => 'Too Many Requests', // RFC6585
59
+        431 => 'Request Header TableStruct Too Large', // RFC6585
60
+        451 => 'Unavailable For Legal Reasons', // RFC7725
61 61
         500 => 'Internal Server Error',
62 62
         501 => 'Not Implemented',
63 63
         502 => 'Bad Gateway',
64 64
         503 => 'Service Unavailable',
65 65
         504 => 'Gateway Timeout',
66 66
         505 => 'HTTP Version Not Supported',
67
-        506 => 'Variant Also Negotiates',                                     // RFC2295
68
-        507 => 'Insufficient Storage',                                        // RFC4918
69
-        508 => 'Loop Detected',                                               // RFC5842
70
-        510 => 'Not Extended',                                                // RFC2774
71
-        511 => 'Network Authentication Required',                             // RFC6585
67
+        506 => 'Variant Also Negotiates', // RFC2295
68
+        507 => 'Insufficient Storage', // RFC4918
69
+        508 => 'Loop Detected', // RFC5842
70
+        510 => 'Not Extended', // RFC2774
71
+        511 => 'Network Authentication Required', // RFC6585
72 72
     ];
73 73
 
74 74
     const HTTP_CONTINUE = 100;
75 75
     const HTTP_SWITCHING_PROTOCOLS = 101;
76
-    const HTTP_PROCESSING = 102;            // RFC2518
77
-    const HTTP_EARLY_HINTS = 103;           // RFC8297
76
+    const HTTP_PROCESSING = 102; // RFC2518
77
+    const HTTP_EARLY_HINTS = 103; // RFC8297
78 78
     const HTTP_OK = 200;
79 79
     const HTTP_CREATED = 201;
80 80
     const HTTP_ACCEPTED = 202;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
     const HTTP_NO_CONTENT = 204;
83 83
     const HTTP_RESET_CONTENT = 205;
84 84
     const HTTP_PARTIAL_CONTENT = 206;
85
-    const HTTP_MULTI_STATUS = 207;          // RFC4918
86
-    const HTTP_ALREADY_REPORTED = 208;      // RFC5842
87
-    const HTTP_IM_USED = 226;               // RFC3229
85
+    const HTTP_MULTI_STATUS = 207; // RFC4918
86
+    const HTTP_ALREADY_REPORTED = 208; // RFC5842
87
+    const HTTP_IM_USED = 226; // RFC3229
88 88
     const HTTP_MULTIPLE_CHOICES = 300;
89 89
     const HTTP_MOVED_PERMANENTLY = 301;
90 90
     const HTTP_FOUND = 302;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     const HTTP_USE_PROXY = 305;
94 94
     const HTTP_RESERVED = 306;
95 95
     const HTTP_TEMPORARY_REDIRECT = 307;
96
-    const HTTP_PERMANENTLY_REDIRECT = 308;  // RFC7238
96
+    const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238
97 97
     const HTTP_BAD_REQUEST = 400;
98 98
     const HTTP_UNAUTHORIZED = 401;
99 99
     const HTTP_PAYMENT_REQUIRED = 402;
@@ -112,21 +112,21 @@  discard block
 block discarded – undo
112 112
     const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
113 113
     const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
114 114
     const HTTP_EXPECTATION_FAILED = 417;
115
-    const HTTP_I_AM_A_TEAPOT = 418;                                               // RFC2324
116
-    const HTTP_MISDIRECTED_REQUEST = 421;                                         // RFC7540
117
-    const HTTP_UNPROCESSABLE_ENTITY = 422;                                        // RFC4918
118
-    const HTTP_LOCKED = 423;                                                      // RFC4918
119
-    const HTTP_FAILED_DEPENDENCY = 424;                                           // RFC4918
115
+    const HTTP_I_AM_A_TEAPOT = 418; // RFC2324
116
+    const HTTP_MISDIRECTED_REQUEST = 421; // RFC7540
117
+    const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918
118
+    const HTTP_LOCKED = 423; // RFC4918
119
+    const HTTP_FAILED_DEPENDENCY = 424; // RFC4918
120 120
 
121 121
     /**
122 122
      * @deprecated
123 123
      */
124
-    const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425;   // RFC2817
125
-    const HTTP_TOO_EARLY = 425;                                                   // RFC-ietf-httpbis-replay-04
126
-    const HTTP_UPGRADE_REQUIRED = 426;                                            // RFC2817
127
-    const HTTP_PRECONDITION_REQUIRED = 428;                                       // RFC6585
128
-    const HTTP_TOO_MANY_REQUESTS = 429;                                           // RFC6585
129
-    const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;                             // RFC6585
124
+    const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
125
+    const HTTP_TOO_EARLY = 425; // RFC-ietf-httpbis-replay-04
126
+    const HTTP_UPGRADE_REQUIRED = 426; // RFC2817
127
+    const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
128
+    const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
129
+    const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
130 130
     const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
131 131
     const HTTP_INTERNAL_SERVER_ERROR = 500;
132 132
     const HTTP_NOT_IMPLEMENTED = 501;
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
     const HTTP_SERVICE_UNAVAILABLE = 503;
135 135
     const HTTP_GATEWAY_TIMEOUT = 504;
136 136
     const HTTP_VERSION_NOT_SUPPORTED = 505;
137
-    const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506;                        // RFC2295
138
-    const HTTP_INSUFFICIENT_STORAGE = 507;                                        // RFC4918
139
-    const HTTP_LOOP_DETECTED = 508;                                               // RFC5842
140
-    const HTTP_NOT_EXTENDED = 510;                                                // RFC2774
137
+    const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
138
+    const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918
139
+    const HTTP_LOOP_DETECTED = 508; // RFC5842
140
+    const HTTP_NOT_EXTENDED = 510; // RFC2774
141 141
     const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511;
142 142
 
143 143
     /**
Please login to merge, or discard this patch.
suda/src/application/Module.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getFullName(): string
111 111
     {
112
-        return $this->getName() . ':' . $this->getVersion();
112
+        return $this->getName().':'.$this->getVersion();
113 113
     }
114 114
 
115 115
     /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function getUriSafeName(): string
121 121
     {
122
-        return $this->getName() . '/' . $this->getVersion();
122
+        return $this->getName().'/'.$this->getVersion();
123 123
     }
124 124
 
125 125
     /**
Please login to merge, or discard this patch.
suda/src/application/template/ExceptionTemplate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@
 block discarded – undo
14 14
     public function __construct(Throwable $exception)
15 15
     {
16 16
         parent::__construct('', []);
17
-        $this->path = SUDA_RESOURCE. '/error.php';
17
+        $this->path = SUDA_RESOURCE.'/error.php';
18 18
         $type = get_class($exception);
19 19
         $this->value = [
20
-            'error_type' => $type ,
20
+            'error_type' => $type,
21 21
             'error_sort_type' => strpos($type, '\\') === false ? $type : substr($type, strrpos($type, '\\') + 1),
22 22
             'error_code' => $exception->getCode(),
23 23
             'error_message' => $exception->getMessage(),
Please login to merge, or discard this patch.
suda/src/framework/route/uri/MatcherHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         // 添加 * ? 匹配
37 37
         $url = str_replace(['\*', '\?'], ['[^/]*?', '[^/]'], $url);
38 38
         // 编译页面参数
39
-        $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function ($match) use (&$parameters) {
39
+        $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function($match) use (&$parameters) {
40 40
             $name = $match[1];
41 41
             $type = 'string';
42 42
             $extra = '';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $url = static::parseIgnorableParameter($url, $matcher, $parameter, $mapper);
71 71
         $url = static::replaceParameter($url, $matcher, $parameter, $mapper);
72 72
         if (count($query) && $allowQuery) {
73
-            return $url . '?' . http_build_query($query, 'v', '&', PHP_QUERY_RFC3986);
73
+            return $url.'?'.http_build_query($query, 'v', '&', PHP_QUERY_RFC3986);
74 74
         }
75 75
         return $url;
76 76
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         array $parameter,
89 89
         array $mapper
90 90
     ): string {
91
-        return preg_replace_callback('/\[(.+?)\]/', function ($match) use ($matcher, $parameter, $mapper) {
91
+        return preg_replace_callback('/\[(.+?)\]/', function($match) use ($matcher, $parameter, $mapper) {
92 92
             if (preg_match('/\{(\w+).+?\}/', $match[1])) {
93 93
                 $count = 0;
94 94
                 $subUrl = static::replaceParameter($match[1], $matcher, $parameter, $mapper, true, $count);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         foreach ($parameter as $key => $value) {
108 108
             if (is_numeric($key)) {
109 109
                 $mp = $matcher->getParameterByIndex($key);
110
-                if ($mp  !== null) {
110
+                if ($mp !== null) {
111 111
                     unset($parameter[$key]);
112 112
                     $key = $mp->getIndexName();
113 113
                     $parameter[$key] = $value;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     ) {
144 144
         return preg_replace_callback(
145 145
             '/\{(\w+).+?\}/',
146
-            function ($match) use ($matcher, $parameter, $mapper, $ignore, &$count) {
146
+            function($match) use ($matcher, $parameter, $mapper, $ignore, &$count) {
147 147
                 if (array_key_exists($match[1], $mapper)) {
148 148
                     $count++;
149 149
                     return $mapper[$match[1]]->packValue($parameter[$match[1]]);
Please login to merge, or discard this patch.
suda/src/framework/runnable/target/TargetBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         $methodStart = $splitLength ?: strpos($command, '::') ?: $dynmicsMethod;
63 63
         $parameter = self::buildParameter($parameter);
64 64
         if ($methodStart > 0) {
65
-            $splitLength = $splitLength > 0 ? 1:2;
65
+            $splitLength = $splitLength > 0 ? 1 : 2;
66 66
             $methodName = substr($command, $methodStart + $splitLength);
67 67
             $command = substr($command, 0, $methodStart);
68 68
             list($className, $constructParameter) = self::splitParameter($command);
69 69
             $constructParameter = self::buildParameter($constructParameter);
70
-            $target = new MethodTarget($className, $dynmicsMethod? $constructParameter :null, $methodName, $parameter);
70
+            $target = new MethodTarget($className, $dynmicsMethod ? $constructParameter : null, $methodName, $parameter);
71 71
         } else {
72 72
             $target = new FunctionTarget(self::buildName($command), $parameter);
73 73
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         if (preg_match('/^[\w\\\\\/.]+$/', $name) !== 1) {
100 100
             throw new InvalidNameException(sprintf('invalid name: %s ', $name));
101 101
         }
102
-        return  str_replace(['.','/'], '\\', $name);
102
+        return  str_replace(['.', '/'], '\\', $name);
103 103
     }
104 104
 
105 105
     private static function splitParameter(string $command):array
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             $parameter = substr($command, $paramStart + 1, strlen($command) - $paramStart - 2);
111 111
             $command = substr($command, 0, $paramStart);
112 112
         }
113
-        return [$command,$parameter];
113
+        return [$command, $parameter];
114 114
     }
115 115
 
116 116
     private static function buildParameter(?string $parameter)
Please login to merge, or discard this patch.