Configuration::getTtl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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