Passed
Push — master ( 9ff768...b736eb )
by Laurens
02:33
created

CashPayment   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getHandedAmount() 0 4 1
A getChangeAmount() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\IzettleApi\API\Purchase\Payment;
6
7
use LauLamanApps\IzettleApi\API\Purchase\AbstractPayment;
8
use Money\Money;
9
use Ramsey\Uuid\UuidInterface;
10
11
final class CashPayment extends AbstractPayment
12
{
13
    private $handedAmount;
14
15 6
    public function __construct(UuidInterface $uuid, Money $amount, Money $handedAmount)
16
    {
17 6
        parent::__construct($uuid, $amount);
18 6
        $this->handedAmount = $handedAmount;
19 6
    }
20
21 1
    public function getHandedAmount(): Money
22
    {
23 1
        return $this->handedAmount;
24
    }
25
26 4
    public function getChangeAmount(): Money
27
    {
28 4
        return $this->handedAmount->subtract($this->getAmount());
29
    }
30
}
31