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

ItemStatusUpdateRequest::getMessageString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 10
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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