This commit is contained in:
2 files changed
+21
-1
No files matched your search
+19
-1
@@ -15,15 +15,24 @@ class Request implements IRequest
|
||||
|
||||
private array $post;
|
||||
|
||||
private array $headers;
|
||||
|
||||
private Session $session;
|
||||
|
||||
private ?IUser $user = null;
|
||||
|
||||
public function __construct(string $base, array &$get, array &$post, array &$session, IUserRepository $userRepository)
|
||||
public function __construct(
|
||||
string $base,
|
||||
array &$get,
|
||||
array &$post,
|
||||
array $headers,
|
||||
array &$session,
|
||||
IUserRepository $userRepository)
|
||||
{
|
||||
$this->base = $base;
|
||||
$this->get = &$get;
|
||||
$this->post = &$post;
|
||||
$this->headers = $headers;
|
||||
$this->session = new Session($session);
|
||||
|
||||
$userId = $this->session->get('userId');
|
||||
@@ -64,6 +73,15 @@ class Request implements IRequest
|
||||
return null;
|
||||
}
|
||||
|
||||
public function header($key)
|
||||
{
|
||||
if (isset($this->headers[$key])) {
|
||||
return $this->headers[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function session(): ISession
|
||||
{
|
||||
return $this->session;
|
||||
|
||||
Reference in new issue
Block a user