Config.php 967 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\CloudFederationAPI;
  7. use OCP\Federation\ICloudFederationProviderManager;
  8. /**
  9. * Class config
  10. *
  11. * handles all the config parameters
  12. *
  13. * @package OCA\CloudFederationAPI
  14. */
  15. class Config {
  16. /** @var ICloudFederationProviderManager */
  17. private $cloudFederationProviderManager;
  18. public function __construct(ICloudFederationProviderManager $cloudFederationProviderManager) {
  19. $this->cloudFederationProviderManager = $cloudFederationProviderManager;
  20. }
  21. /**
  22. * get a list of supported share types
  23. *
  24. * @param string $resourceType
  25. * @return array
  26. */
  27. public function getSupportedShareTypes($resourceType) {
  28. try {
  29. $provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
  30. return $provider->getSupportedShareTypes();
  31. } catch (\Exception $e) {
  32. return [];
  33. }
  34. }
  35. }