15 private string $filename;
17 private array $data=[];
19 public function __construct(
string $name){
20 $this->filename=\ROOT .
"config/$name.config.php";
23 public function load(array $default=[]): array {
24 return $this->data=self::load_($this->filename,$default);
27 public function save(): bool {
28 return self::save_($this->filename, $this->data);
31 public function get(
string $key,$default=
null){
32 return $this->data[$key]??$default;
35 public function set(
string $key,$value):self{
36 $this->data[$key]=$value;
43 public function getData(): array {
50 public function setData(array $data): self {
57 public static function load_(
string $filename,array $default=[]):array {
58 if(\file_exists($filename)){
59 return include($filename);
64 public static function save_(
string $filename,array $data):bool{
65 return false!==UFileSystem::save($filename,
'<?php return '.UArray::asPhpArray_($data,1,true).
';');