Completed
Pull Request — master (#1893)
by
unknown
02:56
created

SortProcessor::setField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Elastica\Processor;
4
5
/**
6
 * Elastica Sort Processor.
7
 *
8
 * @author Federico Panini <[email protected]>
9
 *
10
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-processor.html
11
 */
12
class SortProcessor extends AbstractProcessor
13
{
14
    public const DEFAULT_ORDER_VALUE = 'asc';
15
16
    public function __construct(string $field)
17
    {
18
        $this->setField($field);
19
    }
20
21
    /**
22
     * Set the field.
23
     *
24
     * @return $this
25
     */
26
    public function setField(string $field): self
27
    {
28
        return $this->setParam('field', $field);
29
    }
30
31
    /**
32
     * Set order. Default 'asc'.
33
     *
34
     * @return $this
35
     */
36
    public function setOrder(string $order): self
37
    {
38
        return $this->setParam('order', $order);
39
    }
40
}
41