Transaction::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 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