Fix PHP 8 router parameter dispatching and lesson slug playback lookup
This commit is contained in:
@@ -13,6 +13,7 @@ class Request
|
||||
private array $queryParams;
|
||||
private array $bodyParams;
|
||||
private array $headers;
|
||||
private array $routeParams = [];
|
||||
|
||||
// Explicit properties to store authentication details to avoid deprecation warnings in PHP 8.2+
|
||||
public ?int $user_id = null;
|
||||
@@ -78,6 +79,21 @@ class Request
|
||||
$this->queryParams = $queryParams;
|
||||
}
|
||||
|
||||
public function setParams(array $params): void
|
||||
{
|
||||
$this->routeParams = $params;
|
||||
}
|
||||
|
||||
public function getParams(): array
|
||||
{
|
||||
return $this->routeParams;
|
||||
}
|
||||
|
||||
public function getParam(string $key, $default = null)
|
||||
{
|
||||
return $this->routeParams[$key] ?? $default;
|
||||
}
|
||||
|
||||
public function get(string $key, $default = null)
|
||||
{
|
||||
return $this->bodyParams[$key] ?? ($this->queryParams[$key] ?? $default);
|
||||
|
||||
Reference in New Issue
Block a user