1 | <?php |
||
14 | class Config implements \ArrayAccess |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $config = array(); |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $defaults = array( |
||
25 | 'build_path' => 'build/cauditor', |
||
26 | 'exclude_folders' => array('tests', 'vendor'), |
||
27 | ); |
||
28 | |||
29 | /** |
||
30 | * List of config keys that denote paths, so they can be normalized |
||
31 | * (= turned into "relative to project root" instead of "relative to config |
||
32 | * file"). |
||
33 | * |
||
34 | * @var string[] |
||
35 | */ |
||
36 | protected $paths = array('build_path', 'exclude_folders'); |
||
37 | |||
38 | /** |
||
39 | * @param string $project Project root path. |
||
40 | * @param string $config Config YML file path. |
||
41 | */ |
||
42 | public function __construct($project, $config = null) |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc. |
||
50 | */ |
||
51 | public function offsetExists($offset) |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc. |
||
58 | */ |
||
59 | public function offsetGet($offset) |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc. |
||
77 | */ |
||
78 | public function offsetSet($offset, $value) |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc. |
||
85 | */ |
||
86 | public function offsetUnset($offset) |
||
90 | |||
91 | /** |
||
92 | * @param string $path Path to config file. |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | protected function readConfig($path) |
||
119 | |||
120 | /** |
||
121 | * Normalize all relative paths by prefixing them with the project path. |
||
122 | * |
||
123 | * @param string|string[] $value |
||
124 | * |
||
125 | * @return string|string[] |
||
126 | */ |
||
127 | protected function normalizePath($value) |
||
142 | } |
||
143 |