Completed
Pull Request — master (#1893)
by
unknown
03:01
created

SetProcessor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 40
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setField() 0 4 1
A setValue() 0 4 1
A setOverride() 0 4 1
1
<?php
2
3
namespace Elastica\Processor;
4
5
/**
6
 * Elastica Set Processor.
7
 *
8
 * @author Federico Panini <[email protected]>
9
 *
10
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/set-processor.html
11
 */
12
class SetProcessor extends AbstractProcessor
13
{
14
    public const DEFAULT_OVERRIDE_VALUE = true;
15
16
    public function __construct(string $field, string $value)
17
    {
18
        $this->setField($field);
19
        $this->setValue($value);
20
    }
21
22
    /**
23
     * Set field.
24
     *
25
     * @return $this
26
     */
27
    public function setField(string $field): self
28
    {
29
        return $this->setParam('field', $field);
30
    }
31
32
    /**
33
     * Set field value.
34
     *
35
     * @return $this
36
     */
37
    public function setValue(string $value): self
38
    {
39
        return $this->setParam('value', $value);
40
    }
41
42
    /**
43
     * Set override. Default true.
44
     *
45
     * @return $this
46
     */
47
    public function setOverride(bool $override): self
48
    {
49
        return $this->setParam('override', $override);
50
    }
51
}
52