Total Complexity | 8 |
Total Lines | 82 |
Duplicated Lines | 0 % |
Coverage | 18.52% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class InitialTransaction implements Initial |
||
10 | { |
||
11 | use Commit; |
||
12 | |||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | private $amount = 0; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $currency = ''; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $successUri; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $cancelUri; |
||
32 | |||
33 | /** |
||
34 | * @var ParamsBag |
||
35 | */ |
||
36 | private $extraOptions; |
||
37 | |||
38 | 1 | public function __construct( |
|
39 | $amount, |
||
40 | $successUri, |
||
41 | $cancelUri, |
||
42 | array $extraOptions = [] |
||
43 | ) { |
||
44 | 1 | $this->amount = $amount; |
|
45 | 1 | $this->cancelUri = $cancelUri; |
|
46 | 1 | $this->successUri = $successUri; |
|
47 | 1 | $this->extraOptions = new ParamsBag($extraOptions); |
|
48 | } |
||
49 | |||
50 | public function getAmount() |
||
51 | { |
||
52 | return $this->amount; |
||
53 | } |
||
54 | |||
55 | public function getSuccessUri() |
||
56 | { |
||
57 | return $this->successUri; |
||
58 | } |
||
59 | |||
60 | public function getCancelUri() |
||
61 | { |
||
62 | return $this->cancelUri; |
||
63 | } |
||
64 | |||
65 | public function canCommit() |
||
66 | { |
||
67 | return 4 === count( |
||
68 | array_filter([ |
||
69 | $this->amount, |
||
70 | $this->currency, |
||
71 | $this->successUri, |
||
72 | $this->cancelUri, |
||
73 | ], 'strlen') |
||
74 | ); |
||
75 | } |
||
76 | |||
77 | public function getExtraOptions() |
||
80 | } |
||
81 | |||
82 | public function setCurrency($currency) |
||
83 | { |
||
84 | $this->allowChanges(); |
||
85 | $this->currency = $currency; |
||
86 | } |
||
87 | |||
88 | public function getCurrency() |
||
91 | } |
||
92 | } |
||
93 |