Passed
Push — master ( b6e1f4...929753 )
by Jérémy
01:51
created

EstimateDto::fromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JDecool\Clockify\Model;
6
7
class EstimateDto
8
{
9
    private $estimate;
10
    private $type;
11
12
    public static function fromArray(array $data): self
13
    {
14
        return new self(
15
            $data['estimate'],
16
            new EstimateType($data['type'])
17
        );
18
    }
19
20
    public function __construct(string $estimate, EstimateType $type)
21
    {
22
        $this->estimate = $estimate;
23
        $this->type = $type;
24
    }
25
26
    public function estimate(): string
27
    {
28
        return $this->estimate;
29
    }
30
31
    public function type(): EstimateType
32
    {
33
        return $this->type;
34
    }
35
}
36