Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
46 | public function profileData(): array |
||
47 | { |
||
48 | $profileId = ArrayHelper::getValue($this->profile, 'id'); |
||
49 | $photoUrl = 'https://graph.facebook.com/' . $profileId . '/picture?width=500&redirect=false'; |
||
50 | $photoRes = json_decode(file_get_contents($photoUrl)); |
||
51 | |||
52 | if (is_object($photoRes) && isset($photoRes->data)) { |
||
53 | $photo = $photoRes->data->url; |
||
54 | } else { |
||
55 | $photo = ArrayHelper::getValue($this->profile, 'picture.data.url', ''); |
||
56 | } |
||
57 | |||
58 | return [ |
||
59 | 'full_name' => trim(ArrayHelper::getValue($this->profile, 'name')), |
||
60 | 'photo' => $photo |
||
61 | ]; |
||
62 | } |
||
63 | } |
||
64 |