1 | <?php declare(strict_types=1); |
||
5 | final class Generator |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | private const TEMPLATE_XML = <<<EOT |
||
11 | <?xml version="1.0" encoding="UTF-8"?> |
||
12 | <phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||
13 | xsi:noNamespaceSchemaLocation="https://schema.phpbu.de/{phpbu_version}/phpbu.xsd" |
||
14 | bootstrap="{bootstrap_script}" |
||
15 | verbose="true"> |
||
16 | |||
17 | <!-- uncomment if you want to use an adapter |
||
18 | <adapters> |
||
19 | </adapters> |
||
20 | --> |
||
21 | |||
22 | <!-- uncomment if you want to use logging |
||
23 | <logging> |
||
24 | </logging> |
||
25 | --> |
||
26 | |||
27 | <backups> |
||
28 | <backup name="__FIXME__"> |
||
29 | <source type="__FIXME__"> |
||
30 | <option name="__FIXME__" value="__FIXME__" /> |
||
31 | </source> |
||
32 | <target dirname="__FIXME__" filename="backup-%Y%m%d-%H%i" compress="bzip2" /> |
||
33 | </backup> |
||
34 | </backups> |
||
35 | </phpbu> |
||
36 | |||
37 | EOT; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private const TEMPLATE_JSON = <<<EOT |
||
43 | { |
||
44 | "bootstrap": "{bootstrap_script}", |
||
45 | "verbose": true, |
||
46 | "adapters": [ |
||
47 | ], |
||
48 | "logging": [ |
||
49 | ], |
||
50 | "backups": [ |
||
51 | { |
||
52 | "source": { |
||
53 | "type": "__FIXME__", |
||
54 | "options": { |
||
55 | "__FIXME__": "__FIXME__" |
||
56 | } |
||
57 | } |
||
58 | "target": { |
||
59 | "dirname": "__FIXME__", |
||
60 | "filename": "backup-%Y%m%d-%H%i" |
||
61 | "compress": "bzip2" |
||
62 | } |
||
63 | } |
||
64 | ] |
||
65 | } |
||
66 | |||
67 | EOT; |
||
68 | |||
69 | /** |
||
70 | * Return the config file content |
||
71 | * |
||
72 | * @param string $version |
||
73 | * @param string $format |
||
74 | * @param string $bootstrapScript |
||
75 | * @return string |
||
76 | */ |
||
77 | 2 | public function generateConfigurationSkeleton(string $version, string $format, string $bootstrapScript) : string |
|
91 | |||
92 | /** |
||
93 | * Return the template code for the requested format |
||
94 | * |
||
95 | * @param string $format |
||
96 | * @return string |
||
97 | */ |
||
98 | 2 | private function getTemplate(string $format) |
|
102 | } |
||
103 |