diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/composer.lock b/composer.lock old mode 100644 new mode 100755 diff --git a/mirzaev/minimal/system/controller.php b/mirzaev/minimal/system/controller.php old mode 100644 new mode 100755 diff --git a/mirzaev/minimal/system/core.php b/mirzaev/minimal/system/core.php old mode 100644 new mode 100755 index 717ed09..7155d0d --- a/mirzaev/minimal/system/core.php +++ b/mirzaev/minimal/system/core.php @@ -90,9 +90,9 @@ final class core * * @param ?string $uri Маршрут * - * @return ?string Сгенерированный ответ (HTML, JSON...) + * @return string|int|null Ответ */ - public function start(string $uri = null): ?string + public function start(string $uri = null): string|int|null { // Обработка запроса return $this->__get('router')->handle($uri, core: $this); diff --git a/mirzaev/minimal/system/model.php b/mirzaev/minimal/system/model.php old mode 100644 new mode 100755 diff --git a/mirzaev/minimal/system/router.php b/mirzaev/minimal/system/router.php old mode 100644 new mode 100755 index ad878bf..40e21f6 --- a/mirzaev/minimal/system/router.php +++ b/mirzaev/minimal/system/router.php @@ -51,9 +51,11 @@ final class router * * @param ?string $uri URI запроса (https://domain.com/foo/bar) * @param ?string $method Метод запроса (GET, POST, PUT...) - * @param ?core $core Инстанция системного ядра + * @param ?core $core Инстанция системного ядра + * + * @return string|int|null Ответ */ - public function handle(?string $uri = null, ?string $method = null, ?core $core = new core): ?string + public function handle(?string $uri = null, ?string $method = null, ?core $core = new core): string|int|null { // Инициализация значений по умолчанию $uri ??= $_SERVER['REQUEST_URI'] ?? '/'; @@ -115,16 +117,16 @@ final class router if (array_key_exists($method, $data)) { // Идентифицирован метод маршрута (GET, POST, PUT...) - $route = $data[$method]; + $route = $data[$method]; if (class_exists($controller = $core->namespace . '\\controllers\\' . $route['controller'] . $core->controller::POSTFIX)) { // Найден контроллер // Инициализация инстанции ядра контроллера - $controller = new $controller; + $controller = new $controller; // Инициализация инстанции ядра модели - if (class_exists($model = $core->namespace . '\\models\\' . $route['model'] . $core->model::POSTFIX)) $controller->model = new $model; + if (class_exists($model = $core->namespace . '\\models\\' . $route['model'] . $core->model::POSTFIX)); // Вызов связанного с маршрутом методв и возврат (успех) return $controller->{$route['method']}($data['vars'] + $_REQUEST, $_FILES);