chore: Аннотации к типам
This commit is contained in:
parent
530a3b931d
commit
730a608f9b
27 changed files with 491 additions and 134 deletions
|
|
@ -61,6 +61,11 @@ class Action implements ActionInterface
|
|||
public function setUp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Загрузка файла настроек
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
public function loadConfig($name) {
|
||||
$basePath = $this->config->get('site', 'path');
|
||||
|
||||
|
|
@ -74,17 +79,27 @@ class Action implements ActionInterface
|
|||
return $settings;
|
||||
}
|
||||
|
||||
public function getConnection()
|
||||
public function getConnection(): Database
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Путь к установке модуля
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public function installPath($name)
|
||||
{
|
||||
$basePath = $this->config->get('system', 'path');
|
||||
return Path::join($basePath, "modules", $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавляет подсказки
|
||||
* @param View $view
|
||||
* @param string $name
|
||||
*/
|
||||
public function addSuggest(View $view, $name) {
|
||||
$suggest = [];
|
||||
$file = Path::join($this->modulePath, 'help', $name . '.suggest');
|
||||
|
|
@ -93,6 +108,12 @@ class Action implements ActionInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Поиск иконки
|
||||
* @param string $icon
|
||||
* @param int $size
|
||||
* @return string Путь к иконке
|
||||
*/
|
||||
function findIcon($icon, $size) {
|
||||
$webPath = $this->config->get('site', 'web');
|
||||
return Path::join($webPath, 'icons', $size . 'x' . $size, $icon . '.png');
|
||||
|
|
@ -192,6 +213,12 @@ class Action implements ActionInterface
|
|||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Перенаправление на другой контроллер
|
||||
* @param string $action
|
||||
* @param HttpRequest $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function forward($action, HttpRequest $args) {
|
||||
$value = call_user_func([$this, $action], $args);
|
||||
return $value;
|
||||
|
|
@ -199,12 +226,19 @@ class Action implements ActionInterface
|
|||
|
||||
/**
|
||||
* Страница по умолчанию
|
||||
* @param HttpRequest $request
|
||||
* @return string|\ctiso\View\View
|
||||
*/
|
||||
public function actionIndex(HttpRequest $request) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public function addUrlPart($key, $value) {
|
||||
/**
|
||||
* Добавление части ссылки
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*/
|
||||
public function addUrlPart($key, $value): void {
|
||||
$this->part->addQueryParam($key, $value);
|
||||
}
|
||||
|
||||
|
|
@ -277,6 +311,10 @@ class Action implements ActionInterface
|
|||
|
||||
/**
|
||||
* Загрузка файла класса
|
||||
* @deprecated
|
||||
* @param string $path
|
||||
* @param mixed $setup
|
||||
* @param string $prefix
|
||||
*/
|
||||
public function loadClass($path, $setup = null, $prefix = '')
|
||||
{
|
||||
|
|
@ -288,6 +326,11 @@ class Action implements ActionInterface
|
|||
throw new Exception("NO CLASS $path");
|
||||
}
|
||||
|
||||
/**
|
||||
* Загрузка настроек
|
||||
* @param $path
|
||||
* @return array
|
||||
*/
|
||||
public function loadSettings($path)
|
||||
{
|
||||
$result = new Settings($path);
|
||||
|
|
@ -295,7 +338,7 @@ class Action implements ActionInterface
|
|||
return $result->export();
|
||||
}
|
||||
|
||||
public function setView($name)
|
||||
public function setView($name): void
|
||||
{
|
||||
$this->view = $this->getView($name);
|
||||
}
|
||||
|
|
@ -303,7 +346,7 @@ class Action implements ActionInterface
|
|||
/**
|
||||
* Установка заголовка для отображения
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setTitle($title): void
|
||||
{
|
||||
$this->view->setTitle($title);
|
||||
}
|
||||
|
|
@ -311,12 +354,12 @@ class Action implements ActionInterface
|
|||
/**
|
||||
* Добавление widget к отображению
|
||||
*/
|
||||
public function addChild($section, $node)
|
||||
public function addChild($section, $node): void
|
||||
{
|
||||
$this->childNodes[$section] = $node;
|
||||
}
|
||||
|
||||
public function setValue($name, $value)
|
||||
public function setValue($name, $value): void
|
||||
{
|
||||
$this->ctrlValues[$name] = $value;
|
||||
}
|
||||
|
|
@ -324,7 +367,7 @@ class Action implements ActionInterface
|
|||
/**
|
||||
* Добавление дочернего отображения к текущему отображению
|
||||
*/
|
||||
public function addView($section, $node)
|
||||
public function addView($section, $node): void
|
||||
{
|
||||
$this->childViews[$section] = $node;
|
||||
}
|
||||
|
|
@ -353,12 +396,21 @@ class Action implements ActionInterface
|
|||
return $this->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Установка идентификатора страницы
|
||||
* @return int
|
||||
*/
|
||||
function getPageId(HttpRequest $request) {
|
||||
$pageId = time();
|
||||
$request->session()->set('page', $pageId);
|
||||
return $pageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка идентификатора страницы
|
||||
* @param $page int Идентификатор страницы
|
||||
* @return bool
|
||||
*/
|
||||
function checkPageId(HttpRequest $request, $page)
|
||||
{
|
||||
if ($request->get('__forced__')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue