src/API.php
public function getMap(): array
    {
        $auth = $this->auth;
        $view = $this->view;
        return [
            ['GET', '/', function () {
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => json_decode(file_get_contents(dirname(__DIR__) . "/composer.json"))
                ];
            }],
            ['GET', '/Auth/details', function () {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->auth()->details;
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/Auth/allow/[i:min]?/[i:max]?', function (int $min = 4, int $max = 4) {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->auth()->allow(["min" => $min, "max" => $max]);
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/Site/[a:property]?', function (string $property = null) {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->site()->{$property};
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/View', function () {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->view()->details;
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/Navigation/all/flatten/[i:block]?', function (int $block = 0) {
                try {
                    $navigations_list = Model\Navigation::with([
                        "page",
                        "navigation",
                        "navigations"
                    ])->where('navigation_block', $block)->where('navigation_id', null)->get();
                    $navigations = [];
                    $queue = [];
                    foreach ($navigations_list as $navigation) {
                        $navigation->level = 0;
                        $navigations[] = $navigation;
                        $queue = [$navigation];
                        foreach ($queue as $element) {
                            foreach ($element->navigations as $nested_element) {
                                $nested_element->level = $element->level + 1;
                                $navigations[] = $nested_element;
                                $queue[] = $nested_element;
                            }
                        }
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigations
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Navigation/all/[i:block]?', function (int $block = 0) {
                try {
                    $navigations = Model\Navigation::with([
                        "page",
                        "navigation",
                        "navigations"
                    ])->where('navigation_block', $block)->where('navigation_id', null)->get();
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigations
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Navigation/parent/[i:block]?/[i:parent]?', function (int $block = 0, int $parent = null) {
                try {
                    $navigation = Model\Navigation::with([
                        "page",
                        "navigation",
                        "navigations"
                    ])->where('navigation_block', $block)->where('navigation_id', $parent)->get();
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigation
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Navigation/[i:id]', function (int $id = null) {
                try {
                    $navigation = null;
                    if (isset($id) === true) {
                        $navigation = Model\Navigation::with([
                            "page",
                            "navigation",
                            "navigations"
                        ])->find($id);
                    } else {
                        throw new \InvalidArgumentException("No navigation ID given");
                    }
                    if ($navigation === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No navigation element found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigation
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/all', function (array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ]);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/template/[:template]?', function (string $template = 'default', array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('template', $template);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/parent/[i:parent]?', function (int $parent = null, array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('page_id', $parent);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/type/[i:type]?', function (int $type = 0, array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('type', $type);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/link/[**:link]?', function (string $link = '/') use ($auth, $view) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('link', $link);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false && $link != '/') {
                        $page->where('status', true);
                    }
                    $page = $page->first();
                    $view->setLink($page->link)->get();
                    if ($page === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No page found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/[i:id]', function (int $id = null) use ($auth, $view) {
                try {
                    $page = null;
                    if (isset($id) === true) {
                        $page = Model\Page::with([
                            "page",
                            "pages",
                            "user"
                        ])->where("id", $id);
                        if ($auth->allow(["min" => 3, "max" => 1]) === false && $id != 1) {
                            $page->where('status', true);
                        }
                        $page = $page->first();
                    } else {
                        throw new \InvalidArgumentException("No page ID given");
                    }
                    if ($page === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No page found.'
                        ];
                    }
                    $view->setLink($page->link)->get();
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Setting/[i:id]', function (int $id = null) {
                try {
                    $setting = null;
                    if (isset($id) === true) {
                        $setting = Model\Setting::find($id);
                    } else {
                        throw new \InvalidArgumentException("No setting ID given");
                    }
                    if ($setting === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No setting found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $setting
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Role/all', function (array $request = null) {
                try {
                    $role = Model\Role::with("users");
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $role = $role->paginate($request["paginate"]);
                    } else {
                        $role = $role->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $role
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Role/[i:id]', function (int $id = null) {
                try {
                    $role = null;
                    if (isset($id) === true) {
                        $role = Model\Role::with("users")->find($id);
                    } else {
                        throw new \InvalidArgumentException("No role ID given");
                    }
                    if ($role === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No role found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $role
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/all', function (array $request = null) {
                try {
                    $user = Model\User::with("role");
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $user = $user->paginate($request["paginate"]);
                    } else {
                        $user = $user->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/role/[i:role]?', function (int $role = 5, array $request = null) {
                try {
                    $user = Model\User::with("role")->where('role_id', $role);
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $user = $user->paginate($request["paginate"]);
                    } else {
                        $user = $user->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/verify-reset/[a:reset_code]', function (string $reset_code = null) {
                if (isset($reset_code) === false) {
                    throw new \InvalidArgumentException("No user found");
                }
                $user = Model\User::where("reset_code", $reset_code)->first();
                if ($user === null) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 404',
                                true,
                                404
                            ]
                        ],
                        "response" => false
                    ];
                }
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }],
            ['GET', '/User/username/[u:username]', function (string $username = null) {
                try {
                    $user = null;
                    if (isset($username) === true) {
                        $user = Model\User::with("role")->where('user', $username)->first();
                    } else {
                        throw new \InvalidArgumentException("No user username given");
                    }
                    if ($user === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No user found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/[i:id]', function (int $id = null) {
                try {
                    $user = null;
                    if (isset($id) === true) {
                        $user = Model\User::with("role")->find($id);
                    } else {
                        throw new \InvalidArgumentException("No user ID given");
                    }
                    if ($user === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No user found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }]
        ];
    }
public function getMap(): array
    {
        $auth = $this->auth;
        $view = $this->view;
        return [
            ['GET', '/', function () {
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => json_decode(file_get_contents(dirname(__DIR__) . "/composer.json"))
                ];
            }],
            ['GET', '/Auth/details', function () {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->auth()->details;
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/Auth/allow/[i:min]?/[i:max]?', function (int $min = 4, int $max = 4) {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->auth()->allow(["min" => $min, "max" => $max]);
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/Site/[a:property]?', function (string $property = null) {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->site()->{$property};
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/View', function () {
                $core = $this->container->get("TheCMSThread\\Core\\Core");
                $result = $core->view()->details;
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => $result
                ];
            }],
            ['GET', '/Navigation/all/flatten/[i:block]?', function (int $block = 0) {
                try {
                    $navigations_list = Model\Navigation::with([
                        "page",
                        "navigation",
                        "navigations"
                    ])->where('navigation_block', $block)->where('navigation_id', null)->get();
                    $navigations = [];
                    $queue = [];
                    foreach ($navigations_list as $navigation) {
                        $navigation->level = 0;
                        $navigations[] = $navigation;
                        $queue = [$navigation];
                        foreach ($queue as $element) {
                            foreach ($element->navigations as $nested_element) {
                                $nested_element->level = $element->level + 1;
                                $navigations[] = $nested_element;
                                $queue[] = $nested_element;
                            }
                        }
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigations
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Navigation/all/[i:block]?', function (int $block = 0) {
                try {
                    $navigations = Model\Navigation::with([
                        "page",
                        "navigation",
                        "navigations"
                    ])->where('navigation_block', $block)->where('navigation_id', null)->get();
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigations
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Navigation/parent/[i:block]?/[i:parent]?', function (int $block = 0, int $parent = null) {
                try {
                    $navigation = Model\Navigation::with([
                        "page",
                        "navigation",
                        "navigations"
                    ])->where('navigation_block', $block)->where('navigation_id', $parent)->get();
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigation
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Navigation/[i:id]', function (int $id = null) {
                try {
                    $navigation = null;
                    if (isset($id) === true) {
                        $navigation = Model\Navigation::with([
                            "page",
                            "navigation",
                            "navigations"
                        ])->find($id);
                    } else {
                        throw new \InvalidArgumentException("No navigation ID given");
                    }
                    if ($navigation === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No navigation element found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $navigation
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/all', function (array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ]);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/template/[:template]?', function (string $template = 'default', array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('template', $template);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/parent/[i:parent]?', function (int $parent = null, array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('page_id', $parent);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/type/[i:type]?', function (int $type = 0, array $request = null) use ($auth) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('type', $type);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                        $page->where('status', true);
                    }
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $page = $page->paginate($request["paginate"]);
                    } else {
                        $page = $page->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/link/[**:link]?', function (string $link = '/') use ($auth, $view) {
                try {
                    $page = Model\Page::with([
                        "page",
                        "pages",
                        "user"
                    ])->where('link', $link);
                    if ($auth->allow(["min" => 3, "max" => 1]) === false && $link != '/') {
                        $page->where('status', true);
                    }
                    $page = $page->first();
                    $view->setLink($page->link)->get();
                    if ($page === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No page found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Page/[i:id]', function (int $id = null) use ($auth, $view) {
                try {
                    $page = null;
                    if (isset($id) === true) {
                        $page = Model\Page::with([
                            "page",
                            "pages",
                            "user"
                        ])->where("id", $id);
                        if ($auth->allow(["min" => 3, "max" => 1]) === false && $id != 1) {
                            $page->where('status', true);
                        }
                        $page = $page->first();
                    } else {
                        throw new \InvalidArgumentException("No page ID given");
                    }
                    if ($page === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No page found.'
                        ];
                    }
                    $view->setLink($page->link)->get();
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $page
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Setting/[i:id]', function (int $id = null) {
                try {
                    $setting = null;
                    if (isset($id) === true) {
                        $setting = Model\Setting::find($id);
                    } else {
                        throw new \InvalidArgumentException("No setting ID given");
                    }
                    if ($setting === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No setting found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $setting
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Role/all', function (array $request = null) {
                try {
                    $role = Model\Role::with("users");
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $role = $role->paginate($request["paginate"]);
                    } else {
                        $role = $role->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $role
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/Role/[i:id]', function (int $id = null) {
                try {
                    $role = null;
                    if (isset($id) === true) {
                        $role = Model\Role::with("users")->find($id);
                    } else {
                        throw new \InvalidArgumentException("No role ID given");
                    }
                    if ($role === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No role found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $role
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/all', function (array $request = null) {
                try {
                    $user = Model\User::with("role");
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $user = $user->paginate($request["paginate"]);
                    } else {
                        $user = $user->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/role/[i:role]?', function (int $role = 5, array $request = null) {
                try {
                    $user = Model\User::with("role")->where('role_id', $role);
                    if (empty($request) === false
                        && empty($request["paginate"]) === false
                        && is_numeric($request["paginate"]) === true) {
                        $user = $user->paginate($request["paginate"]);
                    } else {
                        $user = $user->get();
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/verify-reset/[a:reset_code]', function (string $reset_code = null) {
                if (isset($reset_code) === false) {
                    throw new \InvalidArgumentException("No user found");
                }
                $user = Model\User::where("reset_code", $reset_code)->first();
                if ($user === null) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 404',
                                true,
                                404
                            ]
                        ],
                        "response" => false
                    ];
                }
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }],
            ['GET', '/User/username/[u:username]', function (string $username = null) {
                try {
                    $user = null;
                    if (isset($username) === true) {
                        $user = Model\User::with("role")->where('user', $username)->first();
                    } else {
                        throw new \InvalidArgumentException("No user username given");
                    }
                    if ($user === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No user found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }],
            ['GET', '/User/[i:id]', function (int $id = null) {
                try {
                    $user = null;
                    if (isset($id) === true) {
                        $user = Model\User::with("role")->find($id);
                    } else {
                        throw new \InvalidArgumentException("No user ID given");
                    }
                    if ($user === null) {
                        return [
                            "headers" => [
                                [
                                    'X-PHP-Response-Code: 404',
                                    true,
                                    404
                                ]
                            ],
                            "response" => 'No user found.'
                        ];
                    }
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 200',
                                true,
                                200
                            ]
                        ],
                        "response" => $user
                    ];
                } catch (\Throwable $e) {
                    throw new \RuntimeException($e->getMessage());
                }
            }]
        ];
    }
Returns the request map for GET requests

@return array