Passed
Pull Request — master (#2)
by Andreas
11:41
created

CancelTransaction   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 4
eloc 9
c 0
b 0
f 0
dl 0
loc 27
ccs 5
cts 9
cp 0.5556
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtraOptions() 0 3 1
A __construct() 0 4 1
A getId() 0 3 1
A canCommit() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Larium\Pay\Transaction;
6
7
use Larium\Pay\ParamsBag;
8
9
class CancelTransaction implements Cancel
10
{
11
    use Commit;
12
13
    private $id;
14
15
    private $extraOptions;
16
17 1
    public function __construct($id, array $extraOptions = [])
18
    {
19 1
        $this->id = $id;
20 1
        $this->extraOptions = new ParamsBag($extraOptions);
21
    }
22
23
    public function getId()
24
    {
25
        return $this->id;
26
    }
27
28 1
    public function canCommit()
29
    {
30 1
        return $this->id !== null;
31
    }
32
33
    public function getExtraOptions()
34
    {
35
        return $this->extraOptions;
36
    }
37
}
38