Completed
Pull Request — master (#13)
by
unknown
02:32
created

User::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace SumoCoders\FrameworkMultiUserBundle\DataTransferObject\Form;
4
5
use SumoCoders\FrameworkMultiUserBundle\User\User as UserEntity;
6
7
class User implements UserInterface
8
{
9
    /**
10
     * @var int
11
     */
12
    public $id;
13
14
    /**
15
     * @var string
16
     */
17
    public $userName;
18
19
    /**
20
     * @var string
21
     */
22
    public $displayName;
23
24
    /**
25
     * @var string
26
     */
27
    public $email;
28
29
    /**
30
     * @param UserEntity $user
31
     *
32
     * @return User
33
     */
34 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...
35
    {
36
        $dataTransferObject = new self();
37
        $dataTransferObject->id = $user->getId();
38
        $dataTransferObject->userName = $user->getUsername();
39
        $dataTransferObject->displayName = $user->getDisplayName();
40
        $dataTransferObject->email = $user->getEmail();
41
42
        return $dataTransferObject;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getClass()
49
    {
50
        return UserEntity::class;
51
    }
52
}
53