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"; // Префикс для функций действий
|
||||
|
||||
// Параметры устанавливаются при создании контроллера
|
||||
public $name = ''; // Имя модуля
|
||||
public string $name = ''; // Имя модуля
|
||||
public $front;
|
||||
|
||||
public $modulePath = null; // Путь к модулю
|
||||
public $moduleTitle = '';
|
||||
public string $modulePath = ''; // Путь к модулю
|
||||
public string $moduleTitle = '';
|
||||
|
||||
public $viewPathPrefix = ''; // Путь к шаблонам контроллера
|
||||
public string $viewPathPrefix = ''; // Путь к шаблонам контроллера
|
||||
|
||||
/**
|
||||
* Соединение с базой данных
|
||||
|
|
@ -40,7 +40,7 @@ class Action implements ActionInterface
|
|||
public $logger = null; // Обьект для ведения лога
|
||||
|
||||
private $factory = null; // Ссылка на обьект создания модели
|
||||
private $helpers = array(); // Помошники для действий
|
||||
private array $helpers = []; // Помошники для действий
|
||||
public $part = null; // Параметры для ссылки
|
||||
|
||||
/** @var \ctiso\Registry */
|
||||
|
|
@ -50,9 +50,9 @@ class Action implements ActionInterface
|
|||
|
||||
// Для Widgets
|
||||
public $view = null;
|
||||
public $childNodes = array();
|
||||
public $ctrlValues = array();
|
||||
public $childViews = array();
|
||||
public array $childNodes = [];
|
||||
public array $ctrlValues = [];
|
||||
public array $childViews = [];
|
||||
|
||||
function __construct() {
|
||||
$this->part = new Url();
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Login extends Filter
|
|||
switch ($request->getAction()) {
|
||||
// Авторизация по постоянному паролю
|
||||
case 'login':
|
||||
$login = $request->get('login');
|
||||
$login = $request->get('login', '') ;
|
||||
$password = $request->get('password');
|
||||
|
||||
$result = $this->role->getUserByLogin($login); // Поиск по логину
|
||||
|
|
|
|||
23
src/Path.php
23
src/Path.php
|
|
@ -16,7 +16,10 @@ class Path
|
|||
protected array $url = [];
|
||||
protected bool $absolute = false;
|
||||
|
||||
public function __construct(string $path = '')
|
||||
/**
|
||||
* @param string $path Путь (Тип указан в doccomments т.к откудато приходит null)
|
||||
*/
|
||||
public function __construct($path = '')
|
||||
{
|
||||
$this->url = parse_url($path);
|
||||
|
||||
|
|
@ -264,11 +267,10 @@ class Path
|
|||
/**
|
||||
* Обьединяет строки в Path соединяя необходимым разделителем
|
||||
* fixme не обрабатывает параметры урла, решение Path::join(SITE_WWW_PATH) . '?param=pampam'
|
||||
* @param string ...$args
|
||||
* @return string
|
||||
*/
|
||||
static function fromJoin($_rest) {
|
||||
$args = func_get_args();
|
||||
|
||||
static function fromJoin(string ...$args) {
|
||||
$result = [];
|
||||
$parts0 = new Path(array_shift($args));
|
||||
$result [] = $parts0->getParts();
|
||||
|
|
@ -286,29 +288,30 @@ class Path
|
|||
/**
|
||||
* Обьединяет строки в строку пути соединяя необходимым разделителем
|
||||
* fixme не обрабатывает параметры урла, решение Path::join(SITE_WWW_PATH) . '?param=pampam'
|
||||
* @param string ...$args
|
||||
* @return string
|
||||
*/
|
||||
static function join($_rest)
|
||||
static function join(string ...$args)
|
||||
{
|
||||
$args = func_get_args();
|
||||
$path = call_user_func_array([self::class, "fromJoin"], $args);
|
||||
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);
|
||||
}
|
||||
|
||||
static function isCharName($char)
|
||||
static function isCharName(string $char)
|
||||
{
|
||||
$ch = ord($char);
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -320,7 +323,7 @@ class Path
|
|||
return true;
|
||||
}
|
||||
|
||||
public function isAbsolute()
|
||||
public function isAbsolute(): bool
|
||||
{
|
||||
return $this->absolute;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue