Added hasCookie method to HttpRequest.
This commit is contained in:
parent
553b7c4a14
commit
a4c1d5627e
2 changed files with 6 additions and 2 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
0.2308.30129
|
0.2308.162302
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// HttpRequest.php
|
// HttpRequest.php
|
||||||
// Created: 2022-02-08
|
// Created: 2022-02-08
|
||||||
// Updated: 2023-01-07
|
// Updated: 2023-08-16
|
||||||
|
|
||||||
namespace Index\Http;
|
namespace Index\Http;
|
||||||
|
|
||||||
|
@ -72,6 +72,10 @@ class HttpRequest extends HttpMessage {
|
||||||
return filter_var($this->cookies[$name] ?? null, $filter, $options);
|
return filter_var($this->cookies[$name] ?? null, $filter, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasCookie(string $name): bool {
|
||||||
|
return isset($this->cookies[$name]);
|
||||||
|
}
|
||||||
|
|
||||||
public static function fromRequest(): HttpRequest {
|
public static function fromRequest(): HttpRequest {
|
||||||
$build = new HttpRequestBuilder;
|
$build = new HttpRequestBuilder;
|
||||||
$build->setHttpVersion(new Version(...array_map('intval', explode('.', substr($_SERVER['SERVER_PROTOCOL'], 5)))));
|
$build->setHttpVersion(new Version(...array_map('intval', explode('.', substr($_SERVER['SERVER_PROTOCOL'], 5)))));
|
||||||
|
|
Loading…
Reference in a new issue