HeadHunterException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A errorResponse() 0 13 2
1
<?php
2
3
namespace AlexMasterov\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
6
use Psr\Http\Message\ResponseInterface;
7
8
class HeadHunterException extends IdentityProviderException
9
{
10 1
    public static function errorResponse(ResponseInterface $response, $data): HeadHunterException
11
    {
12 1
        $message = $data['error'];
13
14 1
        if (!empty($data['error_description'])) {
15 1
            $message .= ': ' . $data['error_description'];
16
        }
17
18 1
        $code = $response->getStatusCode();
19 1
        $body = (string) $response->getBody();
20
21 1
        return new static($message, $code, $body);
22
    }
23
}
24