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