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( |
||
109 | |||
110 | /** |
||
111 | * Set config file root directory |
||
112 | * |
||
113 | * @param string $rootDir |
||
114 | * @return $this |
||
115 | * @throws InvalidArgumentException if root dir is unknown |
||
116 | * @access public |
||
117 | * @api |
||
118 | */ |
||
119 | public function setRootDir(/*# string */ $rootDir) |
||
134 | |||
135 | /** |
||
136 | * Set config file type |
||
137 | * |
||
138 | * @param string $fileType |
||
139 | * @return $this |
||
140 | * @throws InvalidArgumentException if unsupported file type |
||
141 | * @access public |
||
142 | * @api |
||
143 | */ |
||
144 | public function setFileType(/*# string */ $fileType) |
||
156 | |||
157 | /** |
||
158 | * Set default environment |
||
159 | * |
||
160 | * @param string $environment |
||
161 | * @return $this |
||
162 | * @access public |
||
163 | * @api |
||
164 | */ |
||
165 | public function setEnvironment(/*# string */ $environment) |
||
171 | |||
172 | /** |
||
173 | * Returns an array of files to read from |
||
174 | * |
||
175 | * @param string $group |
||
176 | * @param string $environment |
||
177 | * @return array |
||
178 | * @access protected |
||
179 | */ |
||
180 | protected function globFiles( |
||
192 | |||
193 | /** |
||
194 | * Get the search directories |
||
195 | * |
||
196 | * @param string $env |
||
197 | * @return array |
||
198 | * @access protected |
||
199 | */ |
||
200 | protected function getSearchDirs(/*# string */ $env)/*# : array */ |
||
207 | |||
208 | /** |
||
209 | * Build search directories |
||
210 | * |
||
211 | * @param string $env |
||
212 | * @return array |
||
213 | * @access protected |
||
214 | */ |
||
215 | protected function buildSearchDirs(/*# string */ $env)/*# : array */ |
||
237 | } |
||
238 |