IndexConfigurationRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 85.19 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetReturnsConfig() 12 12 1
A testGetReturnsNullIfIndexNotExists() 11 11 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 GBProd\Tests\Units\ElasticsearchExtraBundle\Repository;
4
5
use atoum;
6
7
/**
8
 * Tests for IndexConfigurationRepository
9
 *
10
 * @author gbprod <[email protected]>
11
 */
12
class IndexConfigurationRepository extends atoum
13
{
14 View Code Duplication
    public function testGetReturnsConfig()
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
        $this
17
            ->given($configs = ['my_index' => ['my' => 'config']])
18
            ->and($this->newTestedInstance($configs))
19
            ->if($config = $this->testedInstance->get('my_index'))
20
            ->then
21
                ->array($config)
22
                    ->isEqualTo(['my' => 'config'])
23
        ;
24
25
    }
26
27 View Code Duplication
    public function testGetReturnsNullIfIndexNotExists()
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...
28
    {
29
        $this
30
            ->given($configs = ['my_index' => ['my' => 'config']])
31
            ->and($this->newTestedInstance($configs))
32
            ->if($config = $this->testedInstance->get('not_a_index'))
33
            ->then
34
                ->variable($config)
35
                    ->isNull()
36
        ;
37
    }
38
}
39