JwtProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 5 1
1
<?php
2
3
namespace App\Mercure;
4
5
use Lcobucci\JWT\Builder;
6
use Lcobucci\JWT\Signer\Hmac\Sha256;
7
use Lcobucci\JWT\Signer\Key;
8
9
final class JwtProvider
10
{
11
    private $secret;
12
13
    public function __construct(string $secret)
14
    {
15
        $this->secret = $secret;
16
    }
17
18
    public function __invoke(): string
19
    {
20
        return (new Builder())
21
            ->withClaim('mercure', ['publish' => ['*']])
22
            ->getToken(new Sha256(), new Key($this->secret));
23
    }
24
}
25