|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace lordelph\SIP2\Response; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class ACSStatusResponse provides the response from an SCStatus request |
|
7
|
|
|
* |
|
8
|
|
|
* @method getOk() |
|
9
|
|
|
* @method getOnline() |
|
10
|
|
|
* @method getCheckin() |
|
11
|
|
|
* @method getCheckout() |
|
12
|
|
|
* @method getRenewal() |
|
13
|
|
|
* @method getPatronUpdate() |
|
14
|
|
|
* @method getOffline() |
|
15
|
|
|
* @method getTimeout() |
|
16
|
|
|
* @method getRetries() |
|
17
|
|
|
* @method getTransactionDate() |
|
18
|
|
|
* @method getProtocol() |
|
19
|
|
|
* @method getInstitutionId() |
|
20
|
|
|
* @method getLibraryName() |
|
21
|
|
|
* @method getSupportedMessages() |
|
22
|
|
|
* @method getTerminalLocation() |
|
23
|
|
|
* @method getScreenMessage() |
|
24
|
|
|
* @method getPrintLine() |
|
25
|
|
|
* @method getSequenceNumber() |
|
26
|
|
|
* |
|
27
|
|
|
* @licence https://opensource.org/licenses/MIT |
|
28
|
|
|
* @copyright John Wohlers <[email protected]> |
|
29
|
|
|
* @copyright Paul Dixon <[email protected]> |
|
30
|
|
|
*/ |
|
31
|
|
|
class ACSStatusResponse extends SIP2Response |
|
32
|
|
|
{ |
|
33
|
|
|
protected $var = [ |
|
34
|
|
|
'Online' => [], |
|
35
|
|
|
'Checkin' => [], |
|
36
|
|
|
'Checkout' => [], |
|
37
|
|
|
'Renewal' => [], |
|
38
|
|
|
'PatronUpdate' => [], |
|
39
|
|
|
'Offline' => [], |
|
40
|
|
|
'Timeout' => [], |
|
41
|
|
|
'Retries' => [], |
|
42
|
|
|
'TransactionDate' => [], |
|
43
|
|
|
'Protocol' => [], |
|
44
|
|
|
]; |
|
45
|
|
|
|
|
46
|
|
|
//variable part of the response allowed to contain these... |
|
47
|
|
|
protected $allowedVariables=[ |
|
48
|
|
|
self::AO_INSTITUTION_ID, |
|
49
|
|
|
self::AM_LIBRARY_NAME, |
|
50
|
|
|
self::BX_SUPPORTED_MESSAGES, |
|
51
|
|
|
self::AN_TERMINAL_LOCATION, |
|
52
|
|
|
self::AF_SCREEN_MESSAGE, |
|
53
|
|
|
self::AG_PRINT_LINE, |
|
54
|
|
|
self::AY_SEQUENCE_NUMBER |
|
55
|
|
|
]; |
|
56
|
|
|
|
|
57
|
2 |
|
public function __construct($raw) |
|
58
|
|
|
{ |
|
59
|
2 |
|
$this->setVariable('Online', substr($raw, 2, 1)); |
|
60
|
2 |
|
$this->setVariable('Checkin', substr($raw, 3, 1)); |
|
61
|
2 |
|
$this->setVariable('Checkout', substr($raw, 4, 1)); |
|
62
|
2 |
|
$this->setVariable('Renewal', substr($raw, 5, 1)); |
|
63
|
2 |
|
$this->setVariable('PatronUpdate', substr($raw, 6, 1)); |
|
64
|
2 |
|
$this->setVariable('Offline', substr($raw, 7, 1)); |
|
65
|
2 |
|
$this->setVariable('Timeout', substr($raw, 8, 3)); |
|
66
|
2 |
|
$this->setVariable('Retries', substr($raw, 11, 3)); |
|
67
|
2 |
|
$this->setVariable('TransactionDate', substr($raw, 14, 18)); |
|
68
|
2 |
|
$this->setVariable('Protocol', substr($raw, 32, 4)); |
|
69
|
|
|
|
|
70
|
2 |
|
$this->parseVariableData($raw, 36); |
|
71
|
2 |
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|