| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class JiraIdentityProviderException extends IdentityProviderException |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Creates client exception from response. |
||
| 12 | * |
||
| 13 | * @param ResponseInterface $response |
||
| 14 | * @param array $data Parsed response data |
||
| 15 | * |
||
| 16 | * @return IdentityProviderException |
||
| 17 | */ |
||
| 18 | public static function clientException(ResponseInterface $response, $data) |
||
| 19 | { |
||
| 20 | return static::fromResponse( |
||
| 21 | $response, |
||
| 22 | isset($data['message']) ? $data['message'] : $response->getReasonPhrase() |
||
| 23 | ); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Creates oauth exception from response. |
||
| 28 | * |
||
| 29 | * @param ResponseInterface $response |
||
| 30 | * @param array $data Parsed response data |
||
| 31 | * |
||
| 32 | * @return IdentityProviderException |
||
| 33 | */ |
||
| 34 | public static function oauthException(ResponseInterface $response, $data) |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Creates identity exception from response. |
||
| 44 | * |
||
| 45 | * @param ResponseInterface $response |
||
| 46 | * @param string $message |
||
| 47 | * |
||
| 48 | * @return IdentityProviderException |
||
| 49 | */ |
||
| 50 | protected static function fromResponse(ResponseInterface $response, $message = null) |
||
| 55 |