@@ -37,7 +37,7 @@ |
||
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | 39 | //variable part of the response allowed to contain these... |
| 40 | - protected $allowedVariables=[ |
|
| 40 | + protected $allowedVariables = [ |
|
| 41 | 41 | self::CF_HOLD_QUEUE_LENGTH, |
| 42 | 42 | self::AH_DUE_DATE, |
| 43 | 43 | self::CJ_RECALL_DATE, |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | 31 | //variable part of the response allowed to contain these... |
| 32 | - protected $allowedVariables=[ |
|
| 32 | + protected $allowedVariables = [ |
|
| 33 | 33 | self::AO_INSTITUTION_ID, |
| 34 | 34 | self::AA_PATRON_IDENTIFIER, |
| 35 | 35 | self::AE_PERSONAL_NAME, |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | 31 | //variable part of the response allowed to contain these... |
| 32 | - protected $allowedVariables=[ |
|
| 32 | + protected $allowedVariables = [ |
|
| 33 | 33 | self::AO_INSTITUTION_ID, |
| 34 | 34 | self::AA_PATRON_IDENTIFIER, |
| 35 | 35 | self::AE_PERSONAL_NAME, |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | ]; |
| 39 | 39 | |
| 40 | 40 | //variable part of the response allowed to contain these... |
| 41 | - protected $allowedVariables=[ |
|
| 41 | + protected $allowedVariables = [ |
|
| 42 | 42 | self::AO_INSTITUTION_ID, |
| 43 | 43 | self::AA_PATRON_IDENTIFIER, |
| 44 | 44 | self::AB_ITEM_IDENTIFIER, |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @var array provides a list of the variables this message can use. Array key is the variable name in |
| 20 | 20 | * StudlyCaps, value is an array which can contain type, default values |
| 21 | 21 | */ |
| 22 | - protected $var=[]; |
|
| 22 | + protected $var = []; |
|
| 23 | 23 | |
| 24 | 24 | /** @var integer|null current timestamp, useful for testing */ |
| 25 | 25 | protected $timestamp = null; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function getAll() |
| 98 | 98 | { |
| 99 | - $result=[]; |
|
| 99 | + $result = []; |
|
| 100 | 100 | foreach ($this->var as $name => $data) { |
| 101 | 101 | $result[$name] = $this->getVariable($name); |
| 102 | 102 | } |
@@ -188,19 +188,19 @@ discard block |
||
| 188 | 188 | protected function ensureVariableExists($name) |
| 189 | 189 | { |
| 190 | 190 | if (!isset($this->var[$name])) { |
| 191 | - throw new LogicException(get_class($this) . ' has no ' . $name . ' member'); |
|
| 191 | + throw new LogicException(get_class($this).' has no '.$name.' member'); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | protected function handleMissing($varName) |
| 196 | 196 | { |
| 197 | - throw new LogicException(get_class($this) . '::set' . $varName . ' must be called'); |
|
| 197 | + throw new LogicException(get_class($this).'::set'.$varName.' must be called'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | public function __call($name, $arguments) |
| 201 | 201 | { |
| 202 | 202 | if (!preg_match('/^(get|set)(.+)$/', $name, $match)) { |
| 203 | - throw new LogicException(get_class($this) . ' has no ' . $name . ' method'); |
|
| 203 | + throw new LogicException(get_class($this).' has no '.$name.' method'); |
|
| 204 | 204 | } |
| 205 | 205 | $varName = $match[2]; |
| 206 | 206 | |
@@ -57,8 +57,8 @@ |
||
| 57 | 57 | { |
| 58 | 58 | $this->newMessage('37'); |
| 59 | 59 | $this->addFixedOption($this->datestamp(), 18); |
| 60 | - $this->addFixedOption(sprintf('%02d', (string)$this->getVariable('FeeType')), 2); |
|
| 61 | - $this->addFixedOption(sprintf('%02d', (string)$this->getVariable('PaymentType')), 2); |
|
| 60 | + $this->addFixedOption(sprintf('%02d', (string) $this->getVariable('FeeType')), 2); |
|
| 61 | + $this->addFixedOption(sprintf('%02d', (string) $this->getVariable('PaymentType')), 2); |
|
| 62 | 62 | $this->addFixedOption($this->getVariable('CurrencyType'), 3); |
| 63 | 63 | |
| 64 | 64 | // due to currency format localization, it is up to the programmer |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $this->newMessage('99'); |
| 33 | 33 | $this->addFixedOption($this->getVariable('Status'), 1); |
| 34 | 34 | $this->addFixedOption($this->getVariable('Width'), 3); |
| 35 | - $this->addFixedOption(sprintf("%03.2f", (float)$this->getVariable('Version')), 4); |
|
| 35 | + $this->addFixedOption(sprintf("%03.2f", (float) $this->getVariable('Version')), 4); |
|
| 36 | 36 | |
| 37 | 37 | return $this->returnMessage($withSeq, $withCrc); |
| 38 | 38 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * @var array name=>value request defaults used for every request |
| 42 | 42 | */ |
| 43 | - private $default=[]; |
|
| 43 | + private $default = []; |
|
| 44 | 44 | |
| 45 | 45 | //----------------------------------------------------- |
| 46 | 46 | // connection handling |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | //@codeCoverageIgnoreEnd |
| 134 | 134 | |
| 135 | - $result = $result . $terminator; |
|
| 135 | + $result = $result.$terminator; |
|
| 136 | 136 | } |
| 137 | 137 | //if the remote end uses CRLF as a terminator, we might have a stray LF in our buffer - by trimming |
| 138 | 138 | //the responses, we ensure those don't upset us |
| 139 | - $result=trim($result); |
|
| 139 | + $result = trim($result); |
|
| 140 | 140 | |
| 141 | 141 | $this->logger->info("SIP2: result={$result}"); |
| 142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $this->logger->warning("SIP2: Message failed CRC check, retry {$depth})"); |
| 151 | 151 | $result = $this->getRawResponse($request, $depth); |
| 152 | 152 | } else { |
| 153 | - $errMsg="SIP2: Failed to get valid CRC after {$this->maxretry} retries."; |
|
| 153 | + $errMsg = "SIP2: Failed to get valid CRC after {$this->maxretry} retries."; |
|
| 154 | 154 | $this->logger->critical($errMsg); |
| 155 | 155 | throw new RuntimeException($errMsg); |
| 156 | 156 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $this->socket = $this->createClient($address, $bind, $timeout); |
| 178 | 178 | } catch (\Exception $e) { |
| 179 | 179 | $this->socket = null; |
| 180 | - $this->logger->error("SIP2Client: Failed to connect: " . $e->getMessage()); |
|
| 180 | + $this->logger->error("SIP2Client: Failed to connect: ".$e->getMessage()); |
|
| 181 | 181 | throw new RuntimeException("Connection failure", 0, $e); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | const AG_PRINT_LINE = 'AG'; |
| 27 | 27 | const AH_DUE_DATE = 'AH'; |
| 28 | 28 | const AJ_TITLE_IDENTIFIER = 'AJ'; |
| 29 | - const AM_LIBRARY_NAME='AM'; |
|
| 30 | - const AN_TERMINAL_LOCATION='AN'; |
|
| 29 | + const AM_LIBRARY_NAME = 'AM'; |
|
| 30 | + const AN_TERMINAL_LOCATION = 'AN'; |
|
| 31 | 31 | const AO_INSTITUTION_ID = 'AO'; |
| 32 | 32 | const AP_CURRENT_LOCATION = 'AP'; |
| 33 | - const AQ_PERMANENT_LOCATION='AQ'; |
|
| 33 | + const AQ_PERMANENT_LOCATION = 'AQ'; |
|
| 34 | 34 | const AS_HOLD_ITEMS = 'AS'; |
| 35 | 35 | const AT_OVERDUE_ITEMS = 'AT'; |
| 36 | 36 | const AU_CHARGED_ITEMS = 'AU'; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | const BF_HOME_PHONE_NUMBER = 'BF'; |
| 42 | 42 | const BG_OWNER = 'BG'; |
| 43 | 43 | const BH_CURRENCY_TYPE = 'BH'; |
| 44 | - const BK_TRANSACTION_ID= 'BK'; |
|
| 44 | + const BK_TRANSACTION_ID = 'BK'; |
|
| 45 | 45 | const BL_VALID_PATRON = 'BL'; |
| 46 | 46 | const BM_RENEWED_ITEMS = 'BM'; |
| 47 | 47 | const BN_UNRENEWED_ITEMS = 'BN'; |
@@ -51,18 +51,18 @@ discard block |
||
| 51 | 51 | const BU_RECALL_ITEMS = 'BU'; |
| 52 | 52 | const BV_FEE_AMOUNT = 'BV'; |
| 53 | 53 | const BW_EXPIRATION_DATE = 'BW'; |
| 54 | - const BX_SUPPORTED_MESSAGES='BX'; |
|
| 54 | + const BX_SUPPORTED_MESSAGES = 'BX'; |
|
| 55 | 55 | const BZ_HOLD_ITEMS_LIMIT = 'BZ'; |
| 56 | 56 | const CA_OVERDUE_ITEMS_LIMIT = 'CA'; |
| 57 | 57 | const CB_CHARGED_ITEMS_LIMIT = 'CB'; |
| 58 | 58 | const CC_FEE_LIMIT = 'CC'; |
| 59 | 59 | const CD_UNAVAILABLE_HOLD_ITEMS = 'CD'; |
| 60 | 60 | const CF_HOLD_QUEUE_LENGTH = 'CF'; |
| 61 | - const CH_ITEM_PROPERTIES= 'CH'; |
|
| 61 | + const CH_ITEM_PROPERTIES = 'CH'; |
|
| 62 | 62 | const CI_SECURITY_INHIBIT = 'CI'; |
| 63 | 63 | const CJ_RECALL_DATE = 'CJ'; |
| 64 | - const CK_MEDIA_TYPE= 'CK'; |
|
| 65 | - const CL_SORT_BIN='CL'; |
|
| 64 | + const CK_MEDIA_TYPE = 'CK'; |
|
| 65 | + const CL_SORT_BIN = 'CL'; |
|
| 66 | 66 | const CM_HOLD_PICKUP_DATE = 'CM'; |
| 67 | 67 | const CQ_VALID_PATRON_PASSWORD = 'CQ'; |
| 68 | 68 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public static function parse($raw): SIP2Response |
| 140 | 140 | { |
| 141 | 141 | if (empty($raw) || !self::checkCRC($raw)) { |
| 142 | - throw new LogicException("Empty string or bad CRC not expected here");//@codeCoverageIgnore |
|
| 142 | + throw new LogicException("Empty string or bad CRC not expected here"); //@codeCoverageIgnore |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $type = substr($raw, 0, 2); |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | return true; |
| 160 | 160 | } |
| 161 | 161 | if (preg_match('/^(.*AZ)(.{4})$/', trim($raw), $match)) { |
| 162 | - $plaintext=$match[1]; |
|
| 163 | - $checksum=$match[2]; |
|
| 162 | + $plaintext = $match[1]; |
|
| 163 | + $checksum = $match[2]; |
|
| 164 | 164 | return self::crc($plaintext) == $checksum; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | //we ignore anything with no value |
| 191 | 191 | $clean = trim($value, "\x00..\x1F"); |
| 192 | - if ($clean==='') { |
|
| 192 | + if ($clean === '') { |
|
| 193 | 193 | continue; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | //we tolerate unexpected values and treat them as array types |
| 201 | 201 | //named after the code if we don't have a definition for it |
| 202 | 202 | if (!isset(self::$mapCodeToVarDef[$field])) { |
| 203 | - self::$mapCodeToVarDef[$field]=[ |
|
| 203 | + self::$mapCodeToVarDef[$field] = [ |
|
| 204 | 204 | 'name' => $field, |
| 205 | 205 | 'type' => 'array' |
| 206 | 206 | ]; |
| 207 | - $name=$field; |
|
| 207 | + $name = $field; |
|
| 208 | 208 | } else { |
| 209 | 209 | $name = self::$mapCodeToVarDef[$field]['name']; |
| 210 | 210 | } |