ISearchOption.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Maxence Lange <maxence@artificial-owl.com>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCP\FullTextSearch\Model;
  26. /**
  27. * @since 16.0.0
  28. *
  29. * Interface ISearchOption
  30. *
  31. */
  32. interface ISearchOption {
  33. /**
  34. * @since 16.0.0
  35. */
  36. public const CHECKBOX = 'checkbox';
  37. /**
  38. * @since 16.0.0
  39. */
  40. public const INPUT = 'input';
  41. /**
  42. * @since 16.0.0
  43. */
  44. public const INPUT_SMALL = 'small';
  45. /**
  46. * Set the name/key of the option.
  47. * The string should only contains alphanumerical chars and underscore.
  48. * The key can be retrieve when using ISearchRequest::getOption
  49. *
  50. * @see ISearchRequest::getOption
  51. *
  52. * @since 16.0.0
  53. *
  54. * @param string $name
  55. *
  56. * @return ISearchOption
  57. */
  58. public function setName(string $name): ISearchOption;
  59. /**
  60. * Get the name/key of the option.
  61. *
  62. * @since 16.0.0
  63. *
  64. * @return string
  65. */
  66. public function getName(): string;
  67. /**
  68. * Set the title/display name of the option.
  69. *
  70. * @since 16.0.0
  71. *
  72. * @param string $title
  73. *
  74. * @return ISearchOption
  75. */
  76. public function setTitle(string $title): ISearchOption;
  77. /**
  78. * Get the title of the option.
  79. *
  80. * @since 16.0.0
  81. *
  82. * @return string
  83. */
  84. public function getTitle(): string;
  85. /**
  86. * Set the type of the option.
  87. * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT
  88. *
  89. * @since 16.0.0
  90. *
  91. * @param string $type
  92. *
  93. * @return ISearchOption
  94. */
  95. public function setType(string $type): ISearchOption;
  96. /**
  97. * Get the type of the option.
  98. *
  99. * @since 16.0.0
  100. *
  101. * @return string
  102. */
  103. public function getType(): string;
  104. /**
  105. * In case of Type is INPUT, set the size of the input field.
  106. * Value can be ISearchOption::INPUT_SMALL or not defined.
  107. *
  108. * @since 16.0.0
  109. *
  110. * @param string $size
  111. *
  112. * @return ISearchOption
  113. */
  114. public function setSize(string $size): ISearchOption;
  115. /**
  116. * Get the size of the INPUT.
  117. *
  118. * @since 16.0.0
  119. *
  120. * @return string
  121. */
  122. public function getSize(): string;
  123. /**
  124. * In case of Type is , set the placeholder to be displayed in the input
  125. * field.
  126. *
  127. * @since 16.0.0
  128. *
  129. * @param string $placeholder
  130. *
  131. * @return ISearchOption
  132. */
  133. public function setPlaceholder(string $placeholder): ISearchOption;
  134. /**
  135. * Get the placeholder.
  136. *
  137. * @since 16.0.0
  138. *
  139. * @return string
  140. */
  141. public function getPlaceholder(): string;
  142. }