Completed
Push — master ( d3ac62...0cb203 )
by Federico
02:08
created

lib/Elastica/Processor/Kv.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Elastica\Processor;
4
5
/**
6
 * Elastica KV Processor.
7
 *
8
 * @author   Federico Panini <[email protected]>
9
 *
10
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/kv-processor.html
11
 */
12 View Code Duplication
class Kv extends AbstractProcessor
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * Kv constructor.
16
     *
17
     * @param string $field
18
     * @param string $fieldSplit
19
     * @param string $valueSplit
20
     */
21
    public function __construct(string $field, string $fieldSplit, string $valueSplit)
22
    {
23
        $this->setField($field);
24
        $this->setFieldSplit($fieldSplit);
25
        $this->setValueSplit($valueSplit);
26
    }
27
28
    /**
29
     * Set field name.
30
     *
31
     * @param string $field
32
     *
33
     * @return $this
34
     */
35
    public function setField(string $field)
36
    {
37
        return $this->setParam('field', $field);
38
    }
39
40
    /**
41
     * Set field_split.
42
     *
43
     * @param string $fieldSplit
44
     *
45
     * @return $this
46
     */
47
    public function setFieldSplit(string $fieldSplit)
48
    {
49
        return $this->setParam('field_split', $fieldSplit);
50
    }
51
52
    /**
53
     * Set value_split.
54
     *
55
     * @param string $valueSplit
56
     *
57
     * @return $this
58
     */
59
    public function setValueSplit(string $valueSplit)
60
    {
61
        return $this->setParam('value_split', $valueSplit);
62
    }
63
64
    /**
65
     * Set target_field. Default value @timestamp.
66
     *
67
     * @param string $targetField
68
     *
69
     * @return $this
70
     */
71
    public function setTargetField(string $targetField)
72
    {
73
        return $this->setParam('target_field', $targetField);
74
    }
75
76
    /**
77
     * Set include_keys.
78
     *
79
     * @param array $listOfKeys
80
     *
81
     * @return $this
82
     */
83
    public function setIncludeKeys(array $listOfKeys)
84
    {
85
        return $this->setParam('include_keys', $listOfKeys);
86
    }
87
88
    /**
89
     * Set exclude_keys.
90
     *
91
     * @param array $listOfKeys
92
     *
93
     * @return $this
94
     */
95
    public function setExcludeKeys(array $listOfKeys)
96
    {
97
        return $this->setParam('exclude_keys', $listOfKeys);
98
    }
99
100
    /**
101
     * Set ignore_missing. Default value false.
102
     *
103
     * @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto)
104
     *
105
     * @return $this
106
     */
107
    public function setIgnoreMissing(bool $ignoreMissing)
108
    {
109
        return $this->setParam('ignore_missing', $ignoreMissing);
110
    }
111
}
112