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 Split Processor. |
||
7 | * |
||
8 | * @author Federico Panini <[email protected]> |
||
9 | * |
||
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/split-processor.html |
||
11 | */ |
||
12 | View Code Duplication | class Split extends AbstractProcessor |
|
0 ignored issues
–
show
|
|||
13 | { |
||
14 | /** |
||
15 | * Split constructor. |
||
16 | * |
||
17 | * @param $field |
||
18 | * @param $separator |
||
19 | */ |
||
20 | public function __construct($field, $separator) |
||
21 | { |
||
22 | $this->setField($field); |
||
23 | $this->setSeparator($separator); |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Set the field. |
||
28 | * |
||
29 | * @param string $field |
||
30 | * |
||
31 | * @return $this |
||
32 | */ |
||
33 | public function setField(string $field) |
||
34 | { |
||
35 | return $this->setParam('field', $field); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Set the separator. |
||
40 | * |
||
41 | * @param string $separator |
||
42 | * |
||
43 | * @return $this |
||
44 | */ |
||
45 | public function setSeparator(string $separator) |
||
46 | { |
||
47 | return $this->setParam('separator', $separator); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Set ignore_missing. Default value false. |
||
52 | * |
||
53 | * @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto) |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function setIgnoreMissing(bool $ignoreMissing) |
||
58 | { |
||
59 | return $this->setParam('ignore_missing', $ignoreMissing); |
||
60 | } |
||
61 | } |
||
62 |
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.