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 | * Show how to restore the backup |
||
61 | * |
||
62 | * @var bool |
||
63 | */ |
||
64 | private $restore = false; |
||
65 | |||
66 | /** |
||
67 | * List of logger configurations |
||
68 | * |
||
69 | * @var array |
||
70 | */ |
||
71 | private $loggers = []; |
||
72 | |||
73 | /** |
||
74 | * List of backup configurations |
||
75 | * |
||
76 | * @var array |
||
77 | */ |
||
78 | private $backups = []; |
||
79 | |||
80 | /** |
||
81 | * List of backus to execute |
||
82 | * |
||
83 | * @var array |
||
84 | */ |
||
85 | private $limit = []; |
||
86 | |||
87 | /** |
||
88 | * Working directory |
||
89 | * |
||
90 | * @var string |
||
91 | */ |
||
92 | private static $workingDirectory; |
||
93 | |||
94 | /** |
||
95 | * Filename setter. |
||
96 | * |
||
97 | * @param string $file |
||
98 | */ |
||
99 | 44 | public function setFilename(string $file) |
|
104 | |||
105 | /** |
||
106 | * Filename getter. |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | 1 | public function getFilename() : string |
|
114 | |||
115 | /** |
||
116 | * Bootstrap setter. |
||
117 | * |
||
118 | * @param $file |
||
119 | */ |
||
120 | 27 | public function setBootstrap(string $file) |
|
124 | |||
125 | /** |
||
126 | * Bootstrap getter. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | 4 | public function getBootstrap() : string |
|
134 | |||
135 | /** |
||
136 | * Limit setter. |
||
137 | * |
||
138 | * @param array $limit |
||
139 | */ |
||
140 | 1 | public function setLimit(array $limit) |
|
144 | |||
145 | /** |
||
146 | * Verbose setter. |
||
147 | * |
||
148 | * @param bool $bool |
||
149 | */ |
||
150 | 33 | public function setVerbose(bool $bool) |
|
154 | |||
155 | /** |
||
156 | * Verbose getter. |
||
157 | * |
||
158 | * @return bool |
||
159 | */ |
||
160 | 3 | public function getVerbose() : bool |
|
164 | |||
165 | /** |
||
166 | * Colors setter. |
||
167 | * |
||
168 | * @param bool $bool |
||
169 | */ |
||
170 | 26 | public function setColors(bool $bool) |
|
174 | |||
175 | /** |
||
176 | * Colors getter. |
||
177 | * |
||
178 | * @return bool |
||
179 | */ |
||
180 | 3 | public function getColors() : bool |
|
184 | |||
185 | /** |
||
186 | * Debug setter. |
||
187 | * |
||
188 | * @param bool $bool |
||
189 | */ |
||
190 | 2 | public function setDebug(bool $bool) |
|
194 | |||
195 | /** |
||
196 | * Debug getter. |
||
197 | * |
||
198 | * @return bool |
||
199 | */ |
||
200 | 2 | public function getDebug() : bool |
|
204 | |||
205 | /** |
||
206 | * Simulate setter. |
||
207 | * |
||
208 | * @param bool $bool |
||
209 | */ |
||
210 | 1 | public function setSimulate(bool $bool) |
|
214 | |||
215 | /** |
||
216 | * Simulate getter. |
||
217 | * |
||
218 | * @return bool |
||
219 | */ |
||
220 | 1 | public function isSimulation() : bool |
|
224 | |||
225 | /** |
||
226 | * Restore setter. |
||
227 | * |
||
228 | * @param bool $bool |
||
229 | */ |
||
230 | 1 | public function setRestore(bool $bool) |
|
234 | |||
235 | /** |
||
236 | * Restore getter. |
||
237 | * |
||
238 | * @return bool |
||
239 | */ |
||
240 | 1 | public function isRestore() : bool |
|
244 | |||
245 | /** |
||
246 | * Add a logger. |
||
247 | * This accepts valid logger configs as well as valid Listener objects. |
||
248 | * |
||
249 | * @param mixed $logger |
||
250 | * @throws \phpbu\App\Exception |
||
251 | */ |
||
252 | 28 | public function addLogger($logger) |
|
259 | |||
260 | /** |
||
261 | * Get the list of logger configurations. |
||
262 | * |
||
263 | * @return array |
||
264 | */ |
||
265 | 6 | public function getLoggers() : array |
|
269 | |||
270 | /** |
||
271 | * Add a Backup configuration. |
||
272 | * |
||
273 | * @param \phpbu\App\Configuration\Backup $backup |
||
274 | */ |
||
275 | 14 | public function addBackup(Configuration\Backup $backup) |
|
279 | |||
280 | /** |
||
281 | * Get the list of backup configurations. |
||
282 | * |
||
283 | * @return \phpbu\App\Configuration\Backup[] |
||
284 | */ |
||
285 | 8 | public function getBackups() : array |
|
289 | |||
290 | /** |
||
291 | * Is given backup active. |
||
292 | * Backups could be skipped by using the --limit option. |
||
293 | * |
||
294 | * @param string $backupName |
||
295 | * @return bool |
||
296 | */ |
||
297 | 1 | public function isBackupActive($backupName) : bool |
|
304 | |||
305 | /** |
||
306 | * Working directory setter. |
||
307 | * |
||
308 | * @param string $wd |
||
309 | */ |
||
310 | 49 | public static function setWorkingDirectory(string $wd) |
|
314 | |||
315 | /** |
||
316 | * Working directory getter. |
||
317 | * |
||
318 | * @return string |
||
319 | */ |
||
320 | 16 | public static function getWorkingDirectory() : string |
|
324 | } |
||
325 |