Passed
Push — master ( 80df18...80df18 )
by Dāvis
04:16
created

BaseProvider::createAccessToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sludio\HelperBundle\Openidconnect\Provider;
4
5
use League\OAuth2\Client\Provider\AbstractProvider;
6
use League\OAuth2\Client\Grant\AbstractGrant;
7
8
abstract class BaseProvider extends AbstractProvider
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function getAccessToken($grant, array $options = [])
14
    {
15
        $grant = $this->verifyGrant($grant);
16
17
        $params = [
18
            'redirect_uri'  => $this->redirectUri,
19
        ];
20
21
        $params   = $grant->prepareRequestParameters($params, $options);
22
        $request  = $this->getAccessTokenRequest($params);
23
        $response = $this->getResponse($request);
24
        $prepared = $this->prepareAccessTokenResponse($response);
0 ignored issues
show
Bug introduced by
$response of type Psr\Http\Message\ResponseInterface is incompatible with the type array expected by parameter $result of League\OAuth2\Client\Pro...reAccessTokenResponse(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
        $prepared = $this->prepareAccessTokenResponse(/** @scrutinizer ignore-type */ $response);
Loading history...
25
26
        return $this->createAccessToken($prepared, $grant);
27
    }
28
29
    protected function createAccessToken(array $response, AbstractGrant $grant)
30
    {
31
        return new AccessToken($response);
32
    }
33
}
34