summaryrefslogtreecommitdiff
path: root/src/web/core/router.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/core/router.php')
-rw-r--r--src/web/core/router.php28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/web/core/router.php b/src/web/core/router.php
index c8fb142..1ad6cb5 100644
--- a/src/web/core/router.php
+++ b/src/web/core/router.php
@@ -2,15 +2,15 @@
class Router {
// the loader
- private $load;
+ private Loader $load;
// the main model
- private $main;
+ private Main_model $main;
// the database
- private $db;
+ private DatabaseHelper $db;
- private $db_ready;
+ private bool $db_ready;
/**
* Creates a router
@@ -123,7 +123,7 @@ class Router {
* @param int $code - the http error code
* @param bool $recursed
*/
- private function handle_error($code, $recursed): void {
+ private function handle_error(int $code, bool $recursed): void {
if ($recursed) {
die($code . ' (recursed)');
}
@@ -137,7 +137,10 @@ class Router {
$this->handle_req($req, TRUE);
}
- private function load_htc($req, $recursed): void {
+ /**
+ * @param array<int,mixed> $req
+ */
+ private function load_htc(array $req, bool $recursed): void {
$parts = explode('/', $req['uri_str']);
$file = end($parts);
$path = $GLOBALS['publicroot'] . '/polyfills/' . $file;
@@ -152,9 +155,10 @@ class Router {
/**
* @param array $req
+ * @param array<int,mixed> $req
* @param bool $recursed
*/
- private function handle_req($req, $recursed = FALSE): void {
+ private function handle_req(array $req, bool $recursed = FALSE): void {
if ($recursed === false) {
if (
@@ -202,7 +206,10 @@ class Router {
$ref->invoke($controller);
}
- private function log_request($req): void {
+ /**
+ * @param array<int,mixed> $req
+ */
+ private function log_request(array $req): void {
if (
$req === FALSE ||
$this->db_ready === FALSE ||
@@ -220,7 +227,10 @@ class Router {
$query->execute();
}
- private function check_banned($req) {
+ /**
+ * @param array<int,mixed> $req
+ */
+ private function check_banned(array $req): bool {
$ip = FALSE;
if ($req) {
$ip = $req['ip'];