| Total Complexity | 10 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 63.64% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 13 | class UConfigFile { |
||
| 14 | |||
| 15 | private string $filename; |
||
| 16 | |||
| 17 | private array $data=[]; |
||
| 18 | |||
| 19 | 2 | public function __construct(string $name){ |
|
| 20 | 2 | $this->filename=\ROOT . "config/$name.config.php"; |
|
| 21 | } |
||
| 22 | |||
| 23 | 1 | public function load(array $default=[]): array { |
|
| 24 | 1 | return $this->data=self::load_($this->filename,$default); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | public function save(): bool { |
|
| 28 | 1 | 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 | 1 | public function setData(array $data): self { |
|
| 51 | 1 | $this->data = $data; |
|
| 52 | 1 | return $this; |
|
| 53 | } |
||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | 1 | public static function load_(string $filename,array $default=[]):array { |
|
| 58 | 1 | if(\file_exists($filename)){ |
|
| 59 | 1 | return include($filename); |
|
| 60 | } |
||
| 61 | return $default; |
||
| 62 | } |
||
| 63 | |||
| 64 | 1 | public static function save_(string $filename,array $data):bool{ |
|
| 66 | } |
||
| 67 | } |
||
| 68 | |||
| 69 |