2017-04-23 16:10:17 -04:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2017-04-23 16:10:17 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2017-04-23 16:10:17 -04:00
|
|
|
*/
|
|
|
|
|
namespace OC\App\AppStore\Bundles;
|
|
|
|
|
|
|
|
|
|
use OCP\IL10N;
|
|
|
|
|
|
|
|
|
|
class BundleFetcher {
|
2023-07-11 03:54:01 -04:00
|
|
|
public function __construct(
|
2023-07-11 03:18:17 -04:00
|
|
|
private IL10N $l10n,
|
|
|
|
|
) {
|
2017-04-23 16:10:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Bundle[]
|
|
|
|
|
*/
|
2022-09-22 07:29:02 -04:00
|
|
|
public function getBundles(): array {
|
2017-04-23 16:10:17 -04:00
|
|
|
return [
|
|
|
|
|
new EnterpriseBundle($this->l10n),
|
2020-01-23 15:06:59 -05:00
|
|
|
new HubBundle($this->l10n),
|
2017-04-23 16:10:17 -04:00
|
|
|
new GroupwareBundle($this->l10n),
|
2017-04-26 10:05:58 -04:00
|
|
|
new SocialSharingBundle($this->l10n),
|
2017-07-25 09:46:21 -04:00
|
|
|
new EducationBundle($this->l10n),
|
2024-03-05 16:22:45 -05:00
|
|
|
new PublicSectorBundle($this->l10n),
|
2017-04-23 16:10:17 -04:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the bundle with the specified identifier
|
|
|
|
|
*
|
|
|
|
|
* @param string $identifier
|
|
|
|
|
* @return Bundle
|
|
|
|
|
* @throws \BadMethodCallException If the bundle does not exist
|
|
|
|
|
*/
|
2022-09-22 07:29:02 -04:00
|
|
|
public function getBundleByIdentifier(string $identifier): Bundle {
|
|
|
|
|
foreach ($this->getBundles() as $bundle) {
|
2017-04-23 16:10:17 -04:00
|
|
|
if ($bundle->getIdentifier() === $identifier) {
|
|
|
|
|
return $bundle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new \BadMethodCallException('Bundle with specified identifier does not exist');
|
|
|
|
|
}
|
|
|
|
|
}
|