Passed
Pull Request — master (#506)
by Dane
12:05
created

OktaProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkResponse() 0 10 3
1
<?php
2
3
namespace AcquiaCloudApi\Connector;
4
5
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
6
use League\OAuth2\Client\Provider\GenericProvider;
7
use Psr\Http\Message\ResponseInterface;
8
9
class OktaProvider extends GenericProvider
10
{
11
    /**
12
     * @inheritDoc
13
     */
14
    protected function checkResponse(ResponseInterface $response, $data): void
15
    {
16
        if (!empty($data['errorCode'])) {
17
            $error = $data['errorCode'];
18
            if (!is_string($error)) {
19
                $error = var_export($error, true);
20
            }
21
            throw new IdentityProviderException($error, 0, $data);
22
        }
23
        parent::checkResponse($response, $data);
24
    }
25
}
26