GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CurrencyInfo::currencyCodeA()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Monobank\Response\Model;
6
7
final class CurrencyInfo
8
{
9
    /**
10
     * @var int
11
     */
12
    private $currencyCodeA;
13
14
    /**
15
     * @var int
16
     */
17
    private $currencyCodeB;
18
19
    /**
20
     * @var int
21
     */
22
    private $date;
23
24
    /**
25
     * @var float
26
     */
27
    private $rateSell;
28
29
    /**
30
     * @var float|null
31
     */
32
    private $rateBuy;
33
34
    /**
35
     * @var float|null
36
     */
37
    private $rateCross;
38
39
    public function __construct(
40
        int $currencyCodeA,
41
        int $currencyCodeB,
42
        int $date,
43
        ?float $rateSell = null,
44
        ?float $rateBuy = null,
45
        ?float $rateCross = null
46
    ) {
47
        $this->currencyCodeA = $currencyCodeA;
48
        $this->currencyCodeB = $currencyCodeB;
49
        $this->date = $date;
50
        $this->rateSell = $rateSell;
51
        $this->rateBuy = $rateBuy;
52
        $this->rateCross = $rateCross;
53
    }
54
55
    public static function fromResponse(array $data)
56
    {
57
        return new self(
58
            $data['currencyCodeA'],
59
            $data['currencyCodeB'],
60
            $data['date'],
61
            $data['rateSell'] ?? null,
62
            $data['rateBuy'] ?? null,
63
            $data['rateCross'] ?? null
64
        );
65
    }
66
67
    public function currencyCodeA(): int
68
    {
69
        return $this->currencyCodeA;
70
    }
71
72
    public function currencyCodeB(): int
73
    {
74
        return $this->currencyCodeB;
75
    }
76
77
    public function date(): \DateTime
78
    {
79
        return (new \DateTime())->setTimestamp($this->date);
80
    }
81
82
    public function rateSell(): ?float
83
    {
84
        return $this->rateSell;
85
    }
86
87
    public function rateBuy(): ?float
88
    {
89
        return $this->rateBuy;
90
    }
91
92
    public function rateCross(): ?float
93
    {
94
        return $this->rateCross;
95
    }
96
}
97