Completed
Push — master ( 229510...0875a1 )
by
unknown
9s
created

BaseUser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 45.83 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 1
c 2
b 0
f 1
lcom 1
cbo 2
dl 11
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromUser() 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 SumoCoders\FrameworkMultiUserBundle\DataTransferObject\Form;
4
5
use SumoCoders\FrameworkMultiUserBundle\User\User as UserEntity;
6
7
class BaseUser extends User
8
{
9
    /**
10
     * @var string
11
     */
12
    public $password = '';
13
14
    /**
15
     * @param UserEntity $user
16
     *
17
     * @return User
18
     */
19 View Code Duplication
    public static function fromUser(UserEntity $user)
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...
20
    {
21
        $baseUserTransferObject = new self();
22
        $baseUserTransferObject->id = $user->getId();
23
        $baseUserTransferObject->userName = $user->getUsername();
24
        $baseUserTransferObject->displayName = $user->getDisplayName();
25
        $baseUserTransferObject->email = $user->getEmail();
26
        $baseUserTransferObject->password = $user->getPassword();
27
28
        return $baseUserTransferObject;
29
    }
30
}
31