JwtAccessToken::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
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