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

DateType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 43.48 %

Importance

Changes 0
Metric Value
wmc 2
dl 10
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParameters() 10 10 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\Type;
6
7
use AmaTeam\ElasticSearch\Mapping\Parameter\DocValuesParameter;
8
use AmaTeam\ElasticSearch\Mapping\Parameter\FormatParameter;
9
use AmaTeam\ElasticSearch\Mapping\Parameter\IgnoreMalformedParameter;
10
use AmaTeam\ElasticSearch\Mapping\Parameter\IndexParameter;
11
use AmaTeam\ElasticSearch\Mapping\Parameter\LocaleParameter;
12
use AmaTeam\ElasticSearch\Mapping\Parameter\NullValueParameter;
13
use AmaTeam\ElasticSearch\Mapping\Parameter\StoreParameter;
14
15
class DateType extends AbstractType
16
{
17
    const ID = 'date';
18
    const FRIENDLY_ID = self::ID;
19
20
    public function getId(): string
21
    {
22
        return self::ID;
23
    }
24
25
    /**
26
     * @inheritDoc
27
     */
28 View Code Duplication
    public function getParameters(): array
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
            DocValuesParameter::getInstance(),
32
            FormatParameter::getInstance(),
33
            LocaleParameter::getInstance(),
34
            IgnoreMalformedParameter::getInstance(),
35
            IndexParameter::getInstance(),
36
            NullValueParameter::getInstance(),
37
            StoreParameter::getInstance(),
38
        ];
39
    }
40
}
41