Key::identity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Key;
6
7
final class Key
8
{
9
    private $key;
10
    private $identity;
11
    private $ttl;
12
13
    public function __construct(string $key, string $identity, int $ttl)
14
    {
15
        $this->key = $key;
16
        $this->identity = $identity;
17
        $this->ttl = $ttl > 0 ? $ttl : 0;
18
    }
19
20
    public function key(): string
21
    {
22
        return $this->key;
23
    }
24
25
    public function identity(): string
26
    {
27
        return $this->identity;
28
    }
29
30
    public function ttl(): int
31
    {
32
        return $this->ttl;
33
    }
34
35
    public function expired(): bool
36
    {
37
        return !$this->ttl();
38
    }
39
40
    public function __toString(): string
41
    {
42
        return $this->key;
43
    }
44
}
45