PatronStatusRequest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 15
c 1
b 0
f 0
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMessageString() 0 11 1
1
<?php
2
3
namespace lordelph\SIP2\Request;
4
5
/**
6
 * PatronStatusRequest is used by the client to request patron information from the SIP2 server. The service must
7
 * respond to this command with a Patron Status Response message.
8
 *
9
 * @method setLanguage(string $languageCode)
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 PatronStatusRequest extends SIP2Request
20
{
21
    protected $var = [
22
        'Language' => ['type' => 'nnn', 'default' => '001'],
23
        'InstitutionId' => [],
24
        'PatronIdentifier' => [],
25
        'TerminalPassword' => ['default' => ''],
26
        'PatronPassword' => ['default' => ''],
27
    ];
28
29 1
    public function getMessageString($withSeq = true, $withCrc = true): string
30
    {
31 1
        $this->newMessage('23');
32 1
        $this->addFixedOption($this->getVariable('Language'), 3);
33 1
        $this->addFixedOption($this->datestamp(), 18);
34 1
        $this->addVarOption('AO', $this->getVariable('InstitutionId'));
35 1
        $this->addVarOption('AA', $this->getVariable('PatronIdentifier'));
36 1
        $this->addVarOption('AC', $this->getVariable('TerminalPassword'));
37 1
        $this->addVarOption('AD', $this->getVariable('PatronPassword'), true);
38
39 1
        return $this->returnMessage($withSeq, $withCrc);
40
    }
41
}
42