| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 33 | 3 | public function checkUserCredentials(IOAuth2Client $client, $username, $password) |
|
| 34 | { |
||
| 35 | 3 | if (!$client instanceof ClientInterface) { |
|
| 36 | 1 | throw new \InvalidArgumentException('Client has to implement the ClientInterface'); |
|
| 37 | } |
||
| 38 | |||
| 39 | 2 | $result = false; |
|
| 40 | try { |
||
| 41 | 2 | $user = $this->userProvider->loadUserByCredentials($username, $password); |
|
| 42 | |||
| 43 | 1 | if (null !== $user) { |
|
| 44 | $result = array( |
||
| 45 | 1 | 'data' => $user, |
|
| 46 | ); |
||
| 47 | } |
||
| 48 | 1 | } catch (AuthenticationException $e) { |
|
| 49 | 1 | $result = false; |
|
| 50 | } |
||
| 51 | |||
| 52 | 2 | return $result; |
|
| 53 | } |
||
| 54 | } |
||
| 55 |