Limit.php 623 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Elastica\Query;
  3. /**
  4. * Limit Query.
  5. *
  6. * @author Nicolas Ruflin <spam@ruflin.com>
  7. *
  8. * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-limit-query.html
  9. */
  10. class Limit extends AbstractQuery
  11. {
  12. /**
  13. * Construct limit query.
  14. *
  15. * @param int $limit Limit
  16. */
  17. public function __construct($limit)
  18. {
  19. $this->setLimit($limit);
  20. }
  21. /**
  22. * Set the limit.
  23. *
  24. * @param int $limit Limit
  25. *
  26. * @return $this
  27. */
  28. public function setLimit($limit)
  29. {
  30. return $this->setParam('value', (int) $limit);
  31. }
  32. }