@@ -249,7 +249,7 @@ class Response
249249 */
250250 public function __construct (float $ time = 0 )
251251 {
252- $ this ->startTime = (! empty ($ time )) ? $ time : \microtime (true );
252+ $ this ->startTime = (!empty ($ time )) ? $ time : \microtime (true );
253253 }
254254
255255 /**
@@ -262,7 +262,7 @@ public function __construct(float $time = 0)
262262 */
263263 public function setContentType (string $ type , string $ charset = '' ): static
264264 {
265- $ this ->contentType = $ type .((! empty ($ charset ) ? '; charset= ' .$ charset : '' ));
265+ $ this ->contentType = $ type .((!empty ($ charset ) ? '; charset= ' .$ charset : '' ));
266266
267267 return $ this ;
268268 }
@@ -300,7 +300,7 @@ public function isSent(): bool
300300 */
301301 public function setStatusCode (int $ code = 200 ): static
302302 {
303- if (! \array_key_exists ($ code , $ this ->statusCodes )) {
303+ if (!\array_key_exists ($ code , $ this ->statusCodes )) {
304304 throw new Exception ('Unknown HTTP status code ' );
305305 }
306306
@@ -413,7 +413,7 @@ public function getHeaders(): array
413413 public function addCookie (string $ name , string $ value = null , int $ expire = null , string $ path = null , string $ domain = null , bool $ secure = null , bool $ httponly = null , string $ sameSite = null ): static
414414 {
415415 $ name = strtolower ($ name );
416-
416+
417417 $ this ->cookies [] = [
418418 'name ' => $ name ,
419419 'value ' => $ value ,
@@ -437,9 +437,9 @@ public function addCookie(string $name, string $value = null, int $expire = null
437437 */
438438 public function removeCookie (string $ name ): static
439439 {
440- if ( isset ( $ this ->headers [ $ name ]) ) {
441- unset( $ this -> cookies [ $ name]) ;
442- }
440+ $ this -> cookies = array_filter ( $ this ->cookies , function ( $ cookie ) use ( $ name ) {
441+ return $ cookie [ ' name ' ] !== $ name ;
442+ });
443443
444444 return $ this ;
445445 }
@@ -478,7 +478,7 @@ public function send(string $body = ''): void
478478 ->appendCookies ()
479479 ->appendHeaders ();
480480
481- if (! $ this ->disablePayload ) {
481+ if (!$ this ->disablePayload ) {
482482 $ length = strlen ($ body );
483483
484484 $ this ->size = $ this ->size + strlen (implode ("\n" , $ this ->headers )) + $ length ;
@@ -525,7 +525,7 @@ protected function write(string $content): void
525525 */
526526 protected function end (string $ content = null ): void
527527 {
528- if (! is_null ($ content )) {
528+ if (!is_null ($ content )) {
529529 echo $ content ;
530530 }
531531 }
@@ -556,7 +556,7 @@ public function chunk(string $body = '', bool $end = false): void
556556 ->appendCookies ()
557557 ->appendHeaders ();
558558
559- if (! $ this ->disablePayload ) {
559+ if (!$ this ->disablePayload ) {
560560 $ this ->write ($ body );
561561 if ($ end ) {
562562 $ this ->disablePayload ();
@@ -579,7 +579,7 @@ protected function appendHeaders(): static
579579 $ this ->sendStatus ($ this ->statusCode );
580580
581581 // Send content type header
582- if (! empty ($ this ->contentType )) {
582+ if (!empty ($ this ->contentType )) {
583583 $ this ->addHeader ('Content-Type ' , $ this ->contentType );
584584 }
585585
@@ -735,7 +735,7 @@ public function text(string $data): void
735735 */
736736 public function json ($ data ): void
737737 {
738- if (! is_array ($ data ) && ! $ data instanceof \stdClass) {
738+ if (!is_array ($ data ) && !$ data instanceof \stdClass) {
739739 throw new \Exception ('Invalid JSON input var ' );
740740 }
741741
0 commit comments