fix: Аннотации типов
This commit is contained in:
parent
69370bdf38
commit
09a61244ca
3 changed files with 22 additions and 19 deletions
|
|
@ -21,13 +21,13 @@ class Action implements ActionInterface
|
||||||
const ACTION_PREFIX = "action"; // Префикс для функций действий
|
const ACTION_PREFIX = "action"; // Префикс для функций действий
|
||||||
|
|
||||||
// Параметры устанавливаются при создании контроллера
|
// Параметры устанавливаются при создании контроллера
|
||||||
public $name = ''; // Имя модуля
|
public string $name = ''; // Имя модуля
|
||||||
public $front;
|
public $front;
|
||||||
|
|
||||||
public $modulePath = null; // Путь к модулю
|
public string $modulePath = ''; // Путь к модулю
|
||||||
public $moduleTitle = '';
|
public string $moduleTitle = '';
|
||||||
|
|
||||||
public $viewPathPrefix = ''; // Путь к шаблонам контроллера
|
public string $viewPathPrefix = ''; // Путь к шаблонам контроллера
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Соединение с базой данных
|
* Соединение с базой данных
|
||||||
|
|
@ -40,7 +40,7 @@ class Action implements ActionInterface
|
||||||
public $logger = null; // Обьект для ведения лога
|
public $logger = null; // Обьект для ведения лога
|
||||||
|
|
||||||
private $factory = null; // Ссылка на обьект создания модели
|
private $factory = null; // Ссылка на обьект создания модели
|
||||||
private $helpers = array(); // Помошники для действий
|
private array $helpers = []; // Помошники для действий
|
||||||
public $part = null; // Параметры для ссылки
|
public $part = null; // Параметры для ссылки
|
||||||
|
|
||||||
/** @var \ctiso\Registry */
|
/** @var \ctiso\Registry */
|
||||||
|
|
@ -50,9 +50,9 @@ class Action implements ActionInterface
|
||||||
|
|
||||||
// Для Widgets
|
// Для Widgets
|
||||||
public $view = null;
|
public $view = null;
|
||||||
public $childNodes = array();
|
public array $childNodes = [];
|
||||||
public $ctrlValues = array();
|
public array $ctrlValues = [];
|
||||||
public $childViews = array();
|
public array $childViews = [];
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->part = new Url();
|
$this->part = new Url();
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class Login extends Filter
|
||||||
switch ($request->getAction()) {
|
switch ($request->getAction()) {
|
||||||
// Авторизация по постоянному паролю
|
// Авторизация по постоянному паролю
|
||||||
case 'login':
|
case 'login':
|
||||||
$login = $request->get('login');
|
$login = $request->get('login', '') ;
|
||||||
$password = $request->get('password');
|
$password = $request->get('password');
|
||||||
|
|
||||||
$result = $this->role->getUserByLogin($login); // Поиск по логину
|
$result = $this->role->getUserByLogin($login); // Поиск по логину
|
||||||
|
|
|
||||||
23
src/Path.php
23
src/Path.php
|
|
@ -16,7 +16,10 @@ class Path
|
||||||
protected array $url = [];
|
protected array $url = [];
|
||||||
protected bool $absolute = false;
|
protected bool $absolute = false;
|
||||||
|
|
||||||
public function __construct(string $path = '')
|
/**
|
||||||
|
* @param string $path Путь (Тип указан в doccomments т.к откудато приходит null)
|
||||||
|
*/
|
||||||
|
public function __construct($path = '')
|
||||||
{
|
{
|
||||||
$this->url = parse_url($path);
|
$this->url = parse_url($path);
|
||||||
|
|
||||||
|
|
@ -264,11 +267,10 @@ class Path
|
||||||
/**
|
/**
|
||||||
* Обьединяет строки в Path соединяя необходимым разделителем
|
* Обьединяет строки в Path соединяя необходимым разделителем
|
||||||
* fixme не обрабатывает параметры урла, решение Path::join(SITE_WWW_PATH) . '?param=pampam'
|
* fixme не обрабатывает параметры урла, решение Path::join(SITE_WWW_PATH) . '?param=pampam'
|
||||||
|
* @param string ...$args
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function fromJoin($_rest) {
|
static function fromJoin(string ...$args) {
|
||||||
$args = func_get_args();
|
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
$parts0 = new Path(array_shift($args));
|
$parts0 = new Path(array_shift($args));
|
||||||
$result [] = $parts0->getParts();
|
$result [] = $parts0->getParts();
|
||||||
|
|
@ -286,29 +288,30 @@ class Path
|
||||||
/**
|
/**
|
||||||
* Обьединяет строки в строку пути соединяя необходимым разделителем
|
* Обьединяет строки в строку пути соединяя необходимым разделителем
|
||||||
* fixme не обрабатывает параметры урла, решение Path::join(SITE_WWW_PATH) . '?param=pampam'
|
* fixme не обрабатывает параметры урла, решение Path::join(SITE_WWW_PATH) . '?param=pampam'
|
||||||
|
* @param string ...$args
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function join($_rest)
|
static function join(string ...$args)
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
|
||||||
$path = call_user_func_array([self::class, "fromJoin"], $args);
|
$path = call_user_func_array([self::class, "fromJoin"], $args);
|
||||||
return self::makeUrl($path->url);
|
return self::makeUrl($path->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка структуры имени файла
|
// Проверка структуры имени файла
|
||||||
static function checkName($name, $extension)
|
static function checkName(string $name, string $extension)
|
||||||
{
|
{
|
||||||
return (strlen(pathinfo($name, PATHINFO_FILENAME)) > 0) && (pathinfo($name, PATHINFO_EXTENSION) == $extension);
|
return (strlen(pathinfo($name, PATHINFO_FILENAME)) > 0) && (pathinfo($name, PATHINFO_EXTENSION) == $extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function isCharName($char)
|
static function isCharName(string $char)
|
||||||
{
|
{
|
||||||
$ch = ord($char);
|
$ch = ord($char);
|
||||||
return ((($ch >= ord('a')) && ($ch <= ord('z'))) || (strpos('-._', $char) !== false) || (($ch >= ord('0')) && ($ch <= ord('9'))));
|
return ((($ch >= ord('a')) && ($ch <= ord('z'))) || (strpos('-._', $char) !== false) || (($ch >= ord('0')) && ($ch <= ord('9'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка имени файла
|
// Проверка имени файла
|
||||||
static function isName($name) {
|
static function isName(string $name): bool
|
||||||
|
{
|
||||||
if (strlen(trim($name)) == 0) {
|
if (strlen(trim($name)) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -320,7 +323,7 @@ class Path
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAbsolute()
|
public function isAbsolute(): bool
|
||||||
{
|
{
|
||||||
return $this->absolute;
|
return $this->absolute;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue