1 | <?php |
||
20 | abstract class ConfigGroup |
||
21 | { |
||
22 | protected $config; |
||
23 | protected $group; |
||
24 | protected $prefix; |
||
25 | protected $postfix; |
||
26 | |||
27 | public function __construct($config, $group, $prefix = '', $postfix = '.') |
||
28 | { |
||
29 | $this->config = $config; |
||
30 | $this->group = $group; |
||
31 | $this->prefix = $prefix; |
||
32 | $this->postfix = $postfix; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Return a description of the configuration group (with prefix and postfix). |
||
37 | */ |
||
38 | public function describe($property) |
||
39 | { |
||
40 | return $this->prefix . $this->group . $this->postfix . $property; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Get the requested configuration key from the most specific configuration |
||
45 | * group that contains it. |
||
46 | */ |
||
47 | abstract public function get($key); |
||
48 | |||
49 | /** |
||
50 | * Given a group name, such as "foo.bar.baz", return the next configuration |
||
51 | * group in the fallback hierarchy, e.g. "foo.bar". |
||
52 | */ |
||
53 | protected function moreGeneralGroupName($group) |
||
61 | } |
||
62 |