1 | <?php declare(strict_types=1); |
||
12 | class ConfigBuilder |
||
13 | { |
||
14 | const DEFAULT_ENV = '##default##'; |
||
15 | |||
16 | private $header = ''; |
||
17 | |||
18 | private $environments = []; |
||
19 | |||
20 | private $currentEnvironment; |
||
21 | |||
22 | private $currentCommandPaths; |
||
23 | |||
24 | private $currentDotenvPaths; |
||
25 | |||
26 | private $currentDynamicVariables; |
||
27 | |||
28 | private $templates; |
||
29 | |||
30 | private $currentConstants; |
||
31 | |||
32 | private $hidden; |
||
33 | |||
34 | private $currentRequiredVariables; |
||
35 | |||
36 | private $imports; |
||
37 | |||
38 | public function setHeader(?string $header = null): ConfigBuilder |
||
44 | |||
45 | public function start(?string $environment = null): ConfigBuilder |
||
56 | |||
57 | public function setHidden(bool $set): ConfigBuilder |
||
63 | |||
64 | public function setCommandPaths(array $commandPaths): ConfigBuilder |
||
70 | |||
71 | /** |
||
72 | * @deprecated only used by yaml builder |
||
73 | */ |
||
74 | public function setDotenvPaths(array $dotenvPaths): ConfigBuilder |
||
84 | |||
85 | public function addDotenvPath(string $dotenvPath): ConfigBuilder |
||
86 | { |
||
87 | $this->currentDotenvPaths[pathinfo($dotenvPath, PATHINFO_BASENAME)] = $dotenvPath; |
||
88 | |||
89 | return $this; |
||
90 | } |
||
91 | |||
92 | public function addRequirePlaceholder(string $name, ?string $description = null): ConfigBuilder |
||
93 | { |
||
94 | $this->currentRequiredVariables[$name] = $description; |
||
95 | |||
96 | return $this; |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @deprecated only used by yaml builder |
||
101 | */ |
||
102 | public function setDynamicVariables(array $dynamicVariables): ConfigBuilder |
||
108 | |||
109 | public function addDynamicVariable(string $key, string $value): ConfigBuilder |
||
110 | { |
||
111 | $this->currentDynamicVariables[$key] = $value; |
||
112 | |||
113 | return $this; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * @deprecated only used by yaml builder |
||
118 | */ |
||
119 | public function setConstants(array $constants): ConfigBuilder |
||
125 | |||
126 | public function addConstVariable(string $key, string $value): ConfigBuilder |
||
127 | { |
||
128 | $this->currentConstants[$key] = $value; |
||
129 | |||
130 | return $this; |
||
131 | } |
||
132 | |||
133 | public function addImport(string $path): self |
||
134 | { |
||
135 | $this->imports[] = $path; |
||
136 | |||
137 | return $this; |
||
138 | } |
||
139 | |||
140 | public function setTemplates(array $templates): ConfigBuilder |
||
146 | |||
147 | public function create(array $params): Config |
||
153 | |||
154 | private function reset(): void |
||
178 | } |
||
179 |