chore: Проверки для типов

This commit is contained in:
origami11@yandex.ru 2025-12-01 16:19:28 +03:00
parent 6fdc3eb46b
commit 5d3fae4249
15 changed files with 125 additions and 42 deletions

View file

@ -5,12 +5,13 @@ use Exception;
class View extends \stdClass
{
protected array $_section = []; // Вложенные шаблоны
// Блоки
/** @var string[] $_stylesheet */
protected array $_stylesheet = []; // Массив стилей текущего шаблона
/** @var string[] $_script */
protected array $_script = []; // Массив скриптов текущего шаблона
/** @var array<View|string> Вложенные шаблоны */
protected array $_section = [];
/** @var string[] $_stylesheet Массив стилей текущего шаблона */
protected array $_stylesheet = [];
/** @var string[] $_script Массив скриптов текущего шаблона */
protected array $_script = [];
/** @var string[] $_scriptstring */
public array $_scriptstring = [];
/** @var string[] $_startup */
@ -46,7 +47,7 @@ class View extends \stdClass
*/
public function setView($section, $view): void
{
$this->_section [$section] = $view;
$this->_section[$section] = $view;
if (is_object($view)) {
$view->parent_view = $this;
}
@ -122,6 +123,14 @@ class View extends \stdClass
return $result;
}
/*
function getTitleArray(): array {
return array_reduce($this->_section, fn ($result, $item) =>
is_object($item) ? array_merge($result, $item->getTitleArray()) : $result, []);
}
*/
/*abstract*/ public function set(string $key, mixed $value): void
{
}
@ -208,4 +217,11 @@ class View extends \stdClass
}
return $result;
}
/**
* @return View|string|false
*/
function execute() {
return '';
}
}