1 | <?php |
||
33 | class ConfigFileLoader extends ObjectAbstract implements ConfigLoaderInterface |
||
34 | { |
||
35 | /** |
||
36 | * Config root directory |
||
37 | * |
||
38 | * @var string |
||
39 | * @access protected |
||
40 | */ |
||
41 | protected $root_dir; |
||
42 | |||
43 | /** |
||
44 | * config file type |
||
45 | * |
||
46 | * @var string |
||
47 | * @access protected |
||
48 | */ |
||
49 | protected $file_type; |
||
50 | |||
51 | /** |
||
52 | * cached subdirs to load files |
||
53 | * |
||
54 | * @var array |
||
55 | * @access protected |
||
56 | */ |
||
57 | protected $sub_dirs = []; |
||
58 | |||
59 | /** |
||
60 | * default environment |
||
61 | * |
||
62 | * @var string |
||
63 | * @access protected |
||
64 | */ |
||
65 | protected $environment; |
||
66 | |||
67 | /** |
||
68 | * Constructor |
||
69 | * |
||
70 | * @param string $rootDir |
||
71 | * @param string $environment |
||
72 | * @param string $fileType |
||
73 | * @throws InvalidArgumentException if any argument invalid |
||
74 | * @access public |
||
75 | * @api |
||
76 | */ |
||
77 | public function __construct( |
||
87 | |||
88 | /** |
||
89 | * {@inheritDoc} |
||
90 | */ |
||
91 | public function load( |
||
110 | |||
111 | /** |
||
112 | * Set config file root directory |
||
113 | * |
||
114 | * @param string $rootDir |
||
115 | * @return $this |
||
116 | * @throws InvalidArgumentException if root dir is unknown |
||
117 | * @access public |
||
118 | * @api |
||
119 | */ |
||
120 | public function setRootDir(/*# string */ $rootDir) |
||
135 | |||
136 | /** |
||
137 | * Set config file type |
||
138 | * |
||
139 | * @param string $fileType |
||
140 | * @return $this |
||
141 | * @throws InvalidArgumentException if unsupported file type |
||
142 | * @access public |
||
143 | * @api |
||
144 | */ |
||
145 | public function setFileType(/*# string */ $fileType) |
||
157 | |||
158 | /** |
||
159 | * Set default environment |
||
160 | * |
||
161 | * @param string $environment |
||
162 | * @return $this |
||
163 | * @access public |
||
164 | * @api |
||
165 | */ |
||
166 | public function setEnvironment(/*# string */ $environment) |
||
172 | |||
173 | /** |
||
174 | * Returns an array of files to read from |
||
175 | * |
||
176 | * @param string $group |
||
177 | * @param string $environment |
||
178 | * @return array |
||
179 | * @access protected |
||
180 | */ |
||
181 | protected function globFiles( |
||
193 | |||
194 | /** |
||
195 | * Get the search directories |
||
196 | * |
||
197 | * @param string $env |
||
198 | * @return array |
||
199 | * @access protected |
||
200 | */ |
||
201 | protected function getSearchDirs(/*# string */ $env)/*# : array */ |
||
208 | |||
209 | /** |
||
210 | * Build search directories |
||
211 | * |
||
212 | * @param string $env |
||
213 | * @return array |
||
214 | * @access protected |
||
215 | */ |
||
216 | protected function buildSearchDirs(/*# string */ $env)/*# : array */ |
||
239 | } |
||
240 |