| 1 | <?php |
||
| 5 | class Config |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var array |
||
| 9 | */ |
||
| 10 | protected $configs = []; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Initialise configs. |
||
| 14 | * |
||
| 15 | * @param array $configs |
||
| 16 | */ |
||
| 17 | public function __construct(array $configs = []) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Get a setting. |
||
| 24 | * |
||
| 25 | * @param string $key |
||
| 26 | * @param mixed $default |
||
| 27 | * |
||
| 28 | * @return mixed config setting or default when not found |
||
| 29 | */ |
||
| 30 | public function get($key, $default = null) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Check existence of an item by key. |
||
| 37 | * |
||
| 38 | * @param string $key |
||
| 39 | * @return bool |
||
| 40 | */ |
||
| 41 | public function has($key) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Set a setting. |
||
| 48 | * |
||
| 49 | * @param string $key |
||
| 50 | * @param mixed $value |
||
| 51 | * @return $this |
||
| 52 | */ |
||
| 53 | public function set($key, $value) |
||
| 59 | } |
||
| 60 |