CreatesJwtTokens   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createToken() 0 9 1
1
<?php
2
3
/*
4
 * This file is part of UnMarkDocs.
5
 *
6
 * Copyright (c) Miguel Piedrafita - All Rights Reserved
7
 *
8
 * Unauthorized copying of this file, via any medium is strictly prohibited
9
 * Proprietary and confidential
10
 * Written by Miguel Piedrafita <[email protected]>
11
 */
12
13
namespace M1guelpf\Integration;
14
15
use Lcobucci\JWT\Token;
16
use Lcobucci\JWT\Builder as JWT;
17
use Lcobucci\JWT\Signer\Rsa\Sha256;
18
19
trait CreatesJwtTokens
20
{
21
    /**
22
     * Create a new JWT token.
23
     *
24
     * @return JWT
25
     */
26
    protected function createToken() : Token
27
    {
28
        return (new JWT)
29
             ->setIssuer(config('github.application.id'))
30
             ->setIssuedAt(time())
31
             ->setExpiration(time() + 60)
32
             ->sign(new Sha256(), config('github.application.pem'))
33
             ->getToken();
34
    }
35
}
36