Completed
Push — master ( 03cde8...21f90a )
by Paul
02:45
created

PatronStatusResponse   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 20
dl 0
loc 30
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
namespace lordelph\SIP2\Response;
4
5
/**
6
 * Class PatronStatusResponse provides the response from a PatronStatusRequest and a BlockPatronRequest
7
 *
8
 * @method getPatronStatus()
9
 * @method getLanguage()
10
 * @method getTransactionDate()
11
 * @method getInstitutionId()
12
 * @method getPatronIdentifier()
13
 * @method getPersonalName()
14
 * @method getValidPatron()
15
 * @method getValidPatronPassword()
16
 * @method getFeeAmount()
17
 * @method getCurrencyType()
18
 * @method getScreenMessage()
19
 * @method getPrintLine()
20
 * @method getSequenceNumber()
21
 *
22
 * @licence    https://opensource.org/licenses/MIT
23
 * @copyright  John Wohlers <[email protected]>
24
 * @copyright  Paul Dixon <[email protected]>
25
 */
26
class PatronStatusResponse extends SIP2Response
27
{
28
    //fixed part of response contains these
29
    protected $var = [
30
        'PatronStatus' => [],
31
        'Language' => [],
32
        'TransactionDate' => []
33
    ];
34
35
    //variable part of the response allowed to contain these...
36
    protected $allowedVariables=[
37
        self::AO_INSTITUTION_ID,
38
        self::AA_PATRON_IDENTIFIER,
39
        self::AE_PERSONAL_NAME,
40
        self::BL_VALID_PATRON,
41
        self::CQ_VALID_PATRON_PASSWORD,
42
        self::BH_CURRENCY_TYPE,
43
        self::BV_FEE_AMOUNT,
44
        self::AF_SCREEN_MESSAGE,
45
        self::AG_PRINT_LINE,
46
        self::AY_SEQUENCE_NUMBER
47
    ];
48
49
    public function __construct($raw)
50
    {
51
        $this->setVariable('PatronStatus', substr($raw, 2, 14));
52
        $this->setVariable('Language', substr($raw, 16, 3));
53
        $this->setVariable('TransactionDate', substr($raw, 19, 18));
54
55
        $this->parseVariableData($raw, 37);
56
    }
57
}
58