1 | <?php |
||
24 | class Parser implements ParserInterface |
||
25 | { |
||
26 | /** @var Server\ServerInterface a server instance */ |
||
27 | private $server; |
||
28 | |||
29 | /** @var Compiler a Compiler instance */ |
||
30 | private $compiler; |
||
31 | |||
32 | /** @var string configuration file */ |
||
33 | private $configFile = ''; |
||
34 | |||
35 | /** @var array active directives in an array */ |
||
36 | protected $activeConfig = []; |
||
37 | |||
38 | /** |
||
39 | * Setter for the server instance. |
||
40 | * |
||
41 | * @see Server\ServerInterface Server Documentation |
||
42 | * |
||
43 | * @param Server\ServerInterface $server the server instance |
||
44 | */ |
||
45 | 13 | public function setServer(ServerInterface $server) |
|
51 | |||
52 | /** |
||
53 | * Setter for the compiler instance. |
||
54 | * |
||
55 | * @param Compiler $compiler the compiler instance |
||
56 | */ |
||
57 | 7 | public function setCompiler(Compiler $compiler) |
|
64 | |||
65 | /** |
||
66 | * Setter for the config file to parse. |
||
67 | * |
||
68 | * @param string $configFile configuration file |
||
69 | * |
||
70 | * @throws Exception\ParserException if configuration file is not readable |
||
71 | * @throws Exception\InvalidConfigException if active configuration is empty |
||
72 | */ |
||
73 | 15 | public function setConfigFile($configFile = '') |
|
88 | |||
89 | /** |
||
90 | * Getter for the server instance. |
||
91 | * |
||
92 | * @see Server\ServerInterface Server Documentation |
||
93 | * |
||
94 | * @param Server\ServerInterface the server instance |
||
95 | */ |
||
96 | 11 | public function getServer() |
|
100 | |||
101 | /** |
||
102 | * Getter for the active config main context. |
||
103 | * |
||
104 | * @return Directive\DirectiveInterface the active config |
||
105 | */ |
||
106 | 10 | public function getActiveConfig() |
|
110 | |||
111 | /** |
||
112 | * Getter for the content of the configuration file. |
||
113 | * |
||
114 | * @return string content of the configuration file |
||
115 | */ |
||
116 | 14 | public function getOriginalConfig() |
|
120 | |||
121 | /** |
||
122 | * Does some extra parsing before the active config turns into an array. |
||
123 | * |
||
124 | * @param string $config a config file content |
||
125 | * |
||
126 | * @return string a config file content |
||
127 | */ |
||
128 | 14 | protected function beforeExplode($config) |
|
136 | |||
137 | /** |
||
138 | * Does some extra parsing after the active config has turned into an array. |
||
139 | * |
||
140 | * @param array $activeConfig an active config |
||
141 | * |
||
142 | * @return array an active config |
||
143 | */ |
||
144 | 14 | protected function afterExplode(array $activeConfig) |
|
152 | |||
153 | /** |
||
154 | * Comon parsing to both apache and nginx. |
||
155 | * |
||
156 | * @return bool true if active lines were found |
||
157 | */ |
||
158 | 14 | private function parseConfigFile() |
|
170 | } |
||
171 |