1 Commits
2.2.1 ... 2.1.1

Author SHA1 Message Date
24fe47f1e7 fix postfix private 2023-11-18 01:23:21 +07:00
7 changed files with 7 additions and 9 deletions

0
.gitignore vendored Executable file → Normal file
View File

0
composer.json Executable file → Normal file
View File

0
composer.lock generated Executable file → Normal file
View File

0
mirzaev/minimal/system/controller.php Executable file → Normal file
View File

4
mirzaev/minimal/system/core.php Executable file → Normal file
View File

@@ -90,9 +90,9 @@ final class core
*
* @param ?string $uri Маршрут
*
* @return string|int|null Ответ
* @return ?string Сгенерированный ответ (HTML, JSON...)
*/
public function start(string $uri = null): string|int|null
public function start(string $uri = null): ?string
{
// Обработка запроса
return $this->__get('router')->handle($uri, core: $this);

0
mirzaev/minimal/system/model.php Executable file → Normal file
View File

6
mirzaev/minimal/system/router.php Executable file → Normal file
View File

@@ -52,10 +52,8 @@ final class router
* @param ?string $uri URI запроса (https://domain.com/foo/bar)
* @param ?string $method Метод запроса (GET, POST, PUT...)
* @param ?core $core Инстанция системного ядра
*
* @return string|int|null Ответ
*/
public function handle(?string $uri = null, ?string $method = null, ?core $core = new core): string|int|null
public function handle(?string $uri = null, ?string $method = null, ?core $core = new core): ?string
{
// Инициализация значений по умолчанию
$uri ??= $_SERVER['REQUEST_URI'] ?? '/';
@@ -126,7 +124,7 @@ final class router
$controller = new $controller;
// Инициализация инстанции ядра модели
if (class_exists($model = $core->namespace . '\\models\\' . $route['model'] . $core->model::POSTFIX));
if (class_exists($model = $core->namespace . '\\models\\' . $route['model'] . $core->model::POSTFIX)) $controller->model = new $model;
// Вызов связанного с маршрутом методв и возврат (успех)
return $controller->{$route['method']}($data['vars'] + $_REQUEST, $_FILES);