FullNameSpec   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 61.54 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A it_does_not_create_full_name_with_empty_first_name() 0 5 1
A it_creates_with_empty_last_name() 8 8 1
A it_creates() 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
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Spec\Kreta\IdentityAccess\Domain\Model\User;
16
17
use Kreta\IdentityAccess\Domain\Model\User\FirstNameEmptyException;
18
use PhpSpec\ObjectBehavior;
19
20
class FullNameSpec extends ObjectBehavior
21
{
22
    function it_does_not_create_full_name_with_empty_first_name()
23
    {
24
        $this->beConstructedWith('', '');
25
        $this->shouldThrow(FirstNameEmptyException::class)->duringInstantiation();
26
    }
27
28 View Code Duplication
    function it_creates_with_empty_last_name()
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
        $this->beConstructedWith('Kreta', '');
31
        $this->firstName()->shouldReturn('Kreta');
32
        $this->lastName()->shouldReturn('');
33
        $this->fullName()->shouldReturn('Kreta');
34
        $this->__toString()->shouldReturn('Kreta');
35
    }
36
37 View Code Duplication
    function it_creates()
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...
38
    {
39
        $this->beConstructedWIth('Kreta', 'Info');
40
        $this->firstName()->shouldReturn('Kreta');
41
        $this->lastName()->shouldReturn('Info');
42
        $this->fullName()->shouldReturn('Kreta Info');
43
        $this->__toString()->shouldReturn('Kreta Info');
44
    }
45
}
46