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

Status::codeDesc()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
cc 2
nc 2
nop 0
crap 6
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