Passed
Push — feature/initial-implementation ( e556a2...0c2c6c )
by Fike
01:52
created

TermVectorParameter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 27.59 %

Importance

Changes 0
Metric Value
wmc 3
dl 8
loc 29
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFriendlyId() 0 3 1
A getAllowedValues() 8 8 1
A getId() 0 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace AmaTeam\ElasticSearch\Mapping\Parameter;
6
7
class TermVectorParameter extends AbstractEnumParameter
8
{
9
    const ID = 'term_vector';
10
    const FRIENDLY_ID = 'termVector';
11
12
    const VALUE_NO = 'no';
13
    const VALUE_YES = 'yes';
14
    const VALUE_WITH_POSITIONS = 'with_positions';
15
    const VALUE_WITH_OFFSETS = 'with_offsets';
16
    const VALUE_WITH_POSITIONS_AND_OFFSETS = 'with_position_offsets';
17
18
    public function getId(): string
19
    {
20
        return self::ID;
21
    }
22
23
    public function getFriendlyId(): string
24
    {
25
        return self::FRIENDLY_ID;
26
    }
27
28 View Code Duplication
    public function getAllowedValues()
0 ignored issues
show
Duplication introduced by
This method 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...
29
    {
30
        return [
31
            self::VALUE_NO,
32
            self::VALUE_YES,
33
            self::VALUE_WITH_POSITIONS,
34
            self::VALUE_WITH_OFFSETS,
35
            self::VALUE_WITH_POSITIONS_AND_OFFSETS
36
        ];
37
    }
38
}
39