Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
ApiKey
85.71% covered (warning)
85.71%
6 / 7
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
5.20
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getHash
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCreatedAt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getExpiresAt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * @author Wilhelm Zwertvaegher
9 */
10#[ORM\Entity]
11#[ORM\Table(name: 'api_key')]
12class ApiKey
13{
14    #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
15    private int $id;
16
17    #[ORM\Column(type: 'string', length: 64, unique: true)]
18    private string $hash;
19
20    #[ORM\Column(type: 'datetime_immutable')]
21    private \DateTimeImmutable $createdAt;
22
23    #[ORM\Column(type: 'datetime_immutable', nullable: true)]
24    private ?\DateTimeImmutable $expiresAt = null;
25
26    public function __construct(string $hash, \DateTimeImmutable $createdAt, ?\DateTimeImmutable $expiresAt = null)
27    {
28        $this->hash = $hash;
29        $this->createdAt = $createdAt;
30        $this->expiresAt = $expiresAt;
31    }
32
33    public function getId(): int
34    {
35        return $this->id;
36    }
37
38    public function getHash(): string
39    {
40        return $this->hash;
41    }
42
43    public function getCreatedAt(): \DateTimeImmutable
44    {
45        return $this->createdAt;
46    }
47
48    public function getExpiresAt(): ?\DateTimeImmutable
49    {
50        return $this->expiresAt;
51    }
52}