Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
58.82% covered (warning)
58.82%
10 / 17
85.71% covered (warning)
85.71%
6 / 7
CRAP
0.00% covered (danger)
0.00%
0 / 1
Person
58.82% covered (warning)
58.82%
10 / 17
85.71% covered (warning)
85.71%
6 / 7
10.42
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getToken
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCode
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getNameSuffix
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getValidTo
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 withNewToken
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/** @noinspection PhpUnhandledExceptionInspection */
3declare(strict_types=1);
4
5class Person extends DataCollectionTypeSafe {
6
7    protected int $id = 0;
8    protected string $token = "";
9    protected string $code = "";
10    protected string $nameSuffix = "";
11
12    protected $validTo = 0;
13
14    function __construct(
15        int $id,
16        string $token,
17        string $code,
18        string $nameSuffix,
19        int $validTo = 0
20    ) {
21
22        $this->id = $id;
23        $this->token  = $token;
24        $this->code = $code;
25        $this->nameSuffix = $nameSuffix;
26        $this->validTo = $validTo;
27    }
28
29
30    public function getId(): int {
31
32        return $this->id;
33    }
34
35
36    public function getToken(): string {
37
38        return $this->token;
39    }
40
41
42    public function getCode(): string {
43
44        return $this->code;
45    }
46
47
48    public function getNameSuffix(): string {
49
50        return $this->nameSuffix;
51    }
52
53
54
55    public function getValidTo(): int {
56
57        return $this->validTo;
58    }
59
60
61    public function withNewToken(string $token): Person {
62
63        return new Person(
64            $this->id,
65            $token,
66            $this->code,
67            $this->nameSuffix,
68            $this->validTo
69        );
70    }
71}