CheckInResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 25
c 1
b 0
f 0
dl 0
loc 35
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 CheckInResponse provides the response from a CheckInRequest
7
 *
8
 * @method getOk()
9
 * @method getResensitize()
10
 * @method getMagnetic()
11
 * @method getAlert()
12
 * @method getTransactionDate()
13
 * @method getInstitutionId()
14
 * @method getItemIdentifier()
15
 * @method getPermanentLocation()
16
 * @method getTitleIdentifier()
17
 * @method getSortBin()
18
 * @method getPatronIdentifier()
19
 * @method getMediaType()
20
 * @method getItemProperties()
21
 * @method getScreenMessage()
22
 * @method getPrintLine()
23
 * @method getSequenceNumber()
24
 *
25
 * @licence    https://opensource.org/licenses/MIT
26
 * @copyright  John Wohlers <[email protected]>
27
 * @copyright  Paul Dixon <[email protected]>
28
 */
29
class CheckInResponse extends SIP2Response
30
{
31
    //fixed part of response contains these
32
    protected $var = [
33
        'Ok' => [],
34
        'Resensitize' => [],
35
        'Magnetic' => [],
36
        'Alert' => [],
37
        'TransactionDate' => []
38
    ];
39
40
    //variable part of the response allowed to contain these...
41
    protected $allowedVariables=[
42
        self::AO_INSTITUTION_ID,
43
        self::AB_ITEM_IDENTIFIER,
44
        self::AQ_PERMANENT_LOCATION,
45
        self::AJ_TITLE_IDENTIFIER,
46
        self::CL_SORT_BIN,
47
        self::AA_PATRON_IDENTIFIER,
48
        self::CK_MEDIA_TYPE,
49
        self::CH_ITEM_PROPERTIES,
50
        self::AF_SCREEN_MESSAGE,
51
        self::AG_PRINT_LINE,
52
        self::AY_SEQUENCE_NUMBER
53
    ];
54
55 1
    public function __construct($raw)
56
    {
57 1
        $this->setVariable('Ok', substr($raw, 2, 1));
58 1
        $this->setVariable('Resensitize', substr($raw, 3, 1));
59 1
        $this->setVariable('Magnetic', substr($raw, 4, 1));
60 1
        $this->setVariable('Alert', substr($raw, 5, 1));
61 1
        $this->setVariable('TransactionDate', substr($raw, 6, 18));
62
63 1
        $this->parseVariableData($raw, 24);
64 1
    }
65
}
66