RosfinItem::passport()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Services\Client;
6
7
final class RosfinItem
8
{
9
    private const TYPE_PERSON = 4;
10
11
    private $data;
12
13
    public static function fromArray(array $data): self
14
    {
15
        return new self($data);
16
    }
17
18
    public function id(): int
19
    {
20
        return $this->data['id'];
21
    }
22
23
    public function type(): int
24
    {
25
        return $this->data['type'];
26
    }
27
28
    public function person(): bool
29
    {
30
        return self::TYPE_PERSON === $this->type();
31
    }
32
33
    public function fullName(): array
34
    {
35
        return $this->data['fullName'];
36
    }
37
38
    public function birthDate(): ?string
39
    {
40
        return $this->data['birthDate'] ?? null;
41
    }
42
43
    public function birthPlace(): ?string
44
    {
45
        return $this->data['birthPlace'] ?? null;
46
    }
47
48
    public function description(): ?string
49
    {
50
        return $this->data['description'] ?? null;
51
    }
52
53
    public function address(): ?string
54
    {
55
        return $this->data['address'] ?? null;
56
    }
57
58
    public function resolution(): ?string
59
    {
60
        return $this->data['resolution'] ?? null;
61
    }
62
63
    public function passport(): ?string
64
    {
65
        return $this->data['passport'] ?? null;
66
    }
67
68
    public function toArray(): array
69
    {
70
        return $this->data;
71
    }
72
73
    private function __construct(array $data)
74
    {
75
        $this->data = $data;
76
    }
77
}
78