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

ItemInformationResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace lordelph\SIP2\Response;
4
5
/**
6
 * Class ItemInformationResponse provides the response from a ItemInformationRequest
7
 *
8
 * @method getCirculationStatus()
9
 * @method getSecurityMarker()
10
 * @method getFeeType()
11
 * @method getTransactionDate()
12
 * @method getHoldQueueLength()
13
 * @method getDueDate()
14
 * @method getRecallDate()
15
 * @method getHoldPickupDate()
16
 * @method getItemIdentifier()
17
 * @method getTitleIdentifier()
18
 * @method getOwner()
19
 * @method getCurrencyType()
20
 * @method getFeeAmount()
21
 * @method getMediaType()
22
 * @method getPermanentLocation()
23
 * @method getCurrentLocation()
24
 * @method getItemProperties()
25
 * @method getScreenMessage()
26
 * @method getPrintLine()
27
 * @method getSequenceNumber()
28
 *
29
 * @licence    https://opensource.org/licenses/MIT
30
 * @copyright  John Wohlers <[email protected]>
31
 * @copyright  Paul Dixon <[email protected]>
32
 */
33
class ItemInformationResponse extends SIP2Response
34
{
35
    //fixed part of response contains these
36
    protected $var = [
37
        'CirculationStatus' => [],
38
        'SecurityMarker' => [],
39
        'FeeType' => [],
40
        'TransactionDate' => []
41
    ];
42
43
    //variable part of the response allowed to contain these...
44
    protected $allowedVariables=[
45
        self::CF_HOLD_QUEUE_LENGTH,
46
        self::AH_DUE_DATE,
47
        self::CJ_RECALL_DATE,
48
        self::CM_HOLD_PICKUP_DATE,
49
        self::AB_ITEM_IDENTIFIER,
50
        self::AJ_TITLE_IDENTIFIER,
51
        self::BG_OWNER,
52
        self::BH_CURRENCY_TYPE,
53
        self::BV_FEE_AMOUNT,
54
        self::CK_MEDIA_TYPE,
55
        self::AQ_PERMANENT_LOCATION,
56
        self::AP_CURRENT_LOCATION,
57
        self::CH_ITEM_PROPERTIES,
58
        self::AF_SCREEN_MESSAGE,
59
        self::AG_PRINT_LINE,
60
        self::AY_SEQUENCE_NUMBER
61
    ];
62
63
    public function __construct($raw)
64
    {
65
        $this->setVariable('CirculationStatus', substr($raw, 2, 2));
66
        $this->setVariable('SecurityMarker', substr($raw, 4, 2));
67
        $this->setVariable('FeeType', substr($raw, 6, 2));
68
        $this->setVariable('TransactionDate', substr($raw, 8, 18));
69
70
        $this->parseVariableData($raw, 26);
71
    }
72
}
73