Completed
Push — master ( 03cde8...21f90a )
by Paul
02:45
created

ItemStatusUpdateRequest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 13
dl 0
loc 19
ccs 0
cts 9
cp 0
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
 * ItemStatusUpdateRequest can be used to send item information to the ACS, without having to do a Checkout or Checkin
7
 * operation. The item properties could be stored on the ACS’s database. The ACS should respond with an Item
8
 * Status Update Response message.
9
 *
10
 * @method setInstitutionId(string $institutionId)
11
 * @method setItemIdentifier(string $itemIdentifier)
12
 * @method setTerminalPassword(string $terminalPassword)
13
 * @method setItemProperties(string $itemProperties)
14
 *
15
 * @licence    https://opensource.org/licenses/MIT
16
 * @copyright  John Wohlers <[email protected]>
17
 * @copyright  Paul Dixon <[email protected]>
18
 */
19
class ItemStatusUpdateRequest extends SIP2Request
20
{
21
    protected $var = [
22
        'InstitutionId' => [],
23
        'ItemIdentifier' => [],
24
        'TerminalPassword' => ['default' => ''],
25
        'ItemProperties' => ['default' => ''],
26
    ];
27
28
    public function getMessageString($withSeq = true, $withCrc = true): string
29
    {
30
        $this->newMessage('19');
31
        $this->addFixedOption($this->datestamp(), 18);
32
        $this->addVarOption('AO', $this->getVariable('InstitutionId'));
33
        $this->addVarOption('AB', $this->getVariable('ItemIdentifier'));
34
        $this->addVarOption('AC', $this->getVariable('TerminalPassword'));
35
        $this->addVarOption('CH', $this->getVariable('ItemProperties'), true);
36
37
        return $this->returnMessage($withSeq, $withCrc);
38
    }
39
}
40