JwtAccessToken   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 3 1
A __construct() 0 3 2
1
<?php
2
3
namespace Parroauth2\Client\Extension\JwtAccessToken;
4
5
use Parroauth2\Client\Client;
6
use Parroauth2\Client\ClientInterface;
7
use Parroauth2\Client\Extension\ExtensionInterface;
8
9
/**
10
 * Enable JWT access token handling for introspection
11
 */
12
final class JwtAccessToken implements ExtensionInterface
13
{
14
    /**
15
     * @var JwtParserInterface
16
     */
17
    private $parser;
18
19
    /**
20
     * JwtAccessToken constructor.
21
     *
22
     * @param JwtParserInterface|null $parser
23
     */
24 1
    public function __construct(JwtParserInterface $parser = null)
25
    {
26 1
        $this->parser = $parser ?: new JwtParser();
27 1
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    public function configure(ClientInterface $client): void
33
    {
34 1
        $client->endPoints()->add(new LocalIntrospectionEndPoint($client, $this->parser));
35 1
    }
36
}
37