StringDataType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 26.32 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 10
loc 38
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAvailableFilterMethods() 10 10 1
A getDefaultFilterMethod() 0 4 1
A getName() 0 4 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
namespace Netdudes\DataSourceryBundle\DataType;
4
5
use Netdudes\DataSourceryBundle\Query\FilterCondition;
6
7
class StringDataType extends AbstractDataType
8
{
9
    /**
10
     * Return an array of available filter methods
11
     *
12
     * @return array
13
     */
14 View Code Duplication
    public function getAvailableFilterMethods()
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...
15
    {
16
        return [
17
            FilterCondition::METHOD_STRING_EQ,
18
            FilterCondition::METHOD_STRING_NEQ,
19
            FilterCondition::METHOD_STRING_LIKE,
20
            FilterCondition::METHOD_IN,
21
            FilterCondition::METHOD_NIN,
22
        ];
23
    }
24
25
    /**
26
     * Return the identifier of the default sort method
27
     *
28
     * @return int
29
     */
30
    public function getDefaultFilterMethod()
31
    {
32
        return FilterCondition::METHOD_STRING_EQ;
33
    }
34
35
    /**
36
     * Return the name of the type, unique.
37
     *
38
     * @return string
39
     */
40
    public function getName()
41
    {
42
        return 'string';
43
    }
44
}
45