1 | <?php |
||
9 | class UserResponse extends AbstractResponse implements UserInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var null|string |
||
13 | */ |
||
14 | protected $firstName; |
||
15 | |||
16 | /** |
||
17 | * @var null|string |
||
18 | */ |
||
19 | protected $lastName; |
||
20 | |||
21 | /** |
||
22 | * @var null|string |
||
23 | */ |
||
24 | protected $profilePic; |
||
25 | |||
26 | /** |
||
27 | * @var null|string |
||
28 | */ |
||
29 | protected $locale; |
||
30 | |||
31 | /** |
||
32 | * @var null|int |
||
33 | */ |
||
34 | protected $timezone; |
||
35 | |||
36 | /** |
||
37 | * @var null|string |
||
38 | */ |
||
39 | protected $gender; |
||
40 | |||
41 | /** |
||
42 | * @var null|bool |
||
43 | */ |
||
44 | protected $paymentEnabled; |
||
45 | |||
46 | /** |
||
47 | * @var null|\Kerox\Messenger\Model\Referral |
||
48 | */ |
||
49 | protected $lastAdReferral; |
||
50 | |||
51 | /** |
||
52 | * UserProfileResponse constructor. |
||
53 | * |
||
54 | * @param \Psr\Http\Message\ResponseInterface $response |
||
55 | */ |
||
56 | 2 | public function __construct(ResponseInterface $response) |
|
57 | { |
||
58 | 2 | parent::__construct($response); |
|
59 | 2 | } |
|
60 | |||
61 | /** |
||
62 | * @param array $response |
||
63 | */ |
||
64 | 2 | protected function parseResponse(array $response) |
|
65 | { |
||
66 | 2 | $this->firstName = $response[self::FIRST_NAME] ?? null; |
|
67 | 2 | $this->lastName = $response[self::LAST_NAME] ?? null; |
|
68 | 2 | $this->profilePic = $response[self::PROFILE_PIC] ?? null; |
|
69 | 2 | $this->profilePic = $response[self::PROFILE_PIC] ?? null; |
|
70 | 2 | $this->locale = $response[self::LOCALE] ?? null; |
|
71 | 2 | $this->timezone = $response[self::TIMEZONE] ?? null; |
|
72 | 2 | $this->gender = $response[self::GENDER] ?? null; |
|
73 | 2 | $this->paymentEnabled = $response[self::IS_PAYMENT_ENABLED] ?? null; |
|
74 | |||
75 | 2 | $this->setLastAdReferral($response); |
|
76 | 2 | } |
|
77 | |||
78 | /** |
||
79 | * @return null|string |
||
80 | */ |
||
81 | 1 | public function getFirstName() |
|
85 | |||
86 | /** |
||
87 | * @return null|string |
||
88 | */ |
||
89 | 1 | public function getLastName() |
|
93 | |||
94 | /** |
||
95 | * @return null|string |
||
96 | */ |
||
97 | 1 | public function getProfilePic() |
|
101 | |||
102 | /** |
||
103 | * @return null|string |
||
104 | */ |
||
105 | 1 | public function getLocale() |
|
109 | |||
110 | /** |
||
111 | * @return null|int |
||
112 | */ |
||
113 | 1 | public function getTimezone() |
|
117 | |||
118 | /** |
||
119 | * @return null|string |
||
120 | */ |
||
121 | 1 | public function getGender() |
|
125 | |||
126 | /** |
||
127 | * @return null|bool |
||
128 | */ |
||
129 | 1 | public function isPaymentEnabled() |
|
133 | |||
134 | /** |
||
135 | * @return null|\Kerox\Messenger\Model\Referral |
||
136 | */ |
||
137 | 1 | public function getLastAdReferral() |
|
141 | |||
142 | /** |
||
143 | * @param array $response |
||
144 | */ |
||
145 | 2 | private function setLastAdReferral(array $response) |
|
151 | } |
||
152 |