12
12
*
13
13
* @package tourze\Base\Component
14
14
*/
15
- class Http extends Component
15
+ class Http extends Component implements HttpInterface
16
16
{
17
17
18
18
// HTTP方法列表
@@ -240,7 +240,6 @@ class Http extends Component
240
240
// Informational 1xx
241
241
self ::CONTINUES => 'Continue ' ,
242
242
self ::SWITCHING_PROTOCOLS => 'Switching Protocols ' ,
243
-
244
243
// Success 2xx
245
244
self ::OK => 'OK ' ,
246
245
self ::CREATED => 'Created ' ,
@@ -249,7 +248,6 @@ class Http extends Component
249
248
self ::NO_CONTENT => 'No Content ' ,
250
249
self ::RESET_CONTENT => 'Reset Content ' ,
251
250
self ::PARTIAL_CONTENT => 'Partial Content ' ,
252
-
253
251
// Redirection 3xx
254
252
self ::MULTIPLE_CHOICES => 'Multiple Choices ' ,
255
253
self ::MOVED_PERMANENTLY => 'Moved Permanently ' ,
@@ -258,9 +256,8 @@ class Http extends Component
258
256
self ::SEE_OTHER => 'See Other ' ,
259
257
self ::NOT_MODIFIED => 'Not Modified ' ,
260
258
self ::USE_PROXY => 'Use Proxy ' ,
261
- // 306 is deprecated but reserved
259
+ // 306依然保留
262
260
self ::TEMPORARY_REDIRECT => 'Temporary Redirect ' ,
263
-
264
261
// Client Error 4xx
265
262
self ::BAD_REQUEST => 'Bad Request ' ,
266
263
self ::UNAUTHORIZED => 'Unauthorized ' ,
@@ -280,15 +277,14 @@ class Http extends Component
280
277
self ::UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type ' ,
281
278
self ::REQUESTED_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable ' ,
282
279
self ::EXPECTATION_FAILED => 'Expectation Failed ' ,
283
-
284
280
// Server Error 5xx
285
281
self ::INTERNAL_SERVER_ERROR => 'Internal Server Error ' ,
286
282
self ::NOT_IMPLEMENTED => 'Not Implemented ' ,
287
283
self ::BAD_GATEWAY => 'Bad Gateway ' ,
288
284
self ::SERVICE_UNAVAILABLE => 'Service Unavailable ' ,
289
285
self ::GATEWAY_TIMEOUT => 'Gateway Timeout ' ,
290
286
self ::HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version Not Supported ' ,
291
- self ::BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded '
287
+ self ::BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded ' ,
292
288
];
293
289
294
290
/**
@@ -412,7 +408,7 @@ public function setCookie($name, $value = '', $maxAge = 0, $path = '', $domain =
412
408
'path ' => $ path ,
413
409
'domain ' => $ domain ,
414
410
'secure ' => $ secure ,
415
- 'http_only ' => $ httpOnly
411
+ 'http_only ' => $ httpOnly,
416
412
]);
417
413
return setcookie ($ name , $ value , $ maxAge , $ path , $ domain , $ secure , $ httpOnly );
418
414
}
@@ -467,7 +463,7 @@ public function header($string, $replace = true, $httpResponseCode = null)
467
463
Base::getLog ()->debug (__METHOD__ . ' response header ' , [
468
464
'header ' => $ string ,
469
465
'replace ' => $ replace ,
470
- 'code ' => $ httpResponseCode
466
+ 'code ' => $ httpResponseCode,
471
467
]);
472
468
header ($ string , $ replace , $ httpResponseCode );
473
469
}
@@ -478,7 +474,7 @@ public function header($string, $replace = true, $httpResponseCode = null)
478
474
public function headerRemove ($ name = null )
479
475
{
480
476
Base::getLog ()->debug (__METHOD__ . ' remove header ' , [
481
- 'name ' => $ name ,
477
+ 'name ' => $ name ,
482
478
]);
483
479
header_remove ($ name );
484
480
}
0 commit comments