Transaction   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 2
cbo 3
dl 0
loc 59
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 3
A hasInvoice() 0 4 1
A hasTransfer() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AcquiroPay\Paymarket\Resources;
6
7
class Transaction extends AbstractResource
8
{
9
    /** @var int */
10
    public $id;
11
12
    /** @var int */
13
    public $merchantId;
14
15
    /** @var int */
16
    public $serviceId;
17
18
    /** @var string */
19
    public $externalId;
20
21
    /** @var string */
22
    public $uuid;
23
24
    /** @var int|float */
25
    public $amount;
26
27
    /** @var array */
28
    public $parameters;
29
30
    /** @var Invoice|null */
31
    public $invoice;
32
33
    /** @var Transfer|null */
34
    public $transfer;
35
36
    /** @var int */
37
    public $status;
38
39
    /** @var string */
40
    public $statusLabel;
41
42
    /** @var string */
43
    public $createdAt;
44
45
    /** @var string */
46
    public $updatedAt;
47
48
    public function __construct(array $attributes)
49
    {
50
        parent::__construct($attributes);
51
52
        $this->invoice = $attributes['invoice'] ? new Invoice($attributes['invoice']) : null;
53
        $this->transfer = $attributes['transfer'] ? new Transfer($attributes['transfer']) : null;
54
    }
55
56
    public function hasInvoice(): bool
57
    {
58
        return (bool) $this->invoice;
59
    }
60
61
    public function hasTransfer(): bool
62
    {
63
        return (bool) $this->transfer;
64
    }
65
}
66