Passed
Push — master ( f87cd0...02e408 )
by
unknown
08:57
created

UserBase::getAddressDTO()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
/**
3
 * Created by Graham Owens ([email protected])
4
 * Company: PartFire Ltd (www.partfire.co.uk)
5
 * Console: Discovery
6
 *
7
 * User:    gra
8
 * Date:    10/01/17
9
 * Time:    15:13
10
 * Project: PartFire MangoPay Bundle
11
 * File:    UserBase.php
12
 *
13
 **/
14
15
namespace PartFire\MangoPayBundle\Models\DTOs;
16
17
18
class UserBase
19
{
20
    private $personType;
21
    private $email;
22
    private $kYCLevel;
23
    private $id;
24
    private $tag;
25
    private $creationDate;
26
27
    /**
28
     * @return mixed
29
     */
30
    public function getPersonType()
31
    {
32
        return $this->personType;
33
    }
34
35
    /**
36
     * @param mixed $personType
37
     */
38
    public function setPersonType($personType)
39
    {
40
        $this->personType = $personType;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46
    public function getEmail()
47
    {
48
        return $this->email;
49
    }
50
51
    /**
52
     * @param mixed $email
53
     */
54
    public function setEmail($email)
55
    {
56
        $this->email = $email;
57
    }
58
59
    /**
60
     * @return mixed
61
     */
62
    public function getKYCLevel()
63
    {
64
        return $this->kYCLevel;
65
    }
66
67
    /**
68
     * @param mixed $kYCLevel
69
     */
70
    public function setKYCLevel($kYCLevel)
71
    {
72
        $this->kYCLevel = $kYCLevel;
73
    }
74
75
    /**
76
     * @return mixed
77
     */
78
    public function getId()
79
    {
80
        return $this->id;
81
    }
82
83
    /**
84
     * @param mixed $id
85
     */
86
    public function setId($id)
87
    {
88
        $this->id = $id;
89
    }
90
91
    /**
92
     * @return mixed
93
     */
94
    public function getTag()
95
    {
96
        return $this->tag;
97
    }
98
99
    /**
100
     * @param mixed $tag
101
     */
102
    public function setTag($tag)
103
    {
104
        $this->tag = $tag;
105
    }
106
107
    /**
108
     * @return mixed
109
     */
110
    public function getCreationDate()
111
    {
112
        return $this->creationDate;
113
    }
114
115
    /**
116
     * @param mixed $creationDate
117
     */
118
    public function setCreationDate($creationDate)
119
    {
120
        $this->creationDate = $creationDate;
121
    }
122
123
    public function setSnapShotArrayToObject(array $array)
124
    {
125
        foreach ($array as $key => $value)
126
        {
127
            $methodName = 'set' . $key;
128
129
            if ($key instanceof \DateTime) {
130
                $value = $key->format('U');
131
            }
132
133
            if ($key == 'Address') {
134
                $value = $this->getAddressDTO($value);
135
            }
136
137
            $this->$methodName($value);
138
        }
139
    }
140
141
    protected function getAddressDTO(array $addressArray)
142
    {
143
        $value = new Address();
144
        $value->setAddressLine1($addressArray['AddressLine1']);
145
        $value->setAddressLine1($addressArray['AddressLine2']);
146
        $value->setAddressLine1($addressArray['City']);
147
        $value->setAddressLine1($addressArray['Region']);
148
        $value->setAddressLine1($addressArray['PostalCode']);
149
        $value->setAddressLine1($addressArray['Country']);
150
151
        return $value;
152
    }
153
154
}