| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2.0078 |
| Changes | 0 | ||
| 1 | <?php |
||
| 64 | 3 | public function getIdentity(AccessTokenInterface $accessToken) |
|
| 65 | { |
||
| 66 | 3 | $response = $this->request('GET', 'api/users.identity', [], $accessToken); |
|
| 67 | |||
| 68 | 1 | if (!$response['ok']) { |
|
| 69 | throw new InvalidResponse( |
||
| 70 | 'API response->ok is false' |
||
| 71 | ); |
||
| 72 | } |
||
| 73 | |||
| 74 | 1 | $hydrator = new ArrayHydrator([ |
|
| 75 | 'id' => 'id', |
||
| 76 | 'name' => 'name', |
||
| 77 | ]); |
||
| 78 | |||
| 79 | 1 | $user = $hydrator->hydrate(new User(), $response['user']); |
|
| 80 | 1 | $user->team = $response['team']; |
|
| 81 | |||
| 82 | 1 | return $user; |
|
| 83 | } |
||
| 85 |