Total Complexity | 7 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | class Player |
||
7 | { |
||
8 | private string $id; |
||
9 | private string $name; |
||
10 | private ?string $membershipNumber; |
||
11 | private ?\DateTimeImmutable $birthDate; |
||
12 | private ?\DateTimeImmutable $affiliationDate; |
||
13 | |||
14 | public static function createFromResponse(\stdClass $response): self |
||
15 | { |
||
16 | $player = new self(); |
||
17 | |||
18 | $player->id = $response->relGuid; |
||
19 | $player->name = $response->naam; |
||
20 | $player->membershipNumber = $response->lidNr; |
||
21 | $player->birthDate = \DateTimeImmutable::createFromFormat('d-m-Y', $response->sGebDat); |
||
22 | $player->affiliationDate = \DateTimeImmutable::createFromFormat('d-m-Y H:i', $response->sAanslDat) ?: null; |
||
23 | |||
24 | return $player; |
||
25 | } |
||
26 | |||
27 | public function getId(): string |
||
30 | } |
||
31 | |||
32 | public function getName(): string |
||
35 | } |
||
36 | |||
37 | public function getMembershipNumber(): ?string |
||
38 | { |
||
39 | return $this->membershipNumber; |
||
40 | } |
||
41 | |||
42 | public function getBirthDate(): ?\DateTimeImmutable |
||
45 | } |
||
46 | |||
47 | public function getAffiliationDate(): ?\DateTimeImmutable |
||
50 | } |
||
51 | } |