summaryrefslogtreecommitdiff
path: root/engine/RequestHandler.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2024-01-31 06:11:00 +0300
committerEvgeny Zinoviev <me@ch1p.io>2024-01-31 20:45:40 +0300
commitc0dc531ebefd8912819f3b6c8bda1fed3c7e750c (patch)
tree2c75aa9df182260aef09faf4befd81a4c2b9c5e2 /engine/RequestHandler.php
parent48d688cdf7f9eae1bf11b8a6f0e5b98687c604cb (diff)
make it simple, but not simpler
Diffstat (limited to 'engine/RequestHandler.php')
-rw-r--r--engine/RequestHandler.php56
1 files changed, 0 insertions, 56 deletions
diff --git a/engine/RequestHandler.php b/engine/RequestHandler.php
deleted file mode 100644
index a9dfccd..0000000
--- a/engine/RequestHandler.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-class RequestHandler {
-
- public function __construct(
- protected Skin $skin,
- protected LangData $lang,
- protected array $routerInput
- ) {}
-
- public function beforeDispatch(): ?Response {
- return null;
- }
-
- public function get(): Response {
- throw new NotImplementedException();
- }
-
- public function post(): Response {
- throw new NotImplementedException();
- }
-
- public function input(string $input): array {
- $input = preg_split('/,\s+?/', $input, -1, PREG_SPLIT_NO_EMPTY);
- $ret = [];
- foreach ($input as $var) {
- if (($pos = strpos($var, ':')) !== false) {
- $type = InputType::from(substr($var, 0, $pos));
- $name = trim(substr($var, $pos+1));
- } else {
- $type = InputType::STRING;
- $name = $var;
- }
-
- $value = $this->routerInput[$name] ?? $_REQUEST[$name] ?? '';
- switch ($type) {
- case InputType::INT:
- $value = (int)$value;
- break;
- case InputType::FLOAT:
- $value = (float)$value;
- break;
- case InputType::BOOL:
- $value = (bool)$value;
- break;
- }
-
- $ret[] = $value;
- }
- return $ret;
- }
-
- protected function isRetina(): bool {
- return isset($_COOKIE['is_retina']) && $_COOKIE['is_retina'];
- }
-}