From 0c3fba0d7e3d131f02efe61bc8c7e7bb226eb15f Mon Sep 17 00:00:00 2001 From: "origami11@yandex.ru" Date: Tue, 31 Jan 2023 10:49:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Component.php | 8 +++++--- src/Model/Factory.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Controller/Component.php b/src/Controller/Component.php index badc2f0..f0c6647 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -208,9 +208,11 @@ class Component $filename = Path::join($this->viewPath[count($this->viewPath) - 1], 'install.json'); if (file_exists($filename)) { $settings = json_decode(File::getContents($filename), true); - return $settings; + if ($settings) { + return $settings; + } } - return array(); + return array('parameter' => []); } /** @@ -246,7 +248,7 @@ class Component $name = $path; $path = Path::join ($site->config->get('site', 'components'), $name, $name . '.php'); - $className = 'Components\\'. ucfirst($name). '\\' . ucfirst($name); + $className = implode("\\", ['Components', ucfirst($name), ucfirst($name)]); $component/*: Component*/ = null; diff --git a/src/Model/Factory.php b/src/Model/Factory.php index 39d30ca..dd99fd7 100644 --- a/src/Model/Factory.php +++ b/src/Model/Factory.php @@ -10,7 +10,7 @@ class Factory public $db; public $config; - public function __construct (Database $db, Registry $config = null, User $user) + public function __construct (Database $db, Registry $config = null, User $user = null) { $this->db = $db; $this->config = $config;