Status   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 45
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A codeDescription() 0 4 2
A __construct() 0 5 1
1
<?php
2
3
namespace Endeken\OFX;
4
5
class Status
6
{
7
    /**
8
     * @var string[]
9
     */
10
    private static array $codes = [
11
        '0'       => 'Success',
12
        '2000'    => 'General error',
13
        '15000'   => 'Must change USERPASS',
14
        '15500'   => 'Signon invalid',
15
        '15501'   => 'Customer account already in use',
16
        '15502'   => 'USERPASS Lockout'
17
    ];
18
19
    /**
20
     * @var string
21
     */
22
    public string $code;
23
24
    /**
25
     * @var string
26
     */
27
    public string $severity;
28
29
    /**
30
     * @var string
31
     */
32
    public string $message;
33
34
    public function __construct(string $code, string $severity, string $message)
35
    {
36
        $this->code = $code;
37
        $this->severity = $severity;
38
        $this->message = $message;
39
    }
40
41
    /**
42
     * Get the associated code description
43
     *
44
     * @return string
45
     */
46
    public function codeDescription(): string
47
    {
48
        $code = $this->code;
49
        return array_key_exists($code, self::$codes) ? self::$codes[$code] : '';
50
    }
51
}