SearchQuery.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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\Files\Search;
  7. use OCP\Files\Search\ISearchOperator;
  8. use OCP\Files\Search\ISearchOrder;
  9. use OCP\Files\Search\ISearchQuery;
  10. use OCP\IUser;
  11. class SearchQuery implements ISearchQuery {
  12. /** @var ISearchOperator */
  13. private $searchOperation;
  14. /** @var integer */
  15. private $limit;
  16. /** @var integer */
  17. private $offset;
  18. /** @var ISearchOrder[] */
  19. private $order;
  20. /** @var ?IUser */
  21. private $user;
  22. private $limitToHome;
  23. /**
  24. * SearchQuery constructor.
  25. *
  26. * @param ISearchOperator $searchOperation
  27. * @param int $limit
  28. * @param int $offset
  29. * @param array $order
  30. * @param ?IUser $user
  31. * @param bool $limitToHome
  32. */
  33. public function __construct(
  34. ISearchOperator $searchOperation,
  35. int $limit,
  36. int $offset,
  37. array $order,
  38. ?IUser $user = null,
  39. bool $limitToHome = false
  40. ) {
  41. $this->searchOperation = $searchOperation;
  42. $this->limit = $limit;
  43. $this->offset = $offset;
  44. $this->order = $order;
  45. $this->user = $user;
  46. $this->limitToHome = $limitToHome;
  47. }
  48. /**
  49. * @return ISearchOperator
  50. */
  51. public function getSearchOperation() {
  52. return $this->searchOperation;
  53. }
  54. /**
  55. * @return int
  56. */
  57. public function getLimit() {
  58. return $this->limit;
  59. }
  60. /**
  61. * @return int
  62. */
  63. public function getOffset() {
  64. return $this->offset;
  65. }
  66. /**
  67. * @return ISearchOrder[]
  68. */
  69. public function getOrder() {
  70. return $this->order;
  71. }
  72. /**
  73. * @return ?IUser
  74. */
  75. public function getUser() {
  76. return $this->user;
  77. }
  78. public function limitToHome(): bool {
  79. return $this->limitToHome;
  80. }
  81. }