LinkAction.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Contacts\ContactsMenu\Actions;
  7. use OCP\Contacts\ContactsMenu\ILinkAction;
  8. class LinkAction implements ILinkAction {
  9. private string $icon = '';
  10. private string $name = '';
  11. private string $href = '';
  12. private int $priority = 10;
  13. private string $appId = '';
  14. /**
  15. * @param string $icon absolute URI to an icon
  16. */
  17. public function setIcon(string $icon): void {
  18. $this->icon = $icon;
  19. }
  20. public function setName(string $name): void {
  21. $this->name = $name;
  22. }
  23. public function getName(): string {
  24. return $this->name;
  25. }
  26. public function setPriority(int $priority): void {
  27. $this->priority = $priority;
  28. }
  29. public function getPriority(): int {
  30. return $this->priority;
  31. }
  32. public function setHref(string $href): void {
  33. $this->href = $href;
  34. }
  35. public function getHref(): string {
  36. return $this->href;
  37. }
  38. /**
  39. * @since 23.0.0
  40. */
  41. public function setAppId(string $appId): void {
  42. $this->appId = $appId;
  43. }
  44. /**
  45. * @since 23.0.0
  46. */
  47. public function getAppId(): string {
  48. return $this->appId;
  49. }
  50. /**
  51. * @return array{title: string, icon: string, hyperlink: string, appId: string}
  52. */
  53. public function jsonSerialize(): array {
  54. return [
  55. 'title' => $this->name,
  56. 'icon' => $this->icon,
  57. 'hyperlink' => $this->href,
  58. 'appId' => $this->appId,
  59. ];
  60. }
  61. }