Completed
Push — Lonja/albertc ( 7a2bf6 )
by Albert
20:41 queued 16:20
created

Price   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 29
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A instance() 0 4 1
A amount() 0 4 1
A currency() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kata\Domain\Common\ValueObject;
6
7
class Price
8
{
9
    /** @var float  */
10
    private $amount;
11
12
    /** @var string  */
13
    private $currency;
14
15
    public function __construct(float $amount, string $currency)
16
    {
17
        $this->amount = $amount;
18
        $this->currency = $currency;
19
    }
20
21
    public static function instance(float $amount, string $currency): Price
22
    {
23
        return new self($amount, $currency);
24
    }
25
26
    public function amount(): float
27
    {
28
        return $this->amount;
29
    }
30
31
    public function currency(): string
32
    {
33
        return $this->currency;
34
    }
35
}
36