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 logger configurations |
||
61 | * |
||
62 | * @var array |
||
63 | */ |
||
64 | private $loggers = []; |
||
65 | |||
66 | /** |
||
67 | * List of backup configurations |
||
68 | * |
||
69 | * @var array |
||
70 | */ |
||
71 | private $backups = []; |
||
72 | |||
73 | /** |
||
74 | * List of backus to execute |
||
75 | * |
||
76 | * @var array |
||
77 | */ |
||
78 | private $limit = []; |
||
79 | |||
80 | /** |
||
81 | * Working directory |
||
82 | * |
||
83 | * @var string |
||
84 | */ |
||
85 | private static $workingDirectory; |
||
86 | |||
87 | /** |
||
88 | * Filename setter. |
||
89 | * |
||
90 | * @param string $file |
||
91 | */ |
||
92 | 33 | public function setFilename(string $file) |
|
97 | |||
98 | /** |
||
99 | * Filename getter. |
||
100 | * |
||
101 | * @return string |
||
102 | 24 | */ |
|
103 | public function getFilename() : string |
||
107 | |||
108 | /** |
||
109 | * Bootstrap setter. |
||
110 | * |
||
111 | * @param $file |
||
112 | */ |
||
113 | 1 | public function setBootstrap(string $file) |
|
117 | |||
118 | /** |
||
119 | * Bootstrap getter. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | 1 | public function getBootstrap() : string |
|
127 | |||
128 | /** |
||
129 | * Limit setter. |
||
130 | * |
||
131 | * @param array $limit |
||
132 | */ |
||
133 | 2 | public function setLimit(array $limit) |
|
137 | |||
138 | /** |
||
139 | * Verbose setter. |
||
140 | * |
||
141 | * @param bool $bool |
||
142 | */ |
||
143 | 14 | public function setVerbose(bool $bool) |
|
147 | |||
148 | /** |
||
149 | * Verbose getter. |
||
150 | * |
||
151 | * @return bool |
||
152 | */ |
||
153 | 2 | public function getVerbose() : bool |
|
157 | |||
158 | /** |
||
159 | * Colors setter. |
||
160 | * |
||
161 | * @param bool $bool |
||
162 | */ |
||
163 | 14 | public function setColors(bool $bool) |
|
167 | |||
168 | /** |
||
169 | * Colors getter. |
||
170 | * |
||
171 | * @return bool |
||
172 | */ |
||
173 | 2 | public function getColors() : bool |
|
177 | |||
178 | /** |
||
179 | * Debug setter. |
||
180 | * |
||
181 | * @param bool $bool |
||
182 | */ |
||
183 | 14 | public function setDebug(bool $bool) |
|
187 | |||
188 | /** |
||
189 | * Debug getter. |
||
190 | * |
||
191 | * @return bool |
||
192 | */ |
||
193 | 2 | public function getDebug() : bool |
|
197 | |||
198 | /** |
||
199 | * Simulate setter. |
||
200 | * |
||
201 | * @param bool $bool |
||
202 | */ |
||
203 | 2 | public function setSimulate(bool $bool) |
|
207 | |||
208 | /** |
||
209 | * Simulate getter. |
||
210 | * |
||
211 | * @return bool |
||
212 | */ |
||
213 | 2 | public function isSimulation() : bool |
|
217 | |||
218 | /** |
||
219 | * Add a logger. |
||
220 | * This accepts valid logger configs as well as valid Listener objects. |
||
221 | * |
||
222 | * @param mixed $logger |
||
223 | 12 | * @throws \phpbu\App\Exception |
|
224 | */ |
||
225 | 12 | public function addLogger($logger) |
|
232 | |||
233 | 3 | /** |
|
234 | * Get the list of logger configurations. |
||
235 | 3 | * |
|
236 | * @return array |
||
237 | */ |
||
238 | public function getLoggers() : array |
||
242 | |||
243 | /** |
||
244 | 12 | * Add a Backup configuration. |
|
245 | * |
||
246 | 12 | * @param \phpbu\App\Configuration\Backup $backup |
|
247 | 12 | */ |
|
248 | public function addBackup(Configuration\Backup $backup) |
||
252 | |||
253 | /** |
||
254 | 3 | * Get the list of backup configurations. |
|
255 | * |
||
256 | 3 | * @return \phpbu\App\Configuration\Backup[] |
|
257 | */ |
||
258 | public function getBackups() : array |
||
262 | |||
263 | /** |
||
264 | * Is given backup active. |
||
265 | * Backups could be skipped by using the --limit option. |
||
266 | 13 | * |
|
267 | * @param string $backupName |
||
268 | 13 | * @return bool |
|
269 | 1 | */ |
|
270 | public function isBackupActive($backupName) : bool |
||
277 | |||
278 | /** |
||
279 | 4 | * Working directory setter. |
|
280 | * |
||
281 | 4 | * @param string $wd |
|
282 | */ |
||
283 | public static function setWorkingDirectory(string $wd) |
||
287 | |||
288 | /** |
||
289 | 7 | * Working directory getter. |
|
290 | * |
||
291 | 7 | * @return string |
|
292 | 7 | */ |
|
293 | public static function getWorkingDirectory() : string |
||
297 | } |
||
298 |