PassportCheck   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 61
rs 10
c 0
b 0
f 0
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 3 1
A source() 0 3 1
A failed() 0 3 1
A passed() 0 3 1
A number() 0 3 1
A code() 0 3 1
A message() 0 3 1
A series() 0 3 1
A malformed() 0 3 1
A toArray() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Services\Client;
6
7
final class PassportCheck
8
{
9
    private const PASSED = 1;
10
    private const FAILED = 2;
11
    private const MALFORMED = 3;
12
13
    private $data;
14
15
    public static function fromArray(array $data): self
16
    {
17
        return new self($data);
18
    }
19
20
    public function source(): string
21
    {
22
        return $this->data['source'];
23
    }
24
25
    public function code(): int
26
    {
27
        return $this->data['code'];
28
    }
29
30
    public function passed(): bool
31
    {
32
        return self::PASSED === $this->code();
33
    }
34
35
    public function failed(): bool
36
    {
37
        return self::FAILED === $this->code();
38
    }
39
40
    public function malformed(): bool
41
    {
42
        return self::MALFORMED === $this->code();
43
    }
44
45
    public function message(): string
46
    {
47
        return $this->data['message'];
48
    }
49
50
    public function series(): ?string
51
    {
52
        return $this->data['series'] ?? null;
53
    }
54
55
    public function number(): ?string
56
    {
57
        return $this->data['number'] ?? null;
58
    }
59
60
    public function toArray(): array
61
    {
62
        return $this->data;
63
    }
64
65
    private function __construct(array $data)
66
    {
67
        $this->data = $data;
68
    }
69
}
70