PaymentCard::getNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Personnage\Tinkoff\SDK;
4
5
final class PaymentCard
6
{
7
    /**
8
     * @var string
9
     */
10
    private $id;
11
    /**
12
     * @var string
13
     */
14
    private $number;
15
    /**
16
     * @var \DateTimeInterface
17
     */
18
    private $expired;
19
20
    /**
21
     * Create a new instance.
22
     *
23
     * @param string             $id
24
     * @param string             $number
25
     * @param \DateTimeInterface $expired
26
     */
27
    public function __construct(string $id, string $number, \DateTimeInterface $expired)
28
    {
29
        $this->id = $id;
30
        $this->number = $number;
31
        $this->expired = $expired;
32
    }
33
34
    /**
35
     * Create a new instance.
36
     *
37
     * @param  mixed   $id
38
     * @param  string  $number
39
     * @param  string  $expired
40
     * @param  string  $dateFormat
41
     *
42
     * @return PaymentCard
43
     */
44
    public static function make($id, string $number, string $expired, string $dateFormat = 'my'): self
45
    {
46
        return new self((string) $id, $number, \DateTimeImmutable::createFromFormat($dateFormat, $expired));
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getId(): string
53
    {
54
        return $this->id;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getNumber(): string
61
    {
62
        return $this->number;
63
    }
64
65
    /**
66
     * @return \DateTimeInterface
67
     */
68
    public function getExpired(): \DateTimeInterface
69
    {
70
        return $this->expired;
71
    }
72
}
73