AccessToken::convertToJWT()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
4
namespace Mvdstam\Oauth2ServerLaravel\Entities;
5
6
7
use League\OAuth2\Server\CryptKey;
8
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
9
use Mvdstam\Oauth2ServerLaravel\Contracts\JWTFactoryInterface;
10
11
/**
12
 * @inheritdoc
13
 * Class AccessToken
14
 */
15
class AccessToken extends AbstractToken implements AccessTokenEntityInterface
16
{
17
18
    /**
19
     * @inheritdoc
20
     */
21 11
    public function convertToJWT(CryptKey $privateKey)
22
    {
23
        /** @var JWTFactoryInterface $jwtService */
24 11
        $jwtFactory = app(JWTFactoryInterface::class);
25
26 11
        return (string) $jwtFactory->getForAccessToken($this, $privateKey);
27
    }
28
29
}
30