Completed
Push — master ( f0d587...288e55 )
by Nicolas
01:43
created

DistanceFeature::setPivot()   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\Query;
4
5
/**
6
 * Distance feature query.
7
 *
8
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-distance-feature-query.html
9
 */
10
class DistanceFeature extends AbstractQuery
11
{
12
    public function __construct(string $field, $origin, string $pivot)
13
    {
14
        $this->setField($field);
15
        $this->setOrigin($origin);
16
        $this->setPivot($pivot);
17
    }
18
19
    public function setField(string $field): self
20
    {
21
        return $this->setParam('field', $field);
22
    }
23
24
    /**
25
     * @param string|array $origin
26
     */
27
    public function setOrigin($origin): self
28
    {
29
        return $this->setParam('origin', $origin);
30
    }
31
32
    public function setPivot(string $pivot): self
33
    {
34
        return $this->setParam('pivot', $pivot);
35
    }
36
37
    public function setBoost(float $boost = 1.0): self
38
    {
39
        return $this->setParam('boost', $boost);
40
    }
41
}
42