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

CashPayment::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 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