Passed
Push — master ( 1c163d...8b0ed1 )
by 世昌
02:04
created
nebula/src/application/response/provider/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 Fields 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 Fields 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.
nebula/src/application/response/provider/MimeType.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
      */
14 14
     protected static $mimes = [
15 15
         # Image Type
16
-        'jpe' => 'image/jpeg' ,
17
-        'jpeg' => 'image/jpeg' ,
18
-        'jpg' => 'image/jpeg' ,
19
-        'svg' => 'image/svg+xml' ,
20
-        'png' => 'image/png' ,
21
-        'gif' => 'image/gif' ,
16
+        'jpe' => 'image/jpeg',
17
+        'jpeg' => 'image/jpeg',
18
+        'jpg' => 'image/jpeg',
19
+        'svg' => 'image/svg+xml',
20
+        'png' => 'image/png',
21
+        'gif' => 'image/gif',
22 22
         'ico' => 'image/x-icon',
23 23
         'webp' => 'image/webp',
24 24
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
         'js' => 'text/javascript',
27 27
         'css' => 'text/css',
28 28
         'txt' => 'text/plain',
29
-        'html' => 'text/html' ,
30
-        'csv' => 'text/csv' ,
29
+        'html' => 'text/html',
30
+        'csv' => 'text/csv',
31 31
         'xml' => 'text/xml',
32 32
 
33 33
         # App type
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
         # Archive
41 41
         'zip' => 'application/zip',
42
-        'gtar' => 'application/x-gtar' ,
43
-        'gz' => 'application/x-gzip' ,
42
+        'gtar' => 'application/x-gtar',
43
+        'gz' => 'application/x-gzip',
44 44
         '7z' => 'application/x-7z-compressed',
45 45
         'rar' => 'application/x-rar-compressed',
46 46
 
Please login to merge, or discard this patch.
nebula/src/application/response/Response.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,8 +103,8 @@
 block discarded – undo
103 103
      */
104 104
     public function setStatus(int $code)
105 105
     {
106
-        $this->header->sendHeaderRaw('HTTP/1.1 '.$code.' '. Status::toText($code));
107
-        $this->header->sendHeader('Status', $code.' '. Status::toText($code));
106
+        $this->header->sendHeaderRaw('HTTP/1.1 '.$code.' '.Status::toText($code));
107
+        $this->header->sendHeader('Status', $code.' '.Status::toText($code));
108 108
     }
109 109
 
110 110
     /**
Please login to merge, or discard this patch.
nebula/src/component/route/RouteMatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
     protected $matcher;
40 40
     
41 41
 
42
-    public function __construct(array $methods, string $uri, array $attribute=[])
42
+    public function __construct(array $methods, string $uri, array $attribute = [])
43 43
     {
44
-        array_walk($methods, function ($value) {
44
+        array_walk($methods, function($value) {
45 45
             return strtoupper($value);
46 46
         });
47 47
         $this->methods = $methods;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param RequestInterface $request
158 158
      * @return array|null
159 159
      */
160
-    public function match(RequestInterface $request):?array {
160
+    public function match(RequestInterface $request): ?array {
161 161
         if (\in_array($request->getMethod(), $this->methods)) {
162 162
             if (($parameter = $this->matcher->match($request->getUrl())) !== null) {
163 163
                 return $this->matcher->buildParamter($parameter);
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 static($method, $uri, $headers);
124
+        $headers = HeaderItem::buildFromServer($server ?: $_SERVER);
125
+        $request = new static($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/application/route/MatchResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
             $object = $class->getMethod('instance')->invoke(null);
164 164
             $context->setResponse($object);
165 165
             $class->getMethod('proccess')->invokeArgs($object, [
166
-                new Runnable([$object,'onRequest']),
166
+                new Runnable([$object, 'onRequest']),
167 167
                 $context->getRequest(),
168 168
                 $this->matcher->getAttribute('buffer', true),
169 169
             ]);
Please login to merge, or discard this patch.
nebula/src/application/route/GroupRoutes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function add(?string $module = null, string $name, RouteMatcher $router)
59 59
     {
60
-        $module =  $module ?: $this->default;
60
+        $module = $module ?: $this->default;
61 61
         if (\array_key_exists($module, $this->routes)) {
62 62
             $this->routes[$module]->add($name, $router);
63 63
         } else {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param Request $request
90 90
      * @return MatchResult|null
91 91
      */
92
-    public function match(Request $request):?MatchResult
92
+    public function match(Request $request): ?MatchResult
93 93
     {
94 94
         foreach ($this->routes as $module => $collection) {
95 95
             foreach ($collection as $name => $matcher) {
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
      * @param string $name
109 109
      * @return RouteMatcher|null
110 110
      */
111
-    public function find(?string $module = null, string $name):?RouteMatcher
111
+    public function find(?string $module = null, string $name): ?RouteMatcher
112 112
     {
113
-        $module =  $module ?: $this->default;
113
+        $module = $module ?: $this->default;
114 114
         if (\array_key_exists($module, $this->routes)) {
115 115
             return $this->routes[$module]->get($name);
116 116
         }
Please login to merge, or discard this patch.
nebula/src/application/Route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function loadFromModule(Manager $manager)
52 52
     {
53
-        $groups =  $this->applicaton->getConfig()->get('app.active', ['default']);
53
+        $groups = $this->applicaton->getConfig()->get('app.active', ['default']);
54 54
         foreach ($groups as $group) {
55 55
             $manager->loadRoute($group, $this);
56 56
         }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param Request $request
79 79
      * @return MatchResult|null
80 80
      */
81
-    public function match(Request $request):?MatchResult
81
+    public function match(Request $request): ?MatchResult
82 82
     {
83 83
         foreach ($this->routes as $group => $routes) {
84 84
             if (($result = $routes->match($request)) !== null) {
Please login to merge, or discard this patch.
nebula/loader/web.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 use nebula\application\Loader;
5 5
 use nebula\application\Request;
6 6
 
7
-require_once __DIR__ .'/loader.php';
7
+require_once __DIR__.'/loader.php';
8 8
 
9 9
 
10 10
 
11 11
 // 初始化系统加载器
12 12
 $loader = new Loader;
13 13
 $loader->register();
14
-$loader->addIncludePath(NEBULA_SYSTEM .'/src', 'nebula');
15
-$loader->import(NEBULA_SYSTEM .'/src/functions.php');
14
+$loader->addIncludePath(NEBULA_SYSTEM.'/src', 'nebula');
15
+$loader->import(NEBULA_SYSTEM.'/src/functions.php');
16 16
 // 初始化请求
17 17
 $request = Request::buildFromServer();
18 18
 $request->apply(true);
Please login to merge, or discard this patch.