Router bugfix, save and update route frontend

This commit is contained in:
2024-03-29 13:33:29 +01:00
parent 90e7024a73
commit 80b5ac07d0
13 changed files with 352 additions and 136 deletions

View File

@@ -2,8 +2,18 @@
namespace Core\Objects\Router;
use Core\Driver\SQL\SQL;
class RedirectPermanentlyRoute extends RedirectRoute {
const HTTP_STATUS_CODE = 308;
public function __construct(string $pattern, bool $exact, string $destination) {
parent::__construct("redirect_permanently", $pattern, $exact, $destination, 308);
parent::__construct("redirect_permanently", $pattern, $exact, $destination, self::HTTP_STATUS_CODE);
}
public function postFetch(SQL $sql, array $row) {
parent::postFetch($sql, $row);
$this->code = self::HTTP_STATUS_CODE;
}
}

View File

@@ -9,7 +9,7 @@ use JetBrains\PhpStorm\Pure;
class RedirectRoute extends Route {
#[Transient]
private int $code;
protected int $code;
public function __construct(string $type, string $pattern, bool $exact, string $destination, int $code = 307) {
parent::__construct($type, $pattern, $destination, $exact);

View File

@@ -2,8 +2,18 @@
namespace Core\Objects\Router;
use Core\Driver\SQL\SQL;
class RedirectTemporaryRoute extends RedirectRoute {
const HTTP_STATUS_CODE = 307;
public function __construct(string $pattern, bool $exact, string $destination) {
parent::__construct("redirect_temporary", $pattern, $exact, $destination, 307);
parent::__construct("redirect_temporary", $pattern, $exact, $destination, self::HTTP_STATUS_CODE);
}
public function postFetch(SQL $sql, array $row) {
parent::postFetch($sql, $row);
$this->code = self::HTTP_STATUS_CODE;
}
}

View File

@@ -14,7 +14,7 @@ class StaticRoute extends Route {
private int $code;
public function __construct(string $pattern, bool $exact, string $data, int $code = 200) {
parent::__construct("static", $pattern, $exact);
parent::__construct("static", $pattern, "", $exact);
$this->data = $data;
$this->code = $code;
}