Completed
Push — master ( 60aec0...f632bc )
by Andreas
12:47 queued 10:41
created

TransferTransaction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1.037

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 4
cts 6
cp 0.6667
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 4
crap 1.037
1
<?php
2
3
namespace Larium\Pay\Transaction;
4
5
use Larium\Pay\ParamsBag;
6
7
class TransferTransaction implements Transfer
8
{
9
    use Commit;
10
11
    private $amount = 0;
12
13
    private $currency = '';
14
15
    private $recipientIdentifier;
16
17
    private $extraOptions;
18
19 1
    public function __construct(
20
        $amount,
21
        $currency,
22
        $recipientIdentifier,
23
        array $extraOptions = []
24
    ) {
25 1
        $this->amount = $amount;
26 1
        $this->currency = $currency;
27 1
        $this->recipientIdentifier = $recipientIdentifier;
28
        $this->extraOptions = new ParamsBag($extraOptions);
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getAmount()
35
    {
36
        return $this->amount;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getCurrency()
43
    {
44
        return $this->currency;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getRecipientIdentifier()
51
    {
52
        return $this->recipientIdentifier;
53
    }
54
55
    public function canCommit()
56
    {
57
        return $this->amount > 0
58
            && !empty($this->recipientIdentifier);
59
    }
60
61
    public function getExtraOptions()
62
    {
63
        return $this->extraOptions;
64
    }
65
}
66