Skip to content

Commit

Permalink
Fix a bug with no LinkedIn image
Browse files Browse the repository at this point in the history
When a person hasn't got an image set for their account its images won't be returned as an array. We'll now default to an empty array.

Fixes #328
  • Loading branch information
driesvints committed Jan 21, 2019
1 parent c51c740 commit 81adfcc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Two/LinkedInProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected function getEmailAddress($token)
protected function mapUserToObject(array $user)
{
$name = Arr::get($user, 'firstName.localized.en_US').' '.Arr::get($user, 'lastName.localized.en_US');
$images = Arr::get($user, 'profilePicture.displayImage~.elements');
$images = (array) Arr::get($user, 'profilePicture.displayImage~.elements', []);
$avatar = Arr::first(Arr::where($images, function ($image) {
return $image['data']['com.linkedin.digitalmedia.mediaartifact.StillImage']['storageSize']['width'] === 100;
}));
Expand Down

0 comments on commit 81adfcc

Please sign in to comment.