Status::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Beccha\OfxParser\Entity;
6
7
final class Status
8
{
9
    /**
10
     * @var array|string[]
11
     */
12
    protected array $codes = [
13
        '0'     => 'Success',
14
        '2000'  => 'General error',
15
        '15000' => 'Must change USERPASS',
16
        '15500' => 'Signon invalid',
17
        '15501' => 'Customer account already in use',
18
        '15502' => 'USERPASS Lockout'
19
    ];
20
    private string $code;
21
    private string $severity;
22
    private string $message;
23
24
    public function __construct(string $code, string $severity, string $message)
25
    {
26
        $this->code = $code;
27
        $this->severity = $severity;
28
        $this->message = $message;
29
    }
30
31
    public function getCode(): string
32
    {
33
        return $this->code;
34
    }
35
36
    public function getSeverity(): string
37
    {
38
        return $this->severity;
39
    }
40
41
    public function getMessage(): string
42
    {
43
        return $this->message;
44
    }
45
46
    public function getDescription(): string
47
    {
48
        return $this->codes[$this->code] ?? '';
49
    }
50
}
51