Completed
Push — master ( 78e25f...1ef0da )
by Julien
05:38
created

JwtProvider::__construct()   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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Mercure;
4
5
6
use Lcobucci\JWT\Builder;
7
use Lcobucci\JWT\Signer\Hmac\Sha256;
8
9
class JwtProvider
10
{
11
12
    private $key;
13
14
    public function __construct(string $key)
15
    {
16
        $this->key = $key;
17
    }
18
19
    public function __invoke() :string
20
    {
21
        return (new Builder())
22
            ->set('mercure', ['publish' => ['*']])
23
            ->sign(new Sha256(), $this->key)
24
            ->getToken();
25
    }
26
}
27