Completed
Pull Request — master (#1893)
by
unknown
05:15 queued 01:17
created

AppendProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

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
     * @param string       $field field name
16
     * @param array|string $value field values to append
17
     */
18
    public function __construct(string $field, $value)
19
    {
20
        $this->setField($field);
21
        $this->setValue($value);
22
    }
23
24
    /**
25
     * Set field.
26
     *
27
     * @return $this
28
     */
29
    public function setField(string $field): self
30
    {
31
        return $this->setParam('field', $field);
32
    }
33
34
    /**
35
     * Set field value.
36
     *
37
     * @param array|string $value
38
     *
39
     * @return $this
40
     */
41
    public function setValue($value): self
42
    {
43
        return $this->setParam('value', $value);
44
    }
45
}
46