1 | <?php |
||
14 | class AbstractFileParser implements FileParserInterface |
||
15 | { |
||
16 | /** |
||
17 | * Configuration file |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $file = null; |
||
22 | |||
23 | /** |
||
24 | * The configuration variables |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $vars = []; |
||
29 | |||
30 | /** |
||
31 | * Sets up the file to be parsed and variables |
||
32 | * |
||
33 | * @param string $file Config file name |
||
34 | * @param array $vars Variables to parse in the file |
||
35 | * @return void |
||
36 | */ |
||
37 | /*public function __construct($file = null, $vars = []) |
||
38 | { |
||
39 | $this->file = $file; |
||
40 | |||
41 | $this->vars = [] + $vars; |
||
42 | }*/ |
||
43 | |||
44 | public function parse($file) |
||
48 | |||
49 | public function getSupportedFileExtensions() |
||
53 | |||
54 | #: Protected Methods |
||
55 | |||
56 | /** |
||
57 | * Finds the given config files |
||
58 | * |
||
59 | * @param bool $cache |
||
60 | * param bool $multiple Whether to load multiple files or not |
||
61 | * @return array |
||
62 | */ |
||
63 | /*protected function findFile($cache = true) |
||
64 | { |
||
65 | // Nothing to put here! |
||
66 | }*/ |
||
67 | |||
68 | /** |
||
69 | * Parses a string using all of the previously set variables. |
||
70 | * Allows you to use something like %ENV% in non-PHP files. |
||
71 | * |
||
72 | * @param string $string String to parse |
||
73 | * @return string |
||
74 | */ |
||
75 | protected function parseVars($string) |
||
83 | |||
84 | /** |
||
85 | * Replaces given constants to their string counterparts. |
||
86 | * |
||
87 | * @param array $array Array to be prepped |
||
88 | * @return array Prepped array |
||
89 | */ |
||
90 | protected function prepVars(&$array) |
||
112 | } |
||
113 | |||
115 |