IRegistry.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
  5. *
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Support\Subscription;
  27. use OCP\Notification\IManager;
  28. use OCP\Support\Subscription\Exception\AlreadyRegisteredException;
  29. /**
  30. * @since 17.0.0
  31. */
  32. interface IRegistry {
  33. /**
  34. * Register a subscription instance. In case it is called multiple times an
  35. * exception is thrown
  36. *
  37. * @param ISubscription $subscription
  38. * @throws AlreadyRegisteredException
  39. *
  40. * @since 17.0.0
  41. * @deprecated 20.0.0 use registerService
  42. */
  43. public function register(ISubscription $subscription): void;
  44. /**
  45. * Register a subscription handler. The service has to implement the ISubscription interface.
  46. * In case this is called multiple times an exception is thrown.
  47. *
  48. * @param string $subscriptionService
  49. * @throws AlreadyRegisteredException
  50. *
  51. * @since 20.0.0
  52. */
  53. public function registerService(string $subscriptionService): void;
  54. /**
  55. * Fetches the list of app IDs that are supported by the subscription
  56. *
  57. * @since 17.0.0
  58. */
  59. public function delegateGetSupportedApps(): array;
  60. /**
  61. * Indicates if a valid subscription is available
  62. *
  63. * @since 17.0.0
  64. */
  65. public function delegateHasValidSubscription(): bool;
  66. /**
  67. * Indicates if the subscription has extended support
  68. *
  69. * @since 17.0.0
  70. */
  71. public function delegateHasExtendedSupport(): bool;
  72. /**
  73. * Indicates if a hard user limit is reached and no new users should be created
  74. *
  75. * @param IManager|null $notificationManager
  76. * @since 21.0.0
  77. */
  78. public function delegateIsHardUserLimitReached(?IManager $notificationManager = null): bool;
  79. }