Completed
Push — master ( 21f90a...53ff33 )
by Paul
02:26
created

PatronEnableRequest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 13
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMessageString() 0 10 1
1
<?php
2
3
namespace lordelph\SIP2\Request;
4
5
/**
6
 * PatronEnableRequest can be used by the SC to re-enable canceled patrons. It should only be used for system testing
7
 * and validation. The ACS should respond with a Patron Enable Response message.
8
 *
9
 * @method setInstitutionId(string $institutionId)
10
 * @method setPatronIdentifier(string $patron)
11
 * @method setTerminalPassword(string $terminalPassword)
12
 * @method setPatronPassword(string $patronPassword)
13
 *
14
 * @licence    https://opensource.org/licenses/MIT
15
 * @copyright  John Wohlers <[email protected]>
16
 * @copyright  Paul Dixon <[email protected]>
17
 */
18
class PatronEnableRequest extends SIP2Request
19
{
20
    protected $var = [
21
        'InstitutionId' => [],
22
        'PatronIdentifier' => [],
23
        'TerminalPassword' => ['default' => ''],
24
        'PatronPassword' => ['default' => ''],
25
    ];
26
27 1
    public function getMessageString($withSeq = true, $withCrc = true): string
28
    {
29 1
        $this->newMessage('25');
30 1
        $this->addFixedOption($this->datestamp(), 18);
31 1
        $this->addVarOption('AO', $this->getVariable('InstitutionId'));
32 1
        $this->addVarOption('AA', $this->getVariable('PatronIdentifier'));
33 1
        $this->addVarOption('AC', $this->getVariable('TerminalPassword'), true);
34 1
        $this->addVarOption('AD', $this->getVariable('PatronPassword'), true);
35
36 1
        return $this->returnMessage($withSeq, $withCrc);
37
    }
38
}
39