1 | <?php |
||
10 | class Config |
||
11 | { |
||
12 | /** |
||
13 | * Reference to the Symfony YAML parser. |
||
14 | * |
||
15 | * @var \Symfony\Component\Yaml\Parser |
||
16 | */ |
||
17 | protected $parser; |
||
18 | |||
19 | /** |
||
20 | * Reference to a parrot file wrapper. |
||
21 | * |
||
22 | * @var \Enzyme\Parrot\File |
||
23 | */ |
||
24 | protected $file_dispatch; |
||
25 | |||
26 | /** |
||
27 | * The parsed YAML configuration. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $config; |
||
32 | |||
33 | /** |
||
34 | * The dot array accessor. |
||
35 | * |
||
36 | * @var \Enzyme\Freckle\Dot |
||
37 | */ |
||
38 | protected $dot; |
||
39 | |||
40 | /** |
||
41 | * Create a new configuration manager. |
||
42 | * |
||
43 | * @param \Symfony\Component\Yaml\Parser $parser |
||
44 | * @param \Enzyme\Parrot\File $file_dispatch |
||
45 | * @param \Enzyme\Freckle\Dot $dot |
||
46 | */ |
||
47 | public function __construct(Parser $parser, File $file_dispatch, Dot $dot) |
||
54 | |||
55 | /** |
||
56 | * Parse the given YAML file. |
||
57 | * |
||
58 | * @param string $file The path to the file. |
||
59 | * |
||
60 | * @throws Exception If the YAML file cannot be parsed. |
||
61 | */ |
||
62 | public function parse($file) |
||
82 | |||
83 | /** |
||
84 | * Get the value associated with the given key, if the key does not |
||
85 | * exist, return null. |
||
86 | * |
||
87 | * @param string $key |
||
88 | * |
||
89 | * @return null|string |
||
90 | */ |
||
91 | public function get($key) |
||
99 | } |
||
100 |