Total Complexity | 10 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | class UConfigFile { |
||
14 | |||
15 | private string $filename; |
||
16 | |||
17 | private array $data=[]; |
||
18 | |||
19 | public function __construct(string $name){ |
||
20 | $this->filename=\ROOT . "config/$name.config.php"; |
||
21 | } |
||
22 | |||
23 | public function load(array $default=[]): array { |
||
24 | return $this->data=self::load_($this->filename,$default); |
||
25 | } |
||
26 | |||
27 | public function save(): bool { |
||
28 | return self::save_($this->filename, $this->data); |
||
29 | } |
||
30 | |||
31 | public function get(string $key,$default=null){ |
||
33 | } |
||
34 | |||
35 | public function set(string $key,$value):self{ |
||
36 | $this->data[$key]=$value; |
||
37 | return $this; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return array |
||
42 | */ |
||
43 | public function getData(): array { |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param array $data |
||
49 | */ |
||
50 | public function setData(array $data): self { |
||
51 | $this->data = $data; |
||
52 | return $this; |
||
53 | } |
||
54 | |||
55 | |||
56 | |||
57 | public static function load_(string $filename,array $default=[]):array { |
||
58 | if(\file_exists($filename)){ |
||
59 | return include($filename); |
||
60 | } |
||
61 | return $default; |
||
62 | } |
||
63 | |||
64 | public static function save_(string $filename,array $data):bool{ |
||
66 | } |
||
67 | } |
||
68 | |||
69 |