EndPatronSessionRequest::getMessageString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace lordelph\SIP2\Request;
4
5
/**
6
 * EndPatronSessionRequest will be sent when a patron has completed all of their transactions. The ACS may, upon
7
 * receipt of this command, close any open files or deallocate data structures pertaining to that patron. The ACS
8
 * should respond with an End Session Response message.
9
 *
10
 * @method setInstitutionId(string $institutionId)
11
 * @method setPatronIdentifier(string $patron)
12
 * @method setTerminalPassword(string $terminalPassword)
13
 * @method setPatronPassword(string $patronPassword)
14
 *
15
 * @licence    https://opensource.org/licenses/MIT
16
 * @copyright  John Wohlers <[email protected]>
17
 * @copyright  Paul Dixon <[email protected]>
18
 */
19
class EndPatronSessionRequest extends SIP2Request
20
{
21
    protected $var = [
22
        'InstitutionId' => [],
23
        'PatronIdentifier' => [],
24
        'TerminalPassword' => ['default' => ''],
25
        'PatronPassword' => ['default' => ''],
26
    ];
27
28 1
    public function getMessageString($withSeq = true, $withCrc = true): string
29
    {
30 1
        $this->newMessage('35');
31 1
        $this->addFixedOption($this->datestamp(), 18);
32 1
        $this->addVarOption('AO', $this->getVariable('InstitutionId'));
33 1
        $this->addVarOption('AA', $this->getVariable('PatronIdentifier'));
34 1
        $this->addVarOption('AC', $this->getVariable('TerminalPassword'), true);
35 1
        $this->addVarOption('AD', $this->getVariable('PatronPassword'), true);
36
37 1
        return $this->returnMessage($withSeq, $withCrc);
38
    }
39
}
40