1 | <?php |
||
20 | abstract class AddonApiVersion |
||
21 | { |
||
22 | const V1 = 1; |
||
23 | |||
24 | /** |
||
25 | * @var int one of the API_VERSION_* constants from above |
||
26 | */ |
||
27 | private $api_version; |
||
28 | |||
29 | /** |
||
30 | * @var DomainInterface |
||
31 | */ |
||
32 | private $domain; |
||
33 | |||
34 | /** |
||
35 | * @var Version minimum version of EE core that the add-on will work with |
||
36 | */ |
||
37 | private $min_core_version; |
||
38 | |||
39 | /** |
||
40 | * @var Version minimum version of WP core that the add-on will work with |
||
41 | */ |
||
42 | private $min_wp_version; |
||
43 | |||
44 | /** |
||
45 | * @var string PascalCase identifier for the add-on. |
||
46 | * IMPORTANT! there must be a class of the same name in the root of the add-ons /src/domain/ folder |
||
47 | */ |
||
48 | private $name; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | private $addon_namespace; |
||
54 | |||
55 | /** |
||
56 | * @var FilePath |
||
57 | */ |
||
58 | private $main_file; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | private $slug; |
||
64 | |||
65 | /** |
||
66 | * @var Version the current add-on version |
||
67 | */ |
||
68 | private $version; |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Bootstrap constructor. |
||
73 | * |
||
74 | * @param string $slug |
||
75 | * @param string $name |
||
76 | * @param string $namespace |
||
77 | * @param string $version |
||
78 | * @param string $min_core_version |
||
79 | * @param string $main_file |
||
80 | * @param int $api_version |
||
81 | */ |
||
82 | protected function __construct( |
||
99 | |||
100 | |||
101 | /** |
||
102 | * @return void |
||
103 | */ |
||
104 | public function initialize(): void |
||
112 | |||
113 | |||
114 | /** |
||
115 | * @return int[] |
||
116 | */ |
||
117 | private function validApiVersions(): array |
||
123 | |||
124 | |||
125 | /** |
||
126 | * @param int $api_version |
||
127 | */ |
||
128 | private function setApiVersion(int $api_version): void |
||
140 | |||
141 | |||
142 | /** |
||
143 | * @param string $main_file |
||
144 | */ |
||
145 | public function setMainFile(string $main_file): void |
||
149 | |||
150 | |||
151 | /** |
||
152 | * @param string $min_core_version |
||
153 | */ |
||
154 | private function setMinCoreVersion(string $min_core_version): void |
||
158 | |||
159 | |||
160 | /** |
||
161 | * @param string $name |
||
162 | */ |
||
163 | public function setName(string $name): void |
||
167 | |||
168 | |||
169 | /** |
||
170 | * @param string $namespace |
||
171 | */ |
||
172 | private function setNamespace(string $namespace): void |
||
176 | |||
177 | |||
178 | /** |
||
179 | * @param string $slug |
||
180 | */ |
||
181 | private function setSlug(string $slug): void |
||
194 | |||
195 | |||
196 | /** |
||
197 | * @param string $version |
||
198 | */ |
||
199 | public function setVersion(string $version): void |
||
203 | |||
204 | |||
205 | /** |
||
206 | * @return int |
||
207 | */ |
||
208 | public function apiVersion(): int |
||
212 | |||
213 | |||
214 | /** |
||
215 | * @return DomainInterface |
||
216 | */ |
||
217 | public function domain(): DomainInterface |
||
221 | |||
222 | |||
223 | /** |
||
224 | * @return Version|null |
||
225 | */ |
||
226 | public function minCoreVersion(): ?Version |
||
230 | |||
231 | |||
232 | /** |
||
233 | * @return Version|null |
||
234 | */ |
||
235 | public function minWpVersion(): ?Version |
||
239 | |||
240 | |||
241 | /** |
||
242 | * @param string $min_wp_version |
||
243 | */ |
||
244 | public function setMinWpVersion(string $min_wp_version = EE_MIN_WP_VER_REQUIRED): void |
||
248 | |||
249 | |||
250 | /** |
||
251 | * @return string |
||
252 | */ |
||
253 | public function name(): string |
||
257 | |||
258 | |||
259 | /** |
||
260 | * FQCN for the domain's EE_Addon class |
||
261 | * |
||
262 | * @return string |
||
263 | */ |
||
264 | public function fqcn(): string |
||
268 | |||
269 | |||
270 | /** |
||
271 | * @return string |
||
272 | */ |
||
273 | public function getNamespace(): string |
||
277 | |||
278 | |||
279 | /** |
||
280 | * @return FilePath |
||
281 | */ |
||
282 | public function mainFile(): FilePath |
||
286 | |||
287 | |||
288 | /** |
||
289 | * @return string |
||
290 | */ |
||
291 | public function slug(): string |
||
295 | |||
296 | |||
297 | /** |
||
298 | * @return Version |
||
299 | */ |
||
300 | public function version(): Version |
||
304 | } |
||
305 |