UserVerificationData   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 35
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A toArrayForDatabase() 0 9 1
1
<?php
2
3
namespace App\Module\Authentication\Data;
4
5
class UserVerificationData
6
{
7
    public ?int $id;
8
    public ?int $userId;
9
    public ?string $token;
10
    public ?int $expiresAt;
11
    public ?string $usedAt = null;
12
    public ?string $createdAt;
13
14 16
    public function __construct(array $verificationData = [])
15
    {
16 16
        $this->id = $verificationData['id'] ?? null;
17 16
        $this->userId = $verificationData['user_id'] ?? null;
18 16
        $this->token = $verificationData['token'] ?? null;
19 16
        $this->expiresAt = $verificationData['expires_at'] ?? null;
20 16
        $this->usedAt = $verificationData['used_at'] ?? null;
21 16
        $this->createdAt = $verificationData['created_at'] ?? null;
22
    }
23
24
    /**
25
     * Returns values of object as array for database.
26
     *
27
     * The array keys MUST match with the database column names.
28
     *
29
     * @return array
30
     */
31 17
    public function toArrayForDatabase(): array
32
    {
33 17
        return [
34 17
            'id' => $this->id,
35 17
            'user_id' => $this->userId,
36 17
            'token' => $this->token,
37 17
            'expires_at' => $this->expiresAt,
38 17
            'used_at' => $this->usedAt,
39 17
            'created_at' => $this->createdAt,
40 17
        ];
41
    }
42
}
43