Completed
Pull Request — master (#1893)
by
unknown
06:15 queued 02:30
created

AppendProcessor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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 View Code Duplication
class AppendProcessor extends AbstractProcessor
0 ignored issues
show
Duplication introduced by
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
     * @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