Member   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 15
c 2
b 0
f 0
dl 0
loc 37
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromResponse() 0 10 1
A getBirthDate() 0 3 1
A getLastName() 0 3 1
A getFirstName() 0 3 1
A getId() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Eekes\VblApi\Entity;
5
6
class Member
7
{
8
    private string $id;
9
    private ?string $lastName;
10
    private ?string $firstName;
11
    private ?\DateTimeImmutable $birthDate;
12
13
    public static function createFromResponse(\stdClass $response): self
14
    {
15
        $member = new self();
16
17
        $member->id = $response->relGuid;
18
        $member->lastName = $response->naam;
19
        $member->firstName = $response->vnaam;
20
        $member->birthDate = \DateTimeImmutable::createFromFormat('d-m-Y', $response->gebdat);
21
22
        return $member;
23
    }
24
25
    public function getId(): string
26
    {
27
        return $this->id;
28
    }
29
30
    public function getLastName(): ?string
31
    {
32
        return $this->lastName;
33
    }
34
35
    public function getFirstName(): ?string
36
    {
37
        return $this->firstName;
38
    }
39
40
    public function getBirthDate(): ?\DateTimeImmutable
41
    {
42
        return $this->birthDate;
43
    }
44
}