PatronInformationResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 45
c 1
b 0
f 0
dl 0
loc 55
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
1
<?php
2
3
namespace lordelph\SIP2\Response;
4
5
/**
6
 * Class PatronInformationResponse provides the response from a PatronInformationRequest
7
 *
8
 * @method getPatronStatus()
9
 * @method getLanguage()
10
 * @method getTransactionDate()
11
 * @method getHoldCount()
12
 * @method getOverdueCount()
13
 * @method getChargedCount()
14
 * @method getFineCount()
15
 * @method getRecallCount()
16
 * @method getUnavailableCount()
17
 * @method getInstitutionId()
18
 * @method getPatronIdentifier()
19
 * @method getPersonalName()
20
 * @method getHoldItemsLimit()
21
 * @method getOverdueItemsLimit()
22
 * @method getChargedItemsLimit()
23
 * @method getValidPatron()
24
 * @method getValidPatronPassword()
25
 * @method getFeeAmount()
26
 * @method getCurrencyType()
27
 * @method getFeeLimit()
28
 * @method getHoldItems()
29
 * @method getOverdueItems()
30
 * @method getFineItems()
31
 * @method getRecallItems()
32
 * @method getUnavailableHoldItems()
33
 * @method getHomeAddress()
34
 * @method getEmailAddress()
35
 * @method getHomePhoneNumber()
36
 * @method getScreenMessage()
37
 * @method getPrintLine()
38
 * @method getSequenceNumber()
39
 *
40
 * @licence    https://opensource.org/licenses/MIT
41
 * @copyright  John Wohlers <[email protected]>
42
 * @copyright  Paul Dixon <[email protected]>
43
 */
44
class PatronInformationResponse extends SIP2Response
45
{
46
    //fixed part of response contains these
47
    protected $var = [
48
        'PatronStatus' => [],
49
        'Language' => [],
50
        'TransactionDate' => [],
51
        'HoldCount' => [],
52
        'OverdueCount' => [],
53
        'ChargedCount' => [],
54
        'FineCount' => [],
55
        'RecallCount' => [],
56
        'UnavailableCount' => [],
57
    ];
58
59
    //variable part of the response allowed to contain these...
60
    protected $allowedVariables=[
61
        self::AO_INSTITUTION_ID,
62
        self::AA_PATRON_IDENTIFIER,
63
        self::AE_PERSONAL_NAME,
64
        self::BZ_HOLD_ITEMS_LIMIT,
65
        self::CA_OVERDUE_ITEMS_LIMIT,
66
        self::CB_CHARGED_ITEMS_LIMIT,
67
        self::BL_VALID_PATRON,
68
        self::CQ_VALID_PATRON_PASSWORD,
69
        self::BH_CURRENCY_TYPE,
70
        self::BV_FEE_AMOUNT,
71
        self::CC_FEE_LIMIT,
72
        self::AS_HOLD_ITEMS,
73
        self::AT_OVERDUE_ITEMS,
74
        self::AU_CHARGED_ITEMS,
75
        self::AV_FINE_ITEMS,
76
        self::BU_RECALL_ITEMS,
77
        self::CD_UNAVAILABLE_HOLD_ITEMS,
78
        self::BD_HOME_ADDRESS,
79
        self::BE_EMAIL_ADDRESS,
80
        self::BF_HOME_PHONE_NUMBER,
81
        self::AF_SCREEN_MESSAGE,
82
        self::AG_PRINT_LINE,
83
        self::AY_SEQUENCE_NUMBER
84
    ];
85
86 1
    public function __construct($raw)
87
    {
88 1
        $this->setVariable('PatronStatus', substr($raw, 2, 14));
89 1
        $this->setVariable('Language', substr($raw, 16, 3));
90 1
        $this->setVariable('TransactionDate', substr($raw, 19, 18));
91 1
        $this->setVariable('HoldCount', substr($raw, 37, 4));
92 1
        $this->setVariable('OverdueCount', substr($raw, 41, 4));
93 1
        $this->setVariable('ChargedCount', substr($raw, 45, 4));
94 1
        $this->setVariable('FineCount', substr($raw, 49, 4));
95 1
        $this->setVariable('RecallCount', substr($raw, 53, 4));
96 1
        $this->setVariable('UnavailableCount', substr($raw, 57, 4));
97
98 1
        $this->parseVariableData($raw, 61);
99 1
    }
100
}
101