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

RenameProcessor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 42
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 setTargetField() 0 4 1
A setIgnoreMissing() 0 4 1
1
<?php
2
3
namespace Elastica\Processor;
4
5
/**
6
 * Elastica Rename Processor.
7
 *
8
 * @author Federico Panini <[email protected]>
9
 *
10
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/rename-processor.html
11
 */
12
class RenameProcessor extends AbstractProcessor
13
{
14
    public const DEFAULT_IGNORE_MISSING_VALUE = false;
15
16
    public function __construct(string $field, string $targetField)
17
    {
18
        $this->setField($field);
19
        $this->setTargetField($targetField);
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 target_field.
34
     *
35
     * @return $this
36
     */
37
    public function setTargetField(string $targetField): self
38
    {
39
        return $this->setParam('target_field', $targetField);
40
    }
41
42
    /**
43
     * Set ignore_missing. Default value false.
44
     *
45
     * @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto)
46
     *
47
     * @return $this
48
     */
49
    public function setIgnoreMissing(bool $ignoreMissing): self
50
    {
51
        return $this->setParam('ignore_missing', $ignoreMissing);
52
    }
53
}
54