Passed
Push — master ( e90583...767c6b )
by y
01:53
created
src/Site/Request.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@
 block discarded – undo
61 61
                         $info['tmp_name'][$i]
62 62
                     );
63 63
                 }
64
-            }
65
-            else {
64
+            } else {
66 65
                 $this->files[$name] = new Upload(
67 66
                     $info['error_code'],
68 67
                     $info['name'],
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     protected $proxies = [];
50 50
 
51
-    public function __construct () {
51
+    public function __construct() {
52 52
         $this->path = Util::path(urldecode(strtok($_SERVER['REQUEST_URI'], '?')));
53 53
         $this->headers = array_change_key_case(getallheaders()); // phpstorm bug submitted, ext-apache isn't needed.
54 54
         foreach ($_FILES as $name => $info) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     /**
76 76
      * @return string
77 77
      */
78
-    final public function __toString () {
78
+    final public function __toString() {
79 79
         return $this->path;
80 80
     }
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      *
85 85
      * @return array
86 86
      */
87
-    public function getArgs (): array {
87
+    public function getArgs(): array {
88 88
         return array_merge($_GET, $_POST);
89 89
     }
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      *
94 94
      * @return string
95 95
      */
96
-    public function getClient () {
96
+    public function getClient() {
97 97
         if (in_array($_SERVER['REMOTE_ADDR'], $this->proxies)) {
98 98
             return $this['X-Forwarded-For'] ?? $_SERVER['REMOTE_ADDR'];
99 99
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @param string $name
105 105
      * @return null|Upload
106 106
      */
107
-    final public function getFile (string $name) {
107
+    final public function getFile(string $name) {
108 108
         return $this->files[$name] ?? null;
109 109
     }
110 110
 
@@ -112,70 +112,70 @@  discard block
 block discarded – undo
112 112
      * @param string $name
113 113
      * @return Upload[]
114 114
      */
115
-    final public function getFileGroup (string $name) {
115
+    final public function getFileGroup(string $name) {
116 116
         return $this->fileGroups[$name] ?? [];
117 117
     }
118 118
 
119 119
     /**
120 120
      * @return Upload[][]
121 121
      */
122
-    final public function getFileGroups () {
122
+    final public function getFileGroups() {
123 123
         return $this->fileGroups;
124 124
     }
125 125
 
126 126
     /**
127 127
      * @return Upload[]
128 128
      */
129
-    final public function getFiles () {
129
+    final public function getFiles() {
130 130
         return $this->files;
131 131
     }
132 132
 
133 133
     /**
134 134
      * @return string[]
135 135
      */
136
-    public function getHeaders (): array {
136
+    public function getHeaders(): array {
137 137
         return $this->headers;
138 138
     }
139 139
 
140 140
     /**
141 141
      * @return string
142 142
      */
143
-    final public function getMethod (): string {
143
+    final public function getMethod(): string {
144 144
         return $_SERVER['REQUEST_METHOD'];
145 145
     }
146 146
 
147 147
     /**
148 148
      * @return string
149 149
      */
150
-    final public function getPath (): string {
150
+    final public function getPath(): string {
151 151
         return $this->path;
152 152
     }
153 153
 
154 154
     /**
155 155
      * @return string[]
156 156
      */
157
-    public function getProxies (): array {
157
+    public function getProxies(): array {
158 158
         return $this->proxies;
159 159
     }
160 160
 
161 161
     /**
162 162
      * @return bool
163 163
      */
164
-    final public function isDelete (): bool {
164
+    final public function isDelete(): bool {
165 165
         return $_SERVER['REQUEST_METHOD'] === 'DELETE';
166 166
     }
167 167
 
168 168
     /**
169 169
      * @return bool
170 170
      */
171
-    final public function isGet (): bool {
171
+    final public function isGet(): bool {
172 172
         return $_SERVER['REQUEST_METHOD'] === 'GET';
173 173
     }
174 174
 
175 175
     /**
176 176
      * @return bool
177 177
      */
178
-    final public function isHead (): bool {
178
+    final public function isHead(): bool {
179 179
         return $_SERVER['REQUEST_METHOD'] === 'HEAD';
180 180
     }
181 181
 
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
      *
185 185
      * @return bool
186 186
      */
187
-    final public function isMuting (): bool {
187
+    final public function isMuting(): bool {
188 188
         return !$this->isGet() and !$this->isHead();
189 189
     }
190 190
 
191 191
     /**
192 192
      * @return bool
193 193
      */
194
-    final public function isPost (): bool {
194
+    final public function isPost(): bool {
195 195
         return $_SERVER['REQUEST_METHOD'] === 'POST';
196 196
     }
197 197
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      * @param string $key
202 202
      * @return bool
203 203
      */
204
-    public function offsetExists ($key) {
204
+    public function offsetExists($key) {
205 205
         return isset($this->headers[strtolower($key)]);
206 206
     }
207 207
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      * @param string $key
212 212
      * @return null|string
213 213
      */
214
-    public function offsetGet ($key) {
214
+    public function offsetGet($key) {
215 215
         return $this->headers[strtolower($key)] ?? null;
216 216
     }
217 217
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      * @param mixed $key
222 222
      * @param mixed $value
223 223
      */
224
-    public function offsetSet ($key, $value) {
224
+    public function offsetSet($key, $value) {
225 225
         return;
226 226
     }
227 227
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      *
231 231
      * @param mixed $key
232 232
      */
233
-    public function offsetUnset ($key) {
233
+    public function offsetUnset($key) {
234 234
         return;
235 235
     }
236 236
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      * @param string[] $proxies
239 239
      * @return $this
240 240
      */
241
-    public function setProxies (array $proxies) {
241
+    public function setProxies(array $proxies) {
242 242
         $this->proxies = $proxies;
243 243
         return $this;
244 244
     }
Please login to merge, or discard this patch.
src/Site/Auth.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @param Site $site
22 22
      */
23
-    public function __construct (Site $site) {
23
+    public function __construct(Site $site) {
24 24
         $this->site = $site;
25 25
         session_set_cookie_params(0, '/', null, !$site->isDev(), true);
26 26
         session_start();
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * @return string
39 39
      */
40
-    public function getToken (): string {
40
+    public function getToken(): string {
41 41
         return $_SESSION['_token'];
42 42
     }
43 43
 
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @return mixed
48 48
      */
49
-    public function getUser () {
49
+    public function getUser() {
50 50
         return $_SESSION['_user'] ?? null;
51 51
     }
52 52
 
53 53
     /**
54 54
      * Wipes the session.
55 55
      */
56
-    public function logout () {
56
+    public function logout() {
57 57
         setcookie(session_name(), null, 1);
58 58
         session_destroy();
59 59
     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param mixed $user
65 65
      * @return $this
66 66
      */
67
-    public function setUser ($user) {
67
+    public function setUser($user) {
68 68
         $_SESSION['_user'] = $user;
69 69
         return $this;
70 70
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @return $this
78 78
      * @throws Error
79 79
      */
80
-    public function verify ($token) {
80
+    public function verify($token) {
81 81
         if ($token !== $this->getToken()) {
82 82
             $this->site->log(403, 'Invalid token.');
83 83
             throw new Error(403, 'Invalid token.');
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
27 27
         if (!isset($_SESSION['_token'])) {
28 28
             try {
29 29
                 $_SESSION['_token'] = bin2hex(random_bytes(8));
30
-            }
31
-            catch (Exception $exception) {
30
+            } catch (Exception $exception) {
32 31
                 $_SESSION['_token'] = bin2hex(openssl_random_pseudo_bytes(8));
33 32
             }
34 33
         }
Please login to merge, or discard this patch.
src/Site/Error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      * @param string $message Defaults to the standard description.
54 54
      * @param Throwable|null $previous
55 55
      */
56
-    public function __construct (int $code, string $message = null, Throwable $previous = null) {
56
+    public function __construct(int $code, string $message = null, Throwable $previous = null) {
57 57
         $message = $message ?? self::MESSAGES[$code] ?? '';
58 58
         parent::__construct($message, $code, $previous);
59 59
     }
Please login to merge, or discard this patch.
src/Site/Util.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      * @param string[] $args
14 14
      * @return string
15 15
      */
16
-    public static function path (...$args): string {
16
+    public static function path(...$args): string {
17 17
         $path = trim(implode('/', $args), '/');
18 18
         $path = preg_replace('/\/+/', '/', $path);
19 19
         return '/' . $path;
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param string[] $args
26 26
      * @return string
27 27
      */
28
-    public static function slug (...$args): string {
28
+    public static function slug(...$args): string {
29 29
         $slug = strtolower(implode('-', $args));
30 30
         $slug = preg_replace('/([^a-z0-9]+)/', '-', $slug);
31 31
         $slug = preg_replace('/-+/', '-', $slug);
Please login to merge, or discard this patch.
src/Site/Upload.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
      * @param string $remoteName
34 34
      * @param string $path
35 35
      */
36
-    public function __construct (int $status, string $remoteName, string $path) {
36
+    public function __construct(int $status, string $remoteName, string $path) {
37 37
         $this->status = $status;
38 38
         $this->remoteName = $remoteName;
39 39
         $this->path = $path;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @return null|Error
46 46
      */
47
-    public function getError () {
47
+    public function getError() {
48 48
         switch ($this->status) {
49 49
             case UPLOAD_ERR_INI_SIZE:
50 50
             case UPLOAD_ERR_FORM_SIZE:
@@ -67,35 +67,35 @@  discard block
 block discarded – undo
67 67
     /**
68 68
      * @return string
69 69
      */
70
-    final public function getPath (): string {
70
+    final public function getPath(): string {
71 71
         return $this->path;
72 72
     }
73 73
 
74 74
     /**
75 75
      * @return string
76 76
      */
77
-    final public function getRemoteName (): string {
77
+    final public function getRemoteName(): string {
78 78
         return $this->remoteName;
79 79
     }
80 80
 
81 81
     /**
82 82
      * @return int
83 83
      */
84
-    final public function getSize (): int {
84
+    final public function getSize(): int {
85 85
         return filesize($this->path);
86 86
     }
87 87
 
88 88
     /**
89 89
      * @return int
90 90
      */
91
-    final public function getStatus (): int {
91
+    final public function getStatus(): int {
92 92
         return $this->status;
93 93
     }
94 94
 
95 95
     /**
96 96
      * @return string
97 97
      */
98
-    final public function getType (): string {
98
+    final public function getType(): string {
99 99
         return mime_content_type($this->path);
100 100
     }
101 101
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @param string $path
104 104
      * @return $this
105 105
      */
106
-    public function move (string $path) {
106
+    public function move(string $path) {
107 107
         move_uploaded_file($this->path, $path);
108 108
         return $this;
109 109
     }
Please login to merge, or discard this patch.
src/Site/View.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected $template;
23 23
 
24
-    public function __construct (string $template, array $data = []) {
24
+    public function __construct(string $template, array $data = []) {
25 25
         $this->template = $template;
26 26
         $this->data = $data;
27 27
     }
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * @return string
31 31
      */
32
-    public function __toString () {
32
+    public function __toString() {
33 33
         return $this->template;
34 34
     }
35 35
 
36 36
     /**
37 37
      * @return string
38 38
      */
39
-    public function getContent (): string {
39
+    public function getContent(): string {
40 40
         ob_start();
41 41
         $this->render();
42 42
         return ob_end_clean();
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param mixed $offset
47 47
      * @return bool
48 48
      */
49
-    public function offsetExists ($offset): bool {
49
+    public function offsetExists($offset): bool {
50 50
         return isset($this->data[$offset]);
51 51
     }
52 52
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @param mixed $key
55 55
      * @return mixed
56 56
      */
57
-    public function offsetGet ($key) {
57
+    public function offsetGet($key) {
58 58
         return $this->data[$key] ?? null;
59 59
     }
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
      * @param mixed $key
63 63
      * @param mixed $value
64 64
      */
65
-    public function offsetSet ($key, $value): void {
65
+    public function offsetSet($key, $value): void {
66 66
         $this->data[$key] = $value;
67 67
     }
68 68
 
69 69
     /**
70 70
      * @param mixed $key
71 71
      */
72
-    public function offsetUnset ($key): void {
72
+    public function offsetUnset($key): void {
73 73
         unset($this->data[$key]);
74 74
     }
75 75
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @return void
81 81
      */
82
-    public function render (): void {
82
+    public function render(): void {
83 83
         extract($this->data);
84 84
         include "{$this->template}";
85 85
     }
Please login to merge, or discard this patch.
src/Site/ViewableInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
      *
13 13
      * @return string
14 14
      */
15
-    public function getContent (): string;
15
+    public function getContent(): string;
16 16
 
17 17
     /**
18 18
      * Directly outputs content.
19 19
      */
20
-    public function render (): void;
20
+    public function render(): void;
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/Site/Response.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * @param Site $site
55 55
      */
56
-    public function __construct (Site $site) {
56
+    public function __construct(Site $site) {
57 57
         $this->site = $site;
58 58
         $this->request = $site->getRequest();
59 59
         $this->id = uniqid();
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @return void
73 73
      */
74
-    public function _onRender (): void {
74
+    public function _onRender(): void {
75 75
         header_remove('X-Powered-By');
76 76
         $this['X-Response-Id'] = $this->id;
77 77
         ksort($this->headers);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @return void
98 98
      */
99
-    public function _onShutdown (): void {
99
+    public function _onShutdown(): void {
100 100
         if ($this->site->isDev()) {
101 101
             $ip = $this->request->getClient();
102 102
             $method = $this->request->getMethod();
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @param Throwable $error Defaults to an `Error` with the current response code.
116 116
      */
117
-    public function error (Throwable $error = null): void {
117
+    public function error(Throwable $error = null): void {
118 118
         $error = $error ?? new Error($this->code);
119 119
         $code = 500;
120 120
         if ($error instanceof Error) {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      * @param string $path
142 142
      * @param bool $download
143 143
      */
144
-    public function file (string $path, bool $download = false): void {
144
+    public function file(string $path, bool $download = false): void {
145 145
         clearstatcache(true, $path);
146 146
         if (!file_exists($path)) {
147 147
             $this->setCode(404)->error() and exit;
@@ -196,21 +196,21 @@  discard block
 block discarded – undo
196 196
     /**
197 197
      * @return int
198 198
      */
199
-    final public function getCode (): int {
199
+    final public function getCode(): int {
200 200
         return $this->code;
201 201
     }
202 202
 
203 203
     /**
204 204
      * @return string
205 205
      */
206
-    final public function getId (): string {
206
+    final public function getId(): string {
207 207
         return $this->id;
208 208
     }
209 209
 
210 210
     /**
211 211
      * @return int
212 212
      */
213
-    public function getTimestamp (): int {
213
+    public function getTimestamp(): int {
214 214
         return $this->timestamp;
215 215
     }
216 216
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      *
220 220
      * @return bool
221 221
      */
222
-    public function isEmpty (): bool {
222
+    public function isEmpty(): bool {
223 223
         return $this->request->isHead() or in_array($this->code, [204, 205, 304]);
224 224
     }
225 225
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      *
229 229
      * @return bool
230 230
      */
231
-    public function isModified (): bool {
231
+    public function isModified(): bool {
232 232
         // Explicit 304 takes precedence over all.
233 233
         if ($this->code === 304) {
234 234
             return false;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      *
249 249
      * @param mixed $content
250 250
      */
251
-    public function mixed ($content): void {
251
+    public function mixed($content): void {
252 252
         if ($content instanceof ViewableInterface) {
253 253
             $this->view($content) and exit;
254 254
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * @param mixed $key
265 265
      * @return bool
266 266
      */
267
-    public function offsetExists ($key) {
267
+    public function offsetExists($key) {
268 268
         return isset($this->headers[$key]);
269 269
     }
270 270
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param mixed $key
273 273
      * @return null|string
274 274
      */
275
-    public function offsetGet ($key) {
275
+    public function offsetGet($key) {
276 276
         return $this->headers[$key] ?? null;
277 277
     }
278 278
 
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
      * @param mixed $key
281 281
      * @param string $value
282 282
      */
283
-    public function offsetSet ($key, $value) {
283
+    public function offsetSet($key, $value) {
284 284
         $this->headers[$key] = $value;
285 285
     }
286 286
 
287 287
     /**
288 288
      * @param mixed $key
289 289
      */
290
-    public function offsetUnset ($key) {
290
+    public function offsetUnset($key) {
291 291
         unset($this->headers[$key]);
292 292
     }
293 293
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * @param string $location
298 298
      * @param int $code
299 299
      */
300
-    public function redirect (string $location, $code = 302) {
300
+    public function redirect(string $location, $code = 302) {
301 301
         $this->setCode($code);
302 302
         $this['Location'] = $location;
303 303
         flush();
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      * @param int $code
309 309
      * @return $this
310 310
      */
311
-    public function setCode (int $code) {
311
+    public function setCode(int $code) {
312 312
         $this->code = $code;
313 313
         return $this;
314 314
     }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      * @param int $timestamp
320 320
      * @return $this
321 321
      */
322
-    public function setTimestamp (int $timestamp) {
322
+    public function setTimestamp(int $timestamp) {
323 323
         if ($timestamp) {
324 324
             $this['Last-Modified'] = gmdate('D, d M Y H:i:s T', $timestamp);
325 325
         }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @param int $timestamp
337 337
      * @return $this
338 338
      */
339
-    public function touch (int $timestamp) {
339
+    public function touch(int $timestamp) {
340 340
         if ($timestamp > $this->timestamp) {
341 341
             $this->setTimestamp($timestamp);
342 342
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
      *
349 349
      * @param ViewableInterface $view
350 350
      */
351
-    public function view (ViewableInterface $view): void {
351
+    public function view(ViewableInterface $view): void {
352 352
         $view->render();
353 353
         flush();
354 354
         exit;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -124,8 +124,7 @@  discard block
 block discarded – undo
124 124
         $template = __DIR__ . '/error.phtml';
125 125
         if (file_exists("view/{$code}.phtml")) {
126 126
             $template = "view/{$code}.phtml";
127
-        }
128
-        elseif (file_exists('view/error.phtml')) {
127
+        } elseif (file_exists('view/error.phtml')) {
129 128
             $template = 'view/error.phtml';
130 129
         }
131 130
         $this->view(new View($template, [
@@ -322,8 +321,7 @@  discard block
 block discarded – undo
322 321
     public function setTimestamp (int $timestamp) {
323 322
         if ($timestamp) {
324 323
             $this['Last-Modified'] = gmdate('D, d M Y H:i:s T', $timestamp);
325
-        }
326
-        else {
324
+        } else {
327 325
             unset($this['Last-Modified']);
328 326
         }
329 327
         $this->timestamp = $timestamp;
Please login to merge, or discard this patch.
src/Site.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * Initializes the system for routing, error handling, and output.
39 39
      */
40
-    public function __construct () {
40
+    public function __construct() {
41 41
         error_reporting(E_ALL);
42 42
         set_error_handler([$this, '_onRaise']);
43 43
         $this->request = new Request();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param Throwable $error
54 54
      * @return void
55 55
      */
56
-    public function _onException (Throwable $error): void {
56
+    public function _onException(Throwable $error): void {
57 57
         if (!$error instanceof Error) {
58 58
             $this->log(500, "[{$error->getCode()}] {$error}");
59 59
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param int $line
74 74
      * @throws ErrorException
75 75
      */
76
-    public function _onRaise (int $code, string $message, string $file, int $line) {
76
+    public function _onRaise(int $code, string $message, string $file, int $line) {
77 77
         $type = [
78 78
             E_DEPRECATED => 'E_DEPRECATED',
79 79
             E_NOTICE => 'E_NOTICE',
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param callable $controller
98 98
      * @return void
99 99
      */
100
-    public function delete (string $path, callable $controller): void {
100
+    public function delete(string $path, callable $controller): void {
101 101
         $this->route(['DELETE'], $path, $controller);
102 102
     }
103 103
 
@@ -108,35 +108,35 @@  discard block
 block discarded – undo
108 108
      * @param callable $controller
109 109
      * @return void
110 110
      */
111
-    public function get (string $path, callable $controller): void {
111
+    public function get(string $path, callable $controller): void {
112 112
         $this->route(['GET', 'HEAD'], $path, $controller);
113 113
     }
114 114
 
115 115
     /**
116 116
      * @return Auth
117 117
      */
118
-    final public function getAuth () {
118
+    final public function getAuth() {
119 119
         return $this->auth ?? $this->auth = new Auth($this);
120 120
     }
121 121
 
122 122
     /**
123 123
      * @return Request
124 124
      */
125
-    final public function getRequest () {
125
+    final public function getRequest() {
126 126
         return $this->request;
127 127
     }
128 128
 
129 129
     /**
130 130
      * @return Response
131 131
      */
132
-    final public function getResponse () {
132
+    final public function getResponse() {
133 133
         return $this->response;
134 134
     }
135 135
 
136 136
     /**
137 137
      * @return bool
138 138
      */
139
-    final public function isDev (): bool {
139
+    final public function isDev(): bool {
140 140
         return $this->dev;
141 141
     }
142 142
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      * @param string $message
146 146
      * @return $this
147 147
      */
148
-    public function log ($code, string $message) {
148
+    public function log($code, string $message) {
149 149
         $now = date('Y-m-d H:i:s');
150 150
         $id = $this->response->getId();
151 151
         $ip = $this->request->getClient();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param string $path
163 163
      * @param callable $controller
164 164
      */
165
-    public function post (string $path, callable $controller): void {
165
+    public function post(string $path, callable $controller): void {
166 166
         $this->route(['POST'], $path, $controller);
167 167
     }
168 168
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      * @param callable $controller
174 174
      * @return void
175 175
      */
176
-    public function put (string $path, callable $controller): void {
176
+    public function put(string $path, callable $controller): void {
177 177
         $this->route(['PUT'], $path, $controller);
178 178
     }
179 179
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      * @param callable $controller `(string[] $match, Site $site):mixed`
187 187
      * @return void
188 188
      */
189
-    protected function route (array $methods, string $path, callable $controller): void {
189
+    protected function route(array $methods, string $path, callable $controller): void {
190 190
         $match = [];
191 191
         if ($path[0] !== '/') {
192 192
             preg_match($path, $this->request->getPath(), $match);
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @param bool $dev
209 209
      * @return $this
210 210
      */
211
-    public function setDev (bool $dev) {
211
+    public function setDev(bool $dev) {
212 212
         $this->dev = $dev;
213 213
         return $this;
214 214
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
     public function _onException (Throwable $error): void {
57 57
         if (!$error instanceof Error) {
58 58
             $this->log(500, "[{$error->getCode()}] {$error}");
59
-        }
60
-        elseif ($error->getCode() >= 500) {
59
+        } elseif ($error->getCode() >= 500) {
61 60
             $this->log($error->getCode(), $error);
62 61
         }
63 62
         $this->response->error($error) and exit;
@@ -190,8 +189,7 @@  discard block
 block discarded – undo
190 189
         $match = [];
191 190
         if ($path[0] !== '/') {
192 191
             preg_match($path, $this->request->getPath(), $match);
193
-        }
194
-        elseif ($path === $this->request->getPath()) {
192
+        } elseif ($path === $this->request->getPath()) {
195 193
             $match = [$path];
196 194
         }
197 195
         if ($match) {
Please login to merge, or discard this patch.