![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/inventory.corals.io/Corals/core/Theme/ |
<?php namespace Corals\Theme; class ThemeManifest { protected $data = []; public function __construct($data = []) { $this->data = $data; } public function get($key, $default = null) { return isset($this->data[$key]) ? $this->data[$key] : $default; } public function has($key) { return isset($this->data[$key]); } public function set($key, $value) { $this->data[$key] = $value; } public function remove($key) { if (isset($this->data[$key])) { unset($this->data[$key]); } } public function loadData($data = []) { $this->data = $data; } public function validate() { return true; // throw new \Exception("Invalid data"); } public function loadFromFile($filename) { $json = file_get_contents($filename); $data = json_decode($json, true); if ($data === null) { throw new \Exception(trans('Theme::exception.theme.theme_invalid_json',['filename' =>$filename])); } $this->data = $data; } public function saveToFile($filename) { file_put_contents($filename, json_encode($this->data, JSON_PRETTY_PRINT)); } }