SocialConnect /
auth
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * SocialConnect project |
||
| 4 | * @author: Patsura Dmitry https://github.com/ovr <[email protected]> |
||
| 5 | */ |
||
| 6 | declare(strict_types=1); |
||
| 7 | |||
| 8 | namespace SocialConnect\OAuth1\Provider; |
||
| 9 | |||
| 10 | use SocialConnect\Common\ArrayHydrator; |
||
| 11 | use SocialConnect\Provider\AccessTokenInterface; |
||
| 12 | use SocialConnect\Provider\Exception\InvalidResponse; |
||
| 13 | use SocialConnect\OAuth1\AbstractProvider; |
||
| 14 | use SocialConnect\Common\Entity\User; |
||
| 15 | |||
| 16 | class Px500 extends AbstractProvider |
||
| 17 | { |
||
| 18 | const NAME = 'px500'; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | */ |
||
| 23 | 2 | public function getBaseUri() |
|
| 24 | { |
||
| 25 | 2 | return 'https://api.500px.com/v1/'; |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * {@inheritdoc} |
||
| 30 | */ |
||
| 31 | 1 | public function getAuthorizeUri() |
|
| 32 | { |
||
| 33 | 1 | return 'https://api.500px.com/v1/oauth/authorize'; |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritdoc} |
||
| 38 | */ |
||
| 39 | 1 | public function getRequestTokenUri() |
|
| 40 | { |
||
| 41 | 1 | return 'https://api.500px.com/v1/oauth/request_token'; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | 1 | public function getRequestTokenAccessUri() |
|
| 48 | { |
||
| 49 | 1 | return 'https://api.500px.com/v1/oauth/access_token'; |
|
| 50 | } |
||
| 51 | |||
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | 1 | public function getName() |
|
| 57 | { |
||
| 58 | 1 | return self::NAME; |
|
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * {@inheritdoc} |
||
| 63 | */ |
||
| 64 | 1 | public function getIdentity(AccessTokenInterface $accessToken) |
|
| 65 | { |
||
| 66 | 1 | $this->consumerToken = $accessToken; |
|
|
0 ignored issues
–
show
|
|||
| 67 | |||
| 68 | 1 | $result = $this->request( |
|
| 69 | 1 | 'GET', |
|
| 70 | 1 | 'users', |
|
| 71 | 1 | [], |
|
| 72 | $accessToken |
||
| 73 | ); |
||
| 74 | |||
| 75 | 1 | if (!isset($result['user']) || !$result['user']) { |
|
| 76 | throw new InvalidResponse( |
||
| 77 | 'API response without user inside JSON' |
||
| 78 | ); |
||
| 79 | } |
||
| 80 | |||
| 81 | 1 | $hydrator = new ArrayHydrator([ |
|
| 82 | 1 | 'id' => 'id', |
|
| 83 | 'name' => 'name', |
||
| 84 | ]); |
||
| 85 | |||
| 86 | 1 | return $hydrator->hydrate(new User(), $result['user']); |
|
| 87 | } |
||
| 88 | } |
||
| 89 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..