CheckOutResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
1
<?php
2
3
namespace lordelph\SIP2\Response;
4
5
/**
6
 * Class CheckoutResponse provides the response from a CheckoutRequest
7
 *
8
 * @method getOk()
9
 * @method getRenewalOk()
10
 * @method getMagnetic()
11
 * @method getDesensitize()
12
 * @method getTransactionDate()
13
 * @method getInstitutionId()
14
 * @method getPatronIdentifier()
15
 * @method getItemIdentifier()
16
 * @method getTitleIdentifier()
17
 * @method getDueDate()
18
 * @method getFeeType()
19
 * @method getSecurityInhibit()
20
 * @method getFeeAmount()
21
 * @method getCurrencyType()
22
 * @method getMediaType()
23
 * @method getItemProperties()
24
 * @method getTransactionId()
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 CheckOutResponse extends SIP2Response
34
{
35
    //fixed part of response contains these
36
    protected $var = [
37
        'Ok' => [],
38
        'RenewalOk' => [],
39
        'Magnetic' => [],
40
        'Desensitize' => [],
41
        'TransactionDate' => []
42
    ];
43
44
    //variable part of the response allowed to contain these...
45
    protected $allowedVariables=[
46
        self::AO_INSTITUTION_ID,
47
        self::AA_PATRON_IDENTIFIER,
48
        self::AB_ITEM_IDENTIFIER,
49
        self::AJ_TITLE_IDENTIFIER,
50
        self::AH_DUE_DATE,
51
        self::BT_FEE_TYPE,
52
        self::CI_SECURITY_INHIBIT,
53
        self::BH_CURRENCY_TYPE,
54
        self::BV_FEE_AMOUNT,
55
        self::CK_MEDIA_TYPE,
56
        self::CH_ITEM_PROPERTIES,
57
        self::BK_TRANSACTION_ID,
58
        self::AF_SCREEN_MESSAGE,
59
        self::AG_PRINT_LINE,
60
        self::AY_SEQUENCE_NUMBER
61
    ];
62
63 1
    public function __construct($raw)
64
    {
65 1
        $this->setVariable('Ok', substr($raw, 2, 1));
66 1
        $this->setVariable('RenewalOk', substr($raw, 3, 1));
67 1
        $this->setVariable('Magnetic', substr($raw, 4, 1));
68 1
        $this->setVariable('Desensitize', substr($raw, 5, 1));
69 1
        $this->setVariable('TransactionDate', substr($raw, 6, 18));
70
71 1
        $this->parseVariableData($raw, 24);
72 1
    }
73
}
74