1 | <?php |
||
13 | class Config |
||
14 | { |
||
15 | /** @var boolean configuration is writable */ |
||
16 | protected $isLocked = false; |
||
17 | |||
18 | 39 | public function __construct(array $values = []) |
|
23 | |||
24 | /** |
||
25 | * Getter for configuration values |
||
26 | * |
||
27 | * @param string $key single key |
||
28 | * @return mixed |
||
29 | */ |
||
30 | 37 | public function get($key = null) |
|
45 | |||
46 | 27 | public function has($key) |
|
51 | |||
52 | /** |
||
53 | * Return configuration as PHP-array |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | 31 | public function toArray() |
|
61 | |||
62 | /** |
||
63 | * Setter for configuration values |
||
64 | * |
||
65 | * @param string|array $key set single key value; sell all if array |
||
66 | * @param mixed $value |
||
67 | */ |
||
68 | 40 | public function set($key, $value = null) |
|
87 | |||
88 | /** |
||
89 | * Recursively merges a configuration over the existing configuration |
||
90 | * |
||
91 | * @param array $values configuration to merge |
||
92 | */ |
||
93 | 26 | public function merge(array $values) |
|
99 | |||
100 | /** |
||
101 | * Creates an array of template variables derived from the configuration |
||
102 | * |
||
103 | * @return array |
||
104 | */ |
||
105 | 3 | public function getTemplateVars() |
|
119 | |||
120 | /** |
||
121 | * Locks configuration into read-only mode |
||
122 | */ |
||
123 | 5 | public function lock() |
|
127 | } |
||
128 |