ADiscoverableReferenceProvider.php 730 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Collaboration\Reference;
  8. use JsonSerializable;
  9. /**
  10. * @since 26.0.0
  11. */
  12. abstract class ADiscoverableReferenceProvider implements IDiscoverableReferenceProvider, JsonSerializable {
  13. /**
  14. * @since 26.0.0
  15. */
  16. public function jsonSerialize(): array {
  17. $json = [
  18. 'id' => $this->getId(),
  19. 'title' => $this->getTitle(),
  20. 'icon_url' => $this->getIconUrl(),
  21. 'order' => $this->getOrder(),
  22. ];
  23. if ($this instanceof ISearchableReferenceProvider) {
  24. $json['search_providers_ids'] = $this->getSupportedSearchProviderIds();
  25. }
  26. return $json;
  27. }
  28. }