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

AppendProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 36
c 0
b 0
f 0
rs 10

3 Methods

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