MembershipDto   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 56
rs 10
wmc 8

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A membershipStatus() 0 3 1
A targetId() 0 3 1
A hourlyRate() 0 3 1
A userId() 0 3 1
A fromArray() 0 8 2
A membershipType() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JDecool\Clockify\Model;
6
7
class MembershipDto
8
{
9
    private $hourlyRate;
10
    private $membershipStatus;
11
    private $membershipType;
12
    private $targetId;
13
    private $userId;
14
15
    public static function fromArray(array $data): self
16
    {
17
        return new self(
18
            $data['hourlyRate'] ? HourlyRateDto::fromArray($data['hourlyRate']) : null,
19
            new MembershipEnum($data['membershipStatus']),
20
            $data['membershipType'],
21
            $data['targetId'],
22
            $data['userId']
23
        );
24
    }
25
26
    public function __construct(
27
        ?HourlyRateDto $hourlyRate,
28
        MembershipEnum $membershipStatus,
29
        string $membershipType,
30
        string $targetId,
31
        string $userId
32
    ) {
33
        $this->hourlyRate = $hourlyRate;
34
        $this->membershipStatus = $membershipStatus;
35
        $this->membershipType = $membershipType;
36
        $this->targetId = $targetId;
37
        $this->userId = $userId;
38
    }
39
40
    public function hourlyRate(): ?HourlyRateDto
41
    {
42
        return $this->hourlyRate;
43
    }
44
45
    public function membershipStatus(): MembershipEnum
46
    {
47
        return $this->membershipStatus;
48
    }
49
50
    public function membershipType(): string
51
    {
52
        return $this->membershipType;
53
    }
54
55
    public function targetId(): string
56
    {
57
        return $this->targetId;
58
    }
59
60
    public function userId(): string
61
    {
62
        return $this->userId;
63
    }
64
}
65