mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 13:50:23 +02:00
feat: token authentication (#3927)
This commit is contained in:
14
lib/http.php
14
lib/http.php
@@ -170,6 +170,7 @@ final class Request
|
||||
{
|
||||
private array $get;
|
||||
private array $server;
|
||||
private array $attributes;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@@ -180,6 +181,7 @@ final class Request
|
||||
$self = new self();
|
||||
$self->get = $_GET;
|
||||
$self->server = $_SERVER;
|
||||
$self->attributes = [];
|
||||
return $self;
|
||||
}
|
||||
|
||||
@@ -200,6 +202,18 @@ final class Request
|
||||
return $this->server[$key] ?? $default;
|
||||
}
|
||||
|
||||
public function withAttribute(string $name, $value = true): self
|
||||
{
|
||||
$clone = clone $this;
|
||||
$clone->attributes[$name] = $value;
|
||||
return $clone;
|
||||
}
|
||||
|
||||
public function attribute(string $key, $default = null)
|
||||
{
|
||||
return $this->attributes[$key] ?? $default;
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return $this->get;
|
||||
|
Reference in New Issue
Block a user