CreatesJwtTokens::createToken()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
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