| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.054 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 64 | 1 | public function getIdentity(AccessTokenInterface $accessToken) |
|
| 65 | { |
||
| 66 | 1 | $result = $this->request( |
|
| 67 | 1 | 'GET', |
|
| 68 | 1 | 'users', |
|
| 69 | 1 | [], |
|
| 70 | $accessToken |
||
| 71 | ); |
||
| 72 | |||
| 73 | 1 | if (!isset($result['user']) || !$result['user']) { |
|
| 74 | throw new InvalidResponse( |
||
| 75 | 'API response without user inside JSON' |
||
| 76 | ); |
||
| 77 | } |
||
| 78 | |||
| 79 | 1 | $hydrator = new ArrayHydrator([ |
|
| 80 | 1 | 'id' => 'id', |
|
| 81 | 'name' => 'name', |
||
| 82 | ]); |
||
| 83 | |||
| 84 | 1 | return $hydrator->hydrate(new User(), $result['user']); |
|
| 85 | } |
||
| 87 |