Passed
Branch master (e17e02)
by Jacques
02:12
created

Status   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 13
c 1
b 0
f 0
dl 0
loc 39
ccs 0
cts 3
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A codeDesc() 0 5 2
1
<?php
2
3
namespace OfxParser\Entities;
4
5
class Status extends AbstractEntity
6
{
7
    /**
8
     * @var string[]
9
     */
10
    private static $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 $code;
23
24
    /**
25
     * @var string
26
     */
27
    public $severity;
28
29
    /**
30
     * @var string
31
     */
32
    public $message;
33
34
    /**
35
     * Get the associated code description
36
     *
37
     * @return string
38
     */
39
    public function codeDesc()
40
    {
41
        // Cast code to string from SimpleXMLObject
42
        $code = (string)$this->code;
43
        return array_key_exists($code, self::$codes) ? self::$codes[$code] : '';
44
    }
45
}
46