1
0

ISearchOption.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\FullTextSearch\Model;
  8. /**
  9. * @since 16.0.0
  10. *
  11. * Interface ISearchOption
  12. *
  13. */
  14. interface ISearchOption {
  15. /**
  16. * @since 16.0.0
  17. */
  18. public const CHECKBOX = 'checkbox';
  19. /**
  20. * @since 16.0.0
  21. */
  22. public const INPUT = 'input';
  23. /**
  24. * @since 16.0.0
  25. */
  26. public const INPUT_SMALL = 'small';
  27. /**
  28. * Set the name/key of the option.
  29. * The string should only contains alphanumerical chars and underscore.
  30. * The key can be retrieve when using ISearchRequest::getOption
  31. *
  32. * @see ISearchRequest::getOption
  33. *
  34. * @since 16.0.0
  35. *
  36. * @param string $name
  37. *
  38. * @return ISearchOption
  39. */
  40. public function setName(string $name): ISearchOption;
  41. /**
  42. * Get the name/key of the option.
  43. *
  44. * @since 16.0.0
  45. *
  46. * @return string
  47. */
  48. public function getName(): string;
  49. /**
  50. * Set the title/display name of the option.
  51. *
  52. * @since 16.0.0
  53. *
  54. * @param string $title
  55. *
  56. * @return ISearchOption
  57. */
  58. public function setTitle(string $title): ISearchOption;
  59. /**
  60. * Get the title of the option.
  61. *
  62. * @since 16.0.0
  63. *
  64. * @return string
  65. */
  66. public function getTitle(): string;
  67. /**
  68. * Set the type of the option.
  69. * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT
  70. *
  71. * @since 16.0.0
  72. *
  73. * @param string $type
  74. *
  75. * @return ISearchOption
  76. */
  77. public function setType(string $type): ISearchOption;
  78. /**
  79. * Get the type of the option.
  80. *
  81. * @since 16.0.0
  82. *
  83. * @return string
  84. */
  85. public function getType(): string;
  86. /**
  87. * In case of Type is INPUT, set the size of the input field.
  88. * Value can be ISearchOption::INPUT_SMALL or not defined.
  89. *
  90. * @since 16.0.0
  91. *
  92. * @param string $size
  93. *
  94. * @return ISearchOption
  95. */
  96. public function setSize(string $size): ISearchOption;
  97. /**
  98. * Get the size of the INPUT.
  99. *
  100. * @since 16.0.0
  101. *
  102. * @return string
  103. */
  104. public function getSize(): string;
  105. /**
  106. * In case of Type is , set the placeholder to be displayed in the input
  107. * field.
  108. *
  109. * @since 16.0.0
  110. *
  111. * @param string $placeholder
  112. *
  113. * @return ISearchOption
  114. */
  115. public function setPlaceholder(string $placeholder): ISearchOption;
  116. /**
  117. * Get the placeholder.
  118. *
  119. * @since 16.0.0
  120. *
  121. * @return string
  122. */
  123. public function getPlaceholder(): string;
  124. }