Test Failed
Push — main ( 60b477...a1ddf7 )
by Chema
14:12 queued 10:45
created

InvoiceExtraTransfer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 4
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpLightning\Shared\Transfer;
6
7
final class InvoiceExtraTransfer
8
{
9
    public function __construct(
10
        public string $walletFiatCurrency,
11
        public float $walletFiatAmount,
12
        public float $walletFiatRate,
13
        public float $walletBtcRate,
14
    ) {
15
    }
16
17
    public static function fromArray(array $array): self
18
    {
19
        return new self(
20
            walletFiatCurrency: (string) $array['wallet_fiat_currency'],
21
            walletFiatAmount: (float) $array['wallet_fiat_amount'],
22
            walletFiatRate: (float) $array['wallet_fiat_rate'],
23
            walletBtcRate: (float) $array['wallet_btc_rate'],
24
        );
25
    }
26
}
27