EndSessionResponse::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace lordelph\SIP2\Response;
4
5
/**
6
 * Class EndSessionResponse provides the response from a EndSessionRequest
7
 *
8
 * @method getEndSession()
9
 * @method getTransactionDate()
10
 * @method getInstitutionId()
11
 * @method getPatronIdentifier()
12
 * @method getScreenMessage()
13
 * @method getPrintLine()
14
 * @method getSequenceNumber()
15
 *
16
 * @licence    https://opensource.org/licenses/MIT
17
 * @copyright  John Wohlers <[email protected]>
18
 * @copyright  Paul Dixon <[email protected]>
19
 */
20
class EndSessionResponse extends SIP2Response
21
{
22
    //fixed part of response contains these
23
    protected $var = [
24
        'EndSession' => [],
25
        'TransactionDate' => []
26
    ];
27
28
    //variable part of the response allowed to contain these...
29
    protected $allowedVariables=[
30
        self::AO_INSTITUTION_ID,
31
        self::AA_PATRON_IDENTIFIER,
32
        self::AF_SCREEN_MESSAGE,
33
        self::AG_PRINT_LINE,
34
        self::AY_SEQUENCE_NUMBER
35
    ];
36
37 4
    public function __construct($raw)
38
    {
39 4
        $this->setVariable('EndSession', substr($raw, 2, 1));
40 4
        $this->setVariable('TransactionDate', substr($raw, 3, 18));
41 4
        $this->parseVariableData($raw, 21);
42 4
    }
43
}
44