chore: Аннотации к типам
This commit is contained in:
parent
386a927254
commit
245b5c6c19
18 changed files with 191 additions and 104 deletions
|
|
@ -1,16 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Controller;
|
||||
use Exception,
|
||||
ctiso\Path,
|
||||
ctiso\Url,
|
||||
ctiso\Model\Factory,
|
||||
ctiso\HttpRequest,
|
||||
ctiso\Settings,
|
||||
ctiso\Database,
|
||||
ctiso\View\Composite,
|
||||
ctiso\View\View,
|
||||
App\Controller\State;
|
||||
|
||||
use Exception;
|
||||
use ctiso\Path;
|
||||
use ctiso\Url;
|
||||
use ctiso\Model\Factory;
|
||||
use ctiso\HttpRequest;
|
||||
use ctiso\Settings;
|
||||
use ctiso\Database;
|
||||
use ctiso\View\Composite;
|
||||
use ctiso\View\View;
|
||||
use App\Controller\State;
|
||||
|
||||
/**
|
||||
* Контроллер страниц
|
||||
*/
|
||||
|
|
@ -37,6 +39,7 @@ class Action implements ActionInterface
|
|||
// Фильтры
|
||||
/** @var ?\ctiso\Filter\ActionAccess */
|
||||
public $access = null; // Обьект хранит параметры доступа
|
||||
/** @var ?\ctiso\Filter\ActionLogger */
|
||||
public $logger = null; // Обьект для ведения лога
|
||||
|
||||
private $factory = null; // Ссылка на обьект создания модели
|
||||
|
|
@ -100,7 +103,7 @@ class Action implements ActionInterface
|
|||
* @param View $view
|
||||
* @param string $name
|
||||
*/
|
||||
public function addSuggest(View $view, $name) {
|
||||
public function addSuggest(View $view, $name): void {
|
||||
$suggest = [];
|
||||
$file = Path::join($this->modulePath, 'help', $name . '.suggest');
|
||||
if (file_exists($file)) {
|
||||
|
|
@ -188,6 +191,7 @@ class Action implements ActionInterface
|
|||
* 1. Можно переопределить действия
|
||||
* 2. Использовать наследование чтобы добавить к старому обработчику новое поведение
|
||||
* @param HttpRequest $request запроса
|
||||
* @return View|string
|
||||
*/
|
||||
public function preProcess(HttpRequest $request)
|
||||
{
|
||||
|
|
@ -203,6 +207,11 @@ class Action implements ActionInterface
|
|||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Выполнение действия
|
||||
* @param HttpRequest $request
|
||||
* @return View|string
|
||||
*/
|
||||
public function execute(HttpRequest $request)
|
||||
{
|
||||
$result = $this->preProcess($request);
|
||||
|
|
@ -227,7 +236,7 @@ class Action implements ActionInterface
|
|||
/**
|
||||
* Страница по умолчанию
|
||||
* @param HttpRequest $request
|
||||
* @return string|\ctiso\View\View
|
||||
* @return View|string
|
||||
*/
|
||||
public function actionIndex(HttpRequest $request) {
|
||||
return "";
|
||||
|
|
@ -355,14 +364,19 @@ class Action implements ActionInterface
|
|||
|
||||
/**
|
||||
* Добавление widget к отображению
|
||||
* @param $section
|
||||
* @param $node
|
||||
* @param string $section
|
||||
* @param View $node
|
||||
*/
|
||||
public function addChild($section, $node): void
|
||||
{
|
||||
$this->childNodes[$section] = $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Установка значения контроллера
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setValue($name, $value): void
|
||||
{
|
||||
$this->ctrlValues[$name] = $value;
|
||||
|
|
@ -370,6 +384,8 @@ class Action implements ActionInterface
|
|||
|
||||
/**
|
||||
* Добавление дочернего отображения к текущему отображению
|
||||
* @param string $section
|
||||
* @param View $node
|
||||
*/
|
||||
public function addView($section, $node): void
|
||||
{
|
||||
|
|
@ -379,6 +395,7 @@ class Action implements ActionInterface
|
|||
/**
|
||||
* Генерация содержания
|
||||
* Путаница c execute и render
|
||||
* @return View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
|
|
@ -426,16 +443,14 @@ class Action implements ActionInterface
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return State
|
||||
*/
|
||||
function _getActionPath() {
|
||||
return new State('index');
|
||||
}
|
||||
|
||||
// Тоже убрать в метод Controller_Model
|
||||
function getActionPath(HttpRequest $request, $action = null) {
|
||||
$this->_getActionPath()->getPath($this, ($action) ? $action : $request->getAction());
|
||||
}
|
||||
|
||||
function redirect(string $action) {
|
||||
function redirect(string $action): void {
|
||||
header('location: ' . $action);
|
||||
exit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue