diff --git a/src/Controller/Action.php b/src/Controller/Action.php index b4d1db0..49f345e 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -6,14 +6,10 @@ use Exception, ctiso\Url, ctiso\Model\Factory, ctiso\HttpRequest, - ctiso\Functions, ctiso\Settings, - ctiso\Registry, - ctiso\Role\User, ctiso\View\Composite, - ctiso\Filter\ActionAccess, ctiso\View\View, - ctiso\Controller\State; + App\Controller\State; /** * Контроллер страниц */ diff --git a/src/Controller/Service.php b/src/Controller/Service.php index cccecdf..0d527ef 100644 --- a/src/Controller/Service.php +++ b/src/Controller/Service.php @@ -5,6 +5,7 @@ */ namespace ctiso\Controller; use ctiso\Path, + ctiso\Model\BaseMapper, ctiso\File, ctiso\Registry, ctiso\Database\PDOStatement; @@ -40,8 +41,8 @@ class Service /** * Создает модель - * @param string $name - * @return Model + * @param string $name + * @return BaseMapper */ public function getModel($name) { diff --git a/src/Controller/State.php b/src/Controller/State.php deleted file mode 100644 index 225de1a..0000000 --- a/src/Controller/State.php +++ /dev/null @@ -1,74 +0,0 @@ -action = $action; - } - - static function make($action) - { - return new State($action); - } - - public function addTitle($name, $url = array()) - { - $this->titles [] = array($name, $url); - return $this; - } - - public function addState(State $state) - { - $this->states [$state->getAction()] = $state; - return $this; - } - - public function getAction() - { - return $this->action; - } - - function checkAction($action, &$list) - { - if ($this->action == $action) { - array_push($list, $this); - return true; - } else { - foreach ($this->states as $state) { - if ($state->checkAction($action, $list)) { - array_push($list, $this); - return true; - } - } - } - return false; - } - - function makeTitle(Action $module) - { - foreach ($this->titles as $item) { - $module->path->addMenuItem($module->nUrl($this->action, $item[1]), $item[0]); - } - } - - function getPath($module, $action) - { - $list = array(); - if ($this->checkAction($action, $list)) { - foreach (array_reverse($list) as $item) { - $item->makeTitle($module); - } - } else { - $this->makeTitle($module); - } - } -} diff --git a/src/Database.php b/src/Database.php index 3c06748..2e86124 100644 --- a/src/Database.php +++ b/src/Database.php @@ -51,7 +51,7 @@ class Database/**/ extends PDO $connection = null; if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') { $port = (isset($dsn['port'])) ? "port={$dsn['port']};" : ""; - $connection/*: Database*/ = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']); + $connection/*: Database*/ = new self("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']); if ($dsn['phptype'] == 'pgsql') { $connection->query('SET client_encoding="UTF-8"'); } @@ -61,7 +61,7 @@ class Database/**/ extends PDO } } if ($dsn['phptype'] == 'sqlite') { - $connection/*: Database*/ = new static("{$dsn['phptype']}:{$dsn['database']}"); + $connection/*: Database*/ = new self("{$dsn['phptype']}:{$dsn['database']}"); $connection->setAttribute(PDO::ATTR_TIMEOUT, 5); $mode = defined('SQLITE_JOURNAL_MODE') ? SQLITE_JOURNAL_MODE : 'WAL'; $connection->query("PRAGMA journal_mode=$mode"); diff --git a/src/Form/Field.php b/src/Form/Field.php index 83a23ea..1b2c0d2 100644 --- a/src/Form/Field.php +++ b/src/Form/Field.php @@ -21,10 +21,10 @@ class Field public $_title = array(); public $description = ""; public $alias = array(); - + + /** @phpstan-ignore-next-line */ public function __construct ($input = array(), $factory = null) - { - + { $this->default = null; if (isset($input['validate'])) { $this->require = strpos($input['validate'], 'require') !== false; diff --git a/src/Primitive.php b/src/Primitive.php index 2cba7c8..13a5bb5 100644 --- a/src/Primitive.php +++ b/src/Primitive.php @@ -47,21 +47,23 @@ class Primitive { { $result = 0; $tmp = explode("/", $value ?? '', 3); - if (!empty($tmp)) { - if (count($tmp) != 3) return $result; + + if (count($tmp) != 3) { + return $result; + } - $year = (int)$tmp[2]; - $month = (int)$tmp[1]; - $day = (int)$tmp[0]; + $year = (int)$tmp[2]; + $month = (int)$tmp[1]; + $day = (int)$tmp[0]; - if ($month != 0 && $day != 0 && $year != 0) { - if (checkdate($month, $day, $year)) { - return mktime(0, 0, 0, $month, $day, $year); - } else { - return 0; - } + if ($month != 0 && $day != 0 && $year != 0) { + if (checkdate($month, $day, $year)) { + return mktime(0, 0, 0, $month, $day, $year); + } else { + return 0; } } + return $result; }