1 | <?php |
||
15 | class ConfigOverlay implements ConfigInterface |
||
16 | { |
||
17 | protected $contexts = []; |
||
18 | |||
19 | const DEFAULT_CONTEXT = 'default'; |
||
20 | const PROCESS_CONTEXT = 'process'; |
||
21 | |||
22 | public function __construct() |
||
27 | |||
28 | /** |
||
29 | * Add a named configuration object to the configuration overlay. |
||
30 | * Configuration objects added LAST have HIGHEST priority, with the |
||
31 | * exception of the fact that the process context always has the |
||
32 | * highest priority. |
||
33 | * |
||
34 | * If a context has already been added, its priority will not change. |
||
35 | */ |
||
36 | public function addContext($name, ConfigInterface $config) |
||
45 | |||
46 | /** |
||
47 | * Add a placeholder context that will be prioritized higher than |
||
48 | * existing contexts. This is done to ensure that contexts added |
||
49 | * later will maintain a higher priority if the placeholder context |
||
50 | * is later relaced with a different configuration set via addContext(). |
||
51 | * |
||
52 | * @param string $name |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function addPlaceholder($name) |
||
59 | |||
60 | /** |
||
61 | * Increase the priority of the named context such that it is higher |
||
62 | * in priority than any existing context except for the 'process' |
||
63 | * context. |
||
64 | * |
||
65 | * @param string $name |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function increasePriority($name) |
||
74 | |||
75 | public function hasContext($name) |
||
79 | |||
80 | public function getContext($name) |
||
87 | |||
88 | public function removeContext($name) |
||
92 | |||
93 | /** |
||
94 | * Determine if a non-default config value exists. |
||
95 | */ |
||
96 | public function findContext($key) |
||
105 | |||
106 | /** |
||
107 | * @inheritdoc |
||
108 | */ |
||
109 | public function has($key) |
||
113 | |||
114 | /** |
||
115 | * @inheritdoc |
||
116 | */ |
||
117 | public function get($key, $default = null) |
||
125 | |||
126 | /** |
||
127 | * @inheritdoc |
||
128 | */ |
||
129 | public function set($key, $value) |
||
134 | |||
135 | /** |
||
136 | * @inheritdoc |
||
137 | */ |
||
138 | public function import($data) |
||
142 | |||
143 | /** |
||
144 | * @inheritdoc |
||
145 | */ |
||
146 | public function export() |
||
154 | |||
155 | /** |
||
156 | * @inheritdoc |
||
157 | */ |
||
158 | public function hasDefault($key) |
||
162 | |||
163 | /** |
||
164 | * @inheritdoc |
||
165 | */ |
||
166 | public function getDefault($key, $default = null) |
||
170 | |||
171 | /** |
||
172 | * @inheritdoc |
||
173 | */ |
||
174 | public function setDefault($key, $value) |
||
179 | } |
||
180 |