1 | <?php |
||
15 | class Configuration |
||
16 | { |
||
17 | /** |
||
18 | * Filename |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | private $filename; |
||
23 | |||
24 | /** |
||
25 | * Path to bootstrap file. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $bootstrap; |
||
30 | |||
31 | /** |
||
32 | * Verbose output |
||
33 | * |
||
34 | * @var bool |
||
35 | */ |
||
36 | private $verbose = false; |
||
37 | |||
38 | /** |
||
39 | * Use colors in output. |
||
40 | * |
||
41 | * @var bool |
||
42 | */ |
||
43 | private $colors = false; |
||
44 | |||
45 | /** |
||
46 | * Output debug information |
||
47 | * |
||
48 | * @var boolean |
||
49 | */ |
||
50 | private $debug = false; |
||
51 | |||
52 | /** |
||
53 | * Don't execute anything just pretend to |
||
54 | * |
||
55 | * @var bool |
||
56 | */ |
||
57 | private $simulate = false; |
||
58 | |||
59 | /** |
||
60 | * List of include paths |
||
61 | * |
||
62 | * @var array |
||
63 | */ |
||
64 | private $includePaths = []; |
||
65 | |||
66 | /** |
||
67 | * List of ini settings |
||
68 | * |
||
69 | * @var array |
||
70 | */ |
||
71 | private $iniSettings = []; |
||
72 | |||
73 | /** |
||
74 | * List of logger configurations |
||
75 | * |
||
76 | * @var array |
||
77 | */ |
||
78 | private $loggers = []; |
||
79 | |||
80 | /** |
||
81 | * List of backup configurations |
||
82 | * |
||
83 | * @var array |
||
84 | */ |
||
85 | private $backups = []; |
||
86 | |||
87 | /** |
||
88 | * List of backus to execute |
||
89 | * |
||
90 | * @var array |
||
91 | */ |
||
92 | 33 | private $limit = []; |
|
93 | |||
94 | 33 | /** |
|
95 | 33 | * Working directory |
|
96 | * |
||
97 | * @var string |
||
98 | */ |
||
99 | private static $workingDirectory; |
||
100 | |||
101 | /** |
||
102 | 24 | * Filename setter. |
|
103 | * |
||
104 | 24 | * @param string $file |
|
105 | 24 | */ |
|
106 | 24 | public function setFilename($file) |
|
111 | |||
112 | /** |
||
113 | 1 | * Filename getter. |
|
114 | * |
||
115 | 1 | * @return string |
|
116 | */ |
||
117 | public function getFilename() |
||
121 | |||
122 | /** |
||
123 | 1 | * Bootstrap setter. |
|
124 | * |
||
125 | 1 | * @param $file |
|
126 | 1 | */ |
|
127 | public function setBootstrap($file) |
||
131 | |||
132 | /** |
||
133 | 2 | * Bootstrap getter. |
|
134 | * |
||
135 | 2 | * @return string |
|
136 | */ |
||
137 | public function getBootstrap() |
||
141 | |||
142 | /** |
||
143 | 14 | * Limit setter. |
|
144 | * |
||
145 | 14 | * @param array $limit |
|
146 | 14 | */ |
|
147 | public function setLimit(array $limit) |
||
151 | |||
152 | /** |
||
153 | 2 | * Verbose setter. |
|
154 | * |
||
155 | 2 | * @param bool $bool |
|
156 | */ |
||
157 | public function setVerbose($bool) |
||
161 | |||
162 | /** |
||
163 | 14 | * Verbose getter. |
|
164 | * |
||
165 | 14 | * @return bool |
|
166 | 14 | */ |
|
167 | public function getVerbose() |
||
171 | |||
172 | /** |
||
173 | 2 | * Colors setter. |
|
174 | * |
||
175 | 2 | * @param bool $bool |
|
176 | */ |
||
177 | public function setColors($bool) |
||
181 | |||
182 | /** |
||
183 | 14 | * Colors getter. |
|
184 | * |
||
185 | 14 | * @return bool |
|
186 | 14 | */ |
|
187 | public function getColors() |
||
191 | |||
192 | /** |
||
193 | 2 | * Debug setter. |
|
194 | * |
||
195 | 2 | * @param bool $bool |
|
196 | */ |
||
197 | public function setDebug($bool) |
||
201 | |||
202 | /** |
||
203 | 2 | * Debug getter. |
|
204 | * |
||
205 | 2 | * @return bool |
|
206 | 2 | */ |
|
207 | public function getDebug() |
||
211 | |||
212 | /** |
||
213 | 2 | * Simulate setter. |
|
214 | * |
||
215 | 2 | * @param bool $bool |
|
216 | */ |
||
217 | public function setSimulate($bool) |
||
221 | |||
222 | /** |
||
223 | 12 | * Simulate getter. |
|
224 | * |
||
225 | 12 | * @return bool |
|
226 | 12 | */ |
|
227 | public function isSimulation() |
||
231 | |||
232 | /** |
||
233 | 3 | * Add an include_path. |
|
234 | * |
||
235 | 3 | * @param string $path |
|
236 | */ |
||
237 | public function addIncludePath($path) |
||
241 | |||
242 | /** |
||
243 | * Get the list of include path. |
||
244 | 12 | * |
|
245 | * @return array |
||
246 | 12 | */ |
|
247 | 12 | public function getIncludePaths() |
|
251 | |||
252 | /** |
||
253 | * Add a ini settings. |
||
254 | 3 | * |
|
255 | * @param string $name |
||
256 | 3 | * @param string $value |
|
257 | */ |
||
258 | public function addIniSetting($name, $value) |
||
262 | |||
263 | /** |
||
264 | * Get the list of ini settings. |
||
265 | * |
||
266 | 13 | * @return array |
|
267 | */ |
||
268 | 13 | public function getIniSettings() |
|
272 | 12 | ||
273 | /** |
||
274 | * Add a logger. |
||
275 | * This accepts valid logger configs as well as valid Listener objects. |
||
276 | * |
||
277 | * @param mixed $logger |
||
278 | * @throws \phpbu\App\Exception |
||
279 | 4 | */ |
|
280 | public function addLogger($logger) |
||
287 | |||
288 | /** |
||
289 | 7 | * Get the list of logger configurations. |
|
290 | * |
||
291 | 7 | * @return array |
|
292 | 7 | */ |
|
293 | public function getLoggers() |
||
297 | |||
298 | /** |
||
299 | 3 | * Add a Backup configuration. |
|
300 | * |
||
301 | 3 | * @param \phpbu\App\Configuration\Backup $backup |
|
302 | */ |
||
303 | public function addBackup(Configuration\Backup $backup) |
||
307 | |||
308 | /** |
||
309 | * Get the list of backup configurations. |
||
310 | * |
||
311 | * @return array |
||
312 | */ |
||
313 | public function getBackups() |
||
317 | |||
318 | /** |
||
319 | * Is given backup active. |
||
320 | * Backups could be skipped by using the --limit option. |
||
321 | * |
||
322 | * @param string $backupName |
||
323 | * @return bool |
||
324 | */ |
||
325 | public function isBackupActive($backupName) |
||
332 | |||
333 | /** |
||
334 | * Working directory setter. |
||
335 | * |
||
336 | * @param string $wd |
||
337 | */ |
||
338 | public static function setWorkingDirectory($wd) |
||
342 | |||
343 | /** |
||
344 | * Working directory getter. |
||
345 | * |
||
346 | * @return string |
||
347 | */ |
||
348 | public static function getWorkingDirectory() |
||
352 | } |
||
353 |