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 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 Append extends AbstractProcessor |
|
0 ignored issues
–
show
|
|||
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 |
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.