Merge branch 'master' into noglob
This commit is contained in:
commit
7d35a8f3f0
27 changed files with 430 additions and 288 deletions
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso;
|
||||
use ctiso\File,
|
||||
Exception;
|
||||
|
||||
/**
|
||||
* Класс реестра
|
||||
* Реестр организован как ассоциативный многомерный массив
|
||||
|
|
@ -9,19 +13,18 @@
|
|||
* parameters1, parameters1 - Массивы с параметрами модуля
|
||||
* Имя необходимо чтобы потом легко было удалить ненужные ветки дерева
|
||||
*/
|
||||
namespace ctiso;
|
||||
use ctiso\File,
|
||||
Exception;
|
||||
|
||||
class Settings
|
||||
{
|
||||
public $data = [];
|
||||
protected $file;
|
||||
protected $format = 'php';
|
||||
|
||||
public function __construct ($file = null)
|
||||
public function __construct ($file = null, $format = false)
|
||||
{
|
||||
$this->format = pathinfo($file, PATHINFO_EXTENSION);
|
||||
$fileFormat = ['theme' => 'json'];
|
||||
$extname = pathinfo($file, PATHINFO_EXTENSION);
|
||||
|
||||
$this->format = $format ? $format : Arr::get($fileFormat, $extname, $extname);
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
|
|
@ -47,6 +50,7 @@ class Settings
|
|||
}
|
||||
|
||||
$this->data = $settings;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -91,7 +95,7 @@ class Settings
|
|||
|
||||
/**
|
||||
* Чтение ключа из реестра
|
||||
* @param $args Путь к значению ключа
|
||||
* @param mixed $args Путь к значению ключа
|
||||
*/
|
||||
public function readKey(array $key)
|
||||
{
|
||||
|
|
@ -121,7 +125,7 @@ class Settings
|
|||
|
||||
/**
|
||||
* Чтение ключа из реестра (Собирает все ключи с определенным значением во всех модулях)
|
||||
* @param $key Путь к значению ключа внутри модуля
|
||||
* @param mixed $key Путь к значению ключа внутри модуля
|
||||
*/
|
||||
public function readKeyList($_rest)
|
||||
{
|
||||
|
|
@ -162,7 +166,6 @@ class Settings
|
|||
* Запись настроек в файл (Может переименовать в store)
|
||||
*
|
||||
* @param File $file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function write($file = null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue