TokenUsage::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 3
crap 2
1
<?php
2
3
namespace Yokai\SecurityTokenBundle\Entity;
4
5
use DateTime;
6
7
class TokenUsage
8
{
9
    /**
10
     * @var int
11
     */
12
    private $id;
13
14
    /**
15
     * @var Token
16
     */
17
    private $token;
18
19
    /**
20
     * @var DateTime
21
     */
22
    private $createdAt;
23
24
    /**
25
     * @var array
26
     */
27
    private $information = [];
28
29
    /**
30
     * @param Token    $token
31
     * @param array    $information
32
     * @param DateTime $createdAt
0 ignored issues
show
Documentation introduced by
Should the type for parameter $createdAt not be null|DateTime?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
33
     */
34 5
    public function __construct(Token $token, array $information, DateTime $createdAt = null)
35
    {
36 5
        $this->token = $token;
37 5
        $this->information = $information;
38 5
        $this->createdAt = $createdAt ?: new DateTime();
39 5
    }
40
41
    /**
42
     * @return int
43
     */
44
    public function getId()
45
    {
46
        return $this->id;
47
    }
48
49
    /**
50
     * @return Token
51
     */
52
    public function getToken()
53
    {
54
        return $this->token;
55
    }
56
57
    /**
58
     * @return DateTime
59
     */
60 1
    public function getCreatedAt()
61
    {
62 1
        return $this->createdAt;
63
    }
64
65
    /**
66
     * @return array
67
     */
68 3
    public function getInformation()
69
    {
70 3
        return $this->information;
71
    }
72
}
73