1 | <?php |
||
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() |
|
54 | |||
55 | /** |
||
56 | * @return integer |
||
57 | */ |
||
58 | 1 | public function getTtl() |
|
62 | |||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | 1 | public function getAlgorithm() |
|
70 | |||
71 | /** |
||
72 | * @return integer |
||
73 | */ |
||
74 | 1 | public function getTimestamp() |
|
78 | |||
79 | /** |
||
80 | * @return string|null |
||
81 | */ |
||
82 | 1 | public function getPrivateKey() |
|
86 | } |
||
87 |