Configuration   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 83
ccs 17
cts 17
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getPublicKey() 0 4 1
A getTtl() 0 4 1
A getAlgorithm() 0 4 1
A getTimestamp() 0 4 1
A getPrivateKey() 0 4 1
A __construct() 0 8 2
1
<?php
2
namespace Equip\Auth\Jwt;
3
4
class Configuration
5
{
6
    /**
7
     * @var string
8
     */
9
    private $publicKey;
10
11
    /**
12
     * @var integer
13
     */
14
    private $ttl;
15
16
    /**
17
     * @var string
18
     */
19
    private $algorithm;
20
21
    /**
22
     * @var integer
23
     */
24
    private $timestamp;
25
26
    /**
27
     * @var string
28
     */
29
    private $privateKey;
30
31
    /**
32
     * @param string $publicKey Public key used to sign the token
33
     * @param integer $ttl Time-to-live for the token, in seconds
34
     * @param string $algorithm
35
     * @param integer $timestamp UNIX timestamp used for token issuance and expiration
36
     * @param string $privateKey Private key used to sign the token
37
     */
38 1
    public function __construct($publicKey, $ttl, $algorithm, $timestamp = null, $privateKey = null)
39
    {
40 1
        $this->publicKey = (string) $publicKey;
41 1
        $this->ttl = (int) $ttl;
42 1
        $this->algorithm = (string) $algorithm;
43 1
        $this->timestamp = $timestamp ? (int) $timestamp : time();
44 1
        $this->privateKey = (string) $privateKey;
45 1
    }
46
47
    /**
48
     * @return string
49
     */
50 1
    public function getPublicKey()
51
    {
52 1
        return $this->publicKey;
53
    }
54
55
    /**
56
     * @return integer
57
     */
58 1
    public function getTtl()
59
    {
60 1
        return $this->ttl;
61
    }
62
63
    /**
64
     * @return string
65
     */
66 1
    public function getAlgorithm()
67
    {
68 1
        return $this->algorithm;
69
    }
70
71
    /**
72
     * @return integer
73
     */
74 1
    public function getTimestamp()
75
    {
76 1
        return $this->timestamp;
77
    }
78
79
    /**
80
     * @return string|null
81
     */
82 1
    public function getPrivateKey()
83
    {
84 1
        return $this->privateKey;
85
    }
86
}
87