diff --git a/src/Providers/Custom/LinkedIn/Provider/Exception/LinkedInAccessDeniedException .php b/src/Providers/Custom/LinkedIn/Provider/Exception/LinkedInAccessDeniedException .php index d332ece..5e9d328 100644 --- a/src/Providers/Custom/LinkedIn/Provider/Exception/LinkedInAccessDeniedException .php +++ b/src/Providers/Custom/LinkedIn/Provider/Exception/LinkedInAccessDeniedException .php @@ -1,8 +1,16 @@ response = $response; $this->setSortedProfilePictures(); @@ -54,7 +62,7 @@ public function getAttribute($key) } /** - * Get user first name + * Get user first name. * * @return string|null */ @@ -64,7 +72,7 @@ public function getFirstName() } /** - * Get user user id + * Get user user id. * * @return string|null */ @@ -74,9 +82,10 @@ public function getId() } /** - * Get specific image by size + * Get specific image by size. + * + * @param int $size * - * @param integer $size * @return array|null */ public function getImageBySize($size) @@ -89,7 +98,7 @@ public function getImageBySize($size) } /** - * Get available user image sizes + * Get available user image sizes. * * @return array */ @@ -101,7 +110,7 @@ public function getImageSizes() } /** - * Get user image url + * Get user image url. * * @return string|null */ @@ -114,7 +123,7 @@ public function getImageUrl() } /** - * Get user last name + * Get user last name. * * @return string|null */ @@ -134,7 +143,7 @@ public function getSortedProfilePictures() } /** - * Get user url + * Get user url. * * @return string|null */ @@ -146,7 +155,7 @@ public function getUrl() } /** - * Get user email, if available + * Get user email, if available. * * @return string|null */ @@ -170,13 +179,13 @@ private function setSortedProfilePictures() return isset($element['data']['com.linkedin.digitalmedia.mediaartifact.StillImage']) && strtoupper($element['authorizationMethod']) === 'PUBLIC' - && isset($element['identifiers'][0]['identifier']) - ; + && isset($element['identifiers'][0]['identifier']); }); // order images by width, LinkedIn profile pictures are always squares, so that should be good enough usort($pictures, function ($elementA, $elementB) { $wA = $elementA['data']['com.linkedin.digitalmedia.mediaartifact.StillImage']['storageSize']['width']; $wB = $elementB['data']['com.linkedin.digitalmedia.mediaartifact.StillImage']['storageSize']['width']; + return $wA - $wB; }); $pictures = array_map(function ($element) { @@ -184,9 +193,10 @@ private function setSortedProfilePictures() $url = $element['identifiers'][0]['identifier']; $type = $element['identifiers'][0]['mediaType']; $width = $element['data']['com.linkedin.digitalmedia.mediaartifact.StillImage']['storageSize']['width']; + return [ - 'width' => $width, - 'url' => $url, + 'width' => $width, + 'url' => $url, 'contentType' => $type, ]; }, $pictures); diff --git a/src/Providers/Custom/LinkedIn/Token/LinkedInAccessToken.php b/src/Providers/Custom/LinkedIn/Token/LinkedInAccessToken.php index 54b2e87..60efb26 100644 --- a/src/Providers/Custom/LinkedIn/Token/LinkedInAccessToken.php +++ b/src/Providers/Custom/LinkedIn/Token/LinkedInAccessToken.php @@ -1,5 +1,14 @@