Passed
Pull Request — master (#81)
by
unknown
06:53
created

CamelCaseNameGeneratorSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 1
dl 34
loc 34
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 4 4 1
A it_implements_name_generator_interface() 4 4 1
A it_should_return_underscored_values_from_snake_case() 8 8 1
A it_should_return_underscored_values_from_camel_case() 8 8 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 spec\Gesdinet\JWTRefreshTokenBundle\NameGenerator;
4
5
use Gesdinet\JWTRefreshTokenBundle\NameGenerator\CamelCaseNameGenerator;
6
use Gesdinet\JWTRefreshTokenBundle\NameGenerator\NameGeneratorInterface;
7
use PhpSpec\ObjectBehavior;
8
9
/**
10
 * Spec for Gesdinet\JWTRefreshTokenBundle\NameGenerator\CamelCaseNameGenerator.
11
 *
12
 * @covers \Gesdinet\JWTRefreshTokenBundle\NameGenerator\CamelCaseNameGenerator
13
 */
14 View Code Duplication
class CamelCaseNameGeneratorSpec extends ObjectBehavior
0 ignored issues
show
Duplication introduced by
This class 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
    //------------------------------------------------------------------------------------------------------------------
17
    // Spec: Class / interfaces
18
    //------------------------------------------------------------------------------------------------------------------
19
20
    public function it_is_initializable()
21
    {
22
        $this->shouldHaveType('Gesdinet\JWTRefreshTokenBundle\NameGenerator\CamelCaseNameGenerator');
23
    }
24
25
    public function it_implements_name_generator_interface()
26
    {
27
        $this->shouldImplement('Gesdinet\JWTRefreshTokenBundle\NameGenerator\NameGeneratorInterface');
28
    }
29
30
    public function it_should_return_underscored_values_from_snake_case()
31
    {
32
        /* @var CamelCaseNameGenerator|CamelCaseNameGeneratorSpec $this */
33
34
        // Method under test
35
        $this->generateName('refresh_token')
36
             ->shouldReturn('refreshToken');
37
    }
38
39
    public function it_should_return_underscored_values_from_camel_case()
40
    {
41
        /* @var CamelCaseNameGenerator|CamelCaseNameGeneratorSpec $this */
42
43
        // Method under test
44
        $this->generateName('refreshToken')
45
             ->shouldReturn('refreshToken');
46
    }
47
}
48