Completed
Push — profiles-entity ( cb5acc...05ead5 )
by Stijn
62:17
created

ProfileDataTransferObject::getProfileEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Backend\Modules\Profiles\Domain\Profile;
4
5
use Symfony\Component\Validator\Constraints as Assert;
6
7
class ProfileDataTransferObject
8
{
9
    /**
10
     * @var Profile
11
     */
12
    protected $profileEntity;
13
14
    /**
15
     * @var int|null
16
     */
17
    public $id;
18
19
    /**
20
     * @var string
21
     *
22
     * @Assert\NotBlank(message="err.FieldIsRequired")
23
     */
24
    public $email;
25
26
    /**
27
     * @var string
28
     *
29
     * @Assert\NotBlank(message="err.FieldIsRequired")
30
     */
31
    public $password;
32
33
    /**
34
     * @var Status
35
     */
36
    public $status;
37
38
    /**
39
     * @var string
40
     */
41
    public $displayName;
42
43
    /**
44
     * @var string
45
     */
46
    public $url;
47
48
    public function __construct(Profile $profile = null)
49
    {
50
        if (!($profile instanceof Profile)) {
51
            return;
52
        }
53
54
        $this->profileEntity = $profile;
55
56
        $this->id = $profile->getId();
57
        $this->email = $profile->getEmail();
58
        $this->password = $profile->getPassword();
59
        $this->status = $profile->getStatus();
60
        $this->displayName = $profile->getDisplayName();
61
        $this->url = $profile->getUrl();
62
    }
63
64
    public function getProfileEntity(): Profile
65
    {
66
        return $this->profileEntity;
67
    }
68
}
69