@@ -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,7 +132,7 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | //@codeCoverageIgnoreEnd |
| 134 | 134 | |
| 135 | - $result = $result . $terminator; |
|
| 135 | + $result = $result.$terminator; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $this->logger->info("SIP2: result={$result}"); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $this->logger->warning("SIP2: Message failed CRC check, retry {$depth})"); |
| 148 | 148 | $result = $this->getRawResponse($request, $depth); |
| 149 | 149 | } else { |
| 150 | - $errMsg="SIP2: Failed to get valid CRC after {$this->maxretry} retries."; |
|
| 150 | + $errMsg = "SIP2: Failed to get valid CRC after {$this->maxretry} retries."; |
|
| 151 | 151 | $this->logger->critical($errMsg); |
| 152 | 152 | throw new RuntimeException($errMsg); |
| 153 | 153 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $this->socket = $this->createClient($address, $bind, $timeout); |
| 175 | 175 | } catch (\Exception $e) { |
| 176 | 176 | $this->socket = null; |
| 177 | - $this->logger->error("SIP2Client: Failed to connect: " . $e->getMessage()); |
|
| 177 | + $this->logger->error("SIP2Client: Failed to connect: ".$e->getMessage()); |
|
| 178 | 178 | throw new RuntimeException("Connection failure", 0, $e); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | const AG_PRINT_LINE = 'AG'; |
| 26 | 26 | const AH_DUE_DATE = 'AH'; |
| 27 | 27 | const AJ_TITLE_IDENTIFIER = 'AJ'; |
| 28 | - const AM_LIBRARY_NAME='AM'; |
|
| 29 | - const AN_TERMINAL_LOCATION='AN'; |
|
| 28 | + const AM_LIBRARY_NAME = 'AM'; |
|
| 29 | + const AN_TERMINAL_LOCATION = 'AN'; |
|
| 30 | 30 | const AO_INSTITUTION_ID = 'AO'; |
| 31 | 31 | const AP_CURRENT_LOCATION = 'AP'; |
| 32 | - const AQ_PERMANENT_LOCATION='AQ'; |
|
| 32 | + const AQ_PERMANENT_LOCATION = 'AQ'; |
|
| 33 | 33 | const AS_HOLD_ITEMS = 'AS'; |
| 34 | 34 | const AT_OVERDUE_ITEMS = 'AT'; |
| 35 | 35 | const AU_CHARGED_ITEMS = 'AU'; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | const BF_HOME_PHONE_NUMBER = 'BF'; |
| 41 | 41 | const BG_OWNER = 'BG'; |
| 42 | 42 | const BH_CURRENCY_TYPE = 'BH'; |
| 43 | - const BK_TRANSACTION_ID= 'BK'; |
|
| 43 | + const BK_TRANSACTION_ID = 'BK'; |
|
| 44 | 44 | const BL_VALID_PATRON = 'BL'; |
| 45 | 45 | const BM_RENEWED_ITEMS = 'BM'; |
| 46 | 46 | const BN_UNRENEWED_ITEMS = 'BN'; |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | const BU_RECALL_ITEMS = 'BU'; |
| 51 | 51 | const BV_FEE_AMOUNT = 'BV'; |
| 52 | 52 | const BW_EXPIRATION_DATE = 'BW'; |
| 53 | - const BX_SUPPORTED_MESSAGES='BX'; |
|
| 53 | + const BX_SUPPORTED_MESSAGES = 'BX'; |
|
| 54 | 54 | const BZ_HOLD_ITEMS_LIMIT = 'BZ'; |
| 55 | 55 | const CA_OVERDUE_ITEMS_LIMIT = 'CA'; |
| 56 | 56 | const CB_CHARGED_ITEMS_LIMIT = 'CB'; |
| 57 | 57 | const CC_FEE_LIMIT = 'CC'; |
| 58 | 58 | const CD_UNAVAILABLE_HOLD_ITEMS = 'CD'; |
| 59 | 59 | const CF_HOLD_QUEUE_LENGTH = 'CF'; |
| 60 | - const CH_ITEM_PROPERTIES= 'CH'; |
|
| 60 | + const CH_ITEM_PROPERTIES = 'CH'; |
|
| 61 | 61 | const CI_SECURITY_INHIBIT = 'CI'; |
| 62 | 62 | const CJ_RECALL_DATE = 'CJ'; |
| 63 | - const CK_MEDIA_TYPE= 'CK'; |
|
| 64 | - const CL_SORT_BIN='CL'; |
|
| 63 | + const CK_MEDIA_TYPE = 'CK'; |
|
| 64 | + const CL_SORT_BIN = 'CL'; |
|
| 65 | 65 | const CM_HOLD_PICKUP_DATE = 'CM'; |
| 66 | 66 | const CQ_VALID_PATRON_PASSWORD = 'CQ'; |
| 67 | 67 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public static function parse($raw): SIP2Response |
| 139 | 139 | { |
| 140 | 140 | if (empty($raw) || !self::checkCRC($raw)) { |
| 141 | - throw new LogicException("Empty string or bad CRC not expected here");//@codeCoverageIgnore |
|
| 141 | + throw new LogicException("Empty string or bad CRC not expected here"); //@codeCoverageIgnore |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $type = substr($raw, 0, 2); |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | public static function checkCRC($raw) |
| 155 | 155 | { |
| 156 | 156 | if (preg_match('/^(.*AZ)(.{4})$/', trim($raw), $match)) { |
| 157 | - $plaintext=$match[1]; |
|
| 158 | - $checksum=$match[2]; |
|
| 157 | + $plaintext = $match[1]; |
|
| 158 | + $checksum = $match[2]; |
|
| 159 | 159 | return self::crc($plaintext) == $checksum; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | //we ignore anything with no value |
| 186 | 186 | $clean = trim($value, "\x00..\x1F"); |
| 187 | - if ($clean==='') { |
|
| 187 | + if ($clean === '') { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | //we tolerate unexpected values and treat them as array types |
| 196 | 196 | //named after the code if we don't have a definition for it |
| 197 | 197 | if (!isset(self::$mapCodeToVarDef[$field])) { |
| 198 | - self::$mapCodeToVarDef[$field]=[ |
|
| 198 | + self::$mapCodeToVarDef[$field] = [ |
|
| 199 | 199 | 'name' => $field, |
| 200 | 200 | 'type' => 'array' |
| 201 | 201 | ]; |
| 202 | - $name=$field; |
|
| 202 | + $name = $field; |
|
| 203 | 203 | } else { |
| 204 | 204 | $name = self::$mapCodeToVarDef[$field]['name']; |
| 205 | 205 | } |