@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $bAlphaNum = false; |
| 87 | 87 | if (strlen($strCheck) == 17) {
|
| 88 | 88 | $strRegEx = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){3}([0-9]){10}?$/';
|
| 89 | - } else if(strlen($strCheck) == 20) {
|
|
| 89 | + } else if (strlen($strCheck) == 20) {
|
|
| 90 | 90 | $strRegEx = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){3}([0-9]){3}D([0-9]){9}?$/';
|
| 91 | 91 | $bAlphaNum = true; |
| 92 | 92 | } else {
|
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if (!preg_match($strRegEx, $strCheck)) {
|
| 100 | 100 | return Sepa::ERR_CI_INVALID_SIGN; |
| 101 | 101 | } |
| 102 | - $strCS = substr($strCheck, 2, 2); |
|
| 102 | + $strCS = substr($strCheck, 2, 2); |
|
| 103 | 103 | // NOTE: the CBC is not taken into account when calculating the checksum! |
| 104 | 104 | $strCheck = substr($strCheck, 7); |
| 105 | 105 | if ($bAlphaNum) {
|
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | return Sepa::ERR_CI_INVALID_SIGN; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $strCS = substr($strCheck, 2, 2); |
|
| 165 | + $strCS = substr($strCheck, 2, 2); |
|
| 166 | 166 | // NOTE: the CBC is not taken into account when calculating the checksum! |
| 167 | - $strCheck = substr($strCheck, 7); |
|
| 167 | + $strCheck = substr($strCheck, 7); |
|
| 168 | 168 | if ($this->bAlphaNumCI) {
|
| 169 | 169 | $strCheck = $this->replaceAlpha($strCheck); |
| 170 | 170 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | // 3. subtract value from 98 |
| 200 | 200 | $strCS = $this->adjustFP(bcsub('98', $strCS2));
|
| 201 | 201 | // 4. always 2 digits... |
| 202 | - if (strlen($strCS) < 2 ) {
|
|
| 202 | + if (strlen($strCS) < 2) {
|
|
| 203 | 203 | $strCS = '0' . $strCS; |
| 204 | 204 | } |
| 205 | 205 | $this->strLastCheckSum = $strCS; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | protected function adjustFP(string $str) : string |
| 217 | 217 | {
|
| 218 | - if( strpos( '.', $str ) !== false ) {
|
|
| 218 | + if (strpos('.', $str) !== false) {
|
|
| 219 | 219 | $str = substr($str, 0, strpos('.', $str));
|
| 220 | 220 | } |
| 221 | 221 | return $str; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | protected function replaceAlpha(string $strCheck) : string |
| 242 | 242 | {
|
| 243 | 243 | // account number may contains characters |
| 244 | - foreach (range('A', 'Z') as $ch){
|
|
| 244 | + foreach (range('A', 'Z') as $ch) {
|
|
| 245 | 245 | $strCheck = str_replace((string)$ch, $this->convCharToNum((string)$ch), $strCheck); |
| 246 | 246 | } |
| 247 | 247 | return $strCheck; |
@@ -39,12 +39,12 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public static function createUID() : string |
| 41 | 41 | {
|
| 42 | - mt_srand((int) microtime(true) * 10000); |
|
| 43 | - $charid = strtoupper(md5(uniqid((string) rand(), true))); |
|
| 44 | - $uuid = substr($charid, 0, 8) . chr(45) |
|
| 42 | + mt_srand((int)microtime(true) * 10000); |
|
| 43 | + $charid = strtoupper(md5(uniqid((string)rand(), true))); |
|
| 44 | + $uuid = substr($charid, 0, 8) . chr(45) |
|
| 45 | 45 | .substr($charid, 8, 4) . chr(45) |
| 46 | 46 | .substr($charid, 12, 4) . chr(45) |
| 47 | - .substr($charid, 16,12); |
|
| 47 | + .substr($charid, 16, 12); |
|
| 48 | 48 | |
| 49 | 49 | return $uuid; |
| 50 | 50 | } |