blob: 4ff53b0c70bea87ed2e075b7c20c98a7ff0446dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\App\AppStore\Bundles;
use OCP\IL10N;
class BundleFetcher {
public function __construct(
private IL10N $l10n,
) {
}
/**
* @return Bundle[]
*/
public function getBundles(): array {
return [
new EnterpriseBundle($this->l10n),
new HubBundle($this->l10n),
new GroupwareBundle($this->l10n),
new SocialSharingBundle($this->l10n),
new EducationBundle($this->l10n),
new PublicSectorBundle($this->l10n),
];
}
/**
* Get the bundle with the specified identifier
*
* @param string $identifier
* @return Bundle
* @throws \BadMethodCallException If the bundle does not exist
*/
public function getBundleByIdentifier(string $identifier): Bundle {
foreach ($this->getBundles() as $bundle) {
if ($bundle->getIdentifier() === $identifier) {
return $bundle;
}
}
throw new \BadMethodCallException('Bundle with specified identifier does not exist');
}
}
|