RenewAllResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 18
c 1
b 0
f 0
dl 0
loc 27
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
namespace lordelph\SIP2\Response;
4
5
/**
6
 * Class RenewAllResponse provides the response from a RenewAllRequest
7
 *
8
 * @method getOk()
9
 * @method getRenewed()
10
 * @method getUnrenewed()
11
 * @method getTransactionDate()
12
 * @method getInstitutionId()
13
 * @method getRenewedItems()
14
 * @method getUnrenewedItems()
15
 * @method getScreenMessage()
16
 * @method getPrintLine()
17
 * @method getSequenceNumber()
18
 *
19
 * @licence    https://opensource.org/licenses/MIT
20
 * @copyright  John Wohlers <[email protected]>
21
 * @copyright  Paul Dixon <[email protected]>
22
 */
23
class RenewAllResponse extends SIP2Response
24
{
25
    //fixed part of response contains these
26
    protected $var = [
27
        'Ok' => [],
28
        'Renewed' => [],
29
        'Unrenewed' => [],
30
        'TransactionDate' => []
31
    ];
32
33
    //variable part of the response allowed to contain these...
34
    protected $allowedVariables=[
35
        self::AO_INSTITUTION_ID,
36
        self::BM_RENEWED_ITEMS,
37
        self::BN_UNRENEWED_ITEMS,
38
        self::AF_SCREEN_MESSAGE,
39
        self::AG_PRINT_LINE,
40
        self::AY_SEQUENCE_NUMBER
41
    ];
42
43 1
    public function __construct($raw)
44
    {
45 1
        $this->setVariable('Ok', substr($raw, 2, 1));
46 1
        $this->setVariable('Renewed', substr($raw, 3, 4));
47 1
        $this->setVariable('Unrenewed', substr($raw, 7, 4));
48 1
        $this->setVariable('TransactionDate', substr($raw, 11, 18));
49 1
        $this->parseVariableData($raw, 29);
50 1
    }
51
}
52