You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.3 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
  4. *
  5. * @author Robin Appelman <robin@icewind.nl>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OC\Files\Search;
  24. use OCP\Files\Search\ISearchOperator;
  25. use OCP\Files\Search\ISearchOrder;
  26. use OCP\Files\Search\ISearchQuery;
  27. use OCP\IUser;
  28. class SearchQuery implements ISearchQuery {
  29. /** @var ISearchOperator */
  30. private $searchOperation;
  31. /** @var integer */
  32. private $limit;
  33. /** @var integer */
  34. private $offset;
  35. /** @var ISearchOrder[] */
  36. private $order;
  37. /** @var IUser */
  38. private $user;
  39. private $limitToHome;
  40. /**
  41. * SearchQuery constructor.
  42. *
  43. * @param ISearchOperator $searchOperation
  44. * @param int $limit
  45. * @param int $offset
  46. * @param array $order
  47. * @param IUser $user
  48. * @param bool $limitToHome
  49. */
  50. public function __construct(
  51. ISearchOperator $searchOperation,
  52. int $limit,
  53. int $offset,
  54. array $order,
  55. IUser $user,
  56. bool $limitToHome = false
  57. ) {
  58. $this->searchOperation = $searchOperation;
  59. $this->limit = $limit;
  60. $this->offset = $offset;
  61. $this->order = $order;
  62. $this->user = $user;
  63. $this->limitToHome = $limitToHome;
  64. }
  65. /**
  66. * @return ISearchOperator
  67. */
  68. public function getSearchOperation() {
  69. return $this->searchOperation;
  70. }
  71. /**
  72. * @return int
  73. */
  74. public function getLimit() {
  75. return $this->limit;
  76. }
  77. /**
  78. * @return int
  79. */
  80. public function getOffset() {
  81. return $this->offset;
  82. }
  83. /**
  84. * @return ISearchOrder[]
  85. */
  86. public function getOrder() {
  87. return $this->order;
  88. }
  89. /**
  90. * @return IUser
  91. */
  92. public function getUser() {
  93. return $this->user;
  94. }
  95. public function limitToHome(): bool {
  96. return $this->limitToHome;
  97. }
  98. }