Completed
Branch develop (2dd6cc)
by
unknown
26:03
created
htdocs/includes/webklex/php-imap/src/ClientManager.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
     public static function get($key, $default = null) {
77 77
         $parts = explode('.', $key);
78 78
         $value = null;
79
-        foreach($parts as $part) {
80
-            if($value === null) {
81
-                if(isset(self::$config[$part])) {
79
+        foreach ($parts as $part) {
80
+            if ($value === null) {
81
+                if (isset(self::$config[$part])) {
82 82
                     $value = self::$config[$part];
83
-                }else{
83
+                } else {
84 84
                     break;
85 85
                 }
86
-            }else{
87
-                if(isset($value[$part])) {
86
+            } else {
87
+                if (isset($value[$part])) {
88 88
                     $value = $value[$part];
89
-                }else{
89
+                } else {
90 90
                     break;
91 91
                 }
92 92
             }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function setConfig($config) {
178 178
 
179
-        if(is_array($config) === false) {
179
+        if (is_array($config) === false) {
180 180
             $config = require $config;
181 181
         }
182 182
 
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
         $vendor_config = require $path;
187 187
         $config = $this->array_merge_recursive_distinct($vendor_config, $config);
188 188
 
189
-        if(is_array($config)){
190
-            if(isset($config['default'])){
191
-                if(isset($config['accounts']) && $config['default'] != false){
189
+        if (is_array($config)) {
190
+            if (isset($config['default'])) {
191
+                if (isset($config['accounts']) && $config['default'] != false) {
192 192
 
193 193
                     $default_config = $vendor_config['accounts']['default'];
194
-                    if(isset($config['accounts'][$config['default']])){
194
+                    if (isset($config['accounts'][$config['default']])) {
195 195
                         $default_config = array_merge($default_config, $config['accounts'][$config['default']]);
196 196
                     }
197 197
 
198
-                    if(is_array($config['accounts'])){
199
-                        foreach($config['accounts'] as $account_key => $account){
198
+                    if (is_array($config['accounts'])) {
199
+                        foreach ($config['accounts'] as $account_key => $account) {
200 200
                             $config['accounts'][$account_key] = array_merge($default_config, $account);
201 201
                         }
202 202
                     }
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
         $arrays = func_get_args();
233 233
         $base = array_shift($arrays);
234 234
 
235
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
235
+        if (!is_array($base)) $base = empty($base) ? array() : array($base);
236 236
 
237
-        foreach($arrays as $append) {
237
+        foreach ($arrays as $append) {
238 238
 
239
-            if(!is_array($append)) $append = array($append);
239
+            if (!is_array($append)) $append = array($append);
240 240
 
241
-            foreach($append as $key => $value) {
241
+            foreach ($append as $key => $value) {
242 242
 
243
-                if(!array_key_exists($key, $base) and !is_numeric($key)) {
243
+                if (!array_key_exists($key, $base) and !is_numeric($key)) {
244 244
                     $base[$key] = $append[$key];
245 245
                     continue;
246 246
                 }
247 247
 
248
-                if(is_array($value) or is_array($base[$key])) {
248
+                if (is_array($value) or is_array($base[$key])) {
249 249
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
250
-                } else if(is_numeric($key)) {
251
-                    if(!in_array($value, $base)) $base[] = $value;
250
+                } else if (is_numeric($key)) {
251
+                    if (!in_array($value, $base)) $base[] = $value;
252 252
                 } else {
253 253
                     $base[$key] = $value;
254 254
                 }
Please login to merge, or discard this patch.
htdocs/includes/webklex/php-imap/src/Header.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
      * @throws MethodNotFoundException
83 83
      */
84 84
     public function __call($method, $arguments) {
85
-        if(strtolower(substr($method, 0, 3)) === 'get') {
85
+        if (strtolower(substr($method, 0, 3)) === 'get') {
86 86
             $name = preg_replace('/(.)(?=[A-Z])/u', '$1_', substr(strtolower($method), 3));
87 87
 
88
-            if(in_array($name, array_keys($this->attributes))) {
88
+            if (in_array($name, array_keys($this->attributes))) {
89 89
                 return $this->attributes[$name];
90 90
             }
91 91
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @return Attribute|mixed
112 112
      */
113 113
     public function get($name) {
114
-        if(isset($this->attributes[$name])) {
114
+        if (isset($this->attributes[$name])) {
115 115
             return $this->attributes[$name];
116 116
         }
117 117
 
@@ -127,23 +127,23 @@  discard block
 block discarded – undo
127 127
      * @return Attribute
128 128
      */
129 129
     public function set($name, $value, $strict = false) {
130
-        if(isset($this->attributes[$name]) && $strict === false) {
130
+        if (isset($this->attributes[$name]) && $strict === false) {
131 131
             if ($this->attributize) {
132 132
                 $this->attributes[$name]->add($value, true);
133
-            }else{
134
-                if(isset($this->attributes[$name])) {
133
+            } else {
134
+                if (isset($this->attributes[$name])) {
135 135
                     if (is_array($this->attributes[$name]) == false) {
136 136
                         $this->attributes[$name] = [$this->attributes[$name], $value];
137
-                    }else{
137
+                    } else {
138 138
                         $this->attributes[$name][] = $value;
139 139
                     }
140
-                }else{
140
+                } else {
141 141
                     $this->attributes[$name] = $value;
142 142
                 }
143 143
             }
144
-        }elseif($this->attributize == false){
144
+        }elseif ($this->attributize == false) {
145 145
             $this->attributes[$name] = $value;
146
-        }else{
146
+        } else {
147 147
             $this->attributes[$name] = new Attribute($name, $value);
148 148
         }
149 149
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     public function find($pattern) {
160 160
         if (preg_match_all($pattern, $this->raw, $matches)) {
161 161
             if (isset($matches[1])) {
162
-                if(count($matches[1]) > 0) {
162
+                if (count($matches[1]) > 0) {
163 163
                     return $matches[1][0];
164 164
                 }
165 165
             }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return string|null
174 174
      */
175
-    public function getBoundary(){
175
+    public function getBoundary() {
176 176
         $boundary = $this->find("/boundary\=(.*)/i");
177 177
 
178 178
         if ($boundary === null) {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      *
198 198
      * @throws InvalidMessageDateException
199 199
      */
200
-    protected function parse(){
200
+    protected function parse() {
201 201
         $header = $this->rfc822_parse_headers($this->raw);
202 202
 
203 203
         $this->extractAddresses($header);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $this->parseDate($header);
216 216
         foreach ($header as $key => $value) {
217 217
             $key = trim(rtrim(strtolower($key)));
218
-            if(!isset($this->attributes[$key])){
218
+            if (!isset($this->attributes[$key])) {
219 219
                 $this->set($key, $value);
220 220
             }
221 221
         }
@@ -231,19 +231,19 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return object
233 233
      */
234
-    public function rfc822_parse_headers($raw_headers){
234
+    public function rfc822_parse_headers($raw_headers) {
235 235
         $headers = [];
236 236
         $imap_headers = [];
237 237
         if (extension_loaded('imap') && $this->config["rfc822"]) {
238 238
             $raw_imap_headers = (array) \imap_rfc822_parse_headers($this->raw);
239
-            foreach($raw_imap_headers as $key => $values) {
239
+            foreach ($raw_imap_headers as $key => $values) {
240 240
                 $key = str_replace("-", "_", $key);
241 241
                 $imap_headers[$key] = $values;
242 242
             }
243 243
         }
244 244
         $lines = explode("\r\n", str_replace("\r\n\t", ' ', $raw_headers));
245 245
         $prev_header = null;
246
-        foreach($lines as $line) {
246
+        foreach ($lines as $line) {
247 247
             if (substr($line, 0, 1) === "\n") {
248 248
                 $line = substr($line, 1);
249 249
             }
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
                     }
264 264
                     if (is_array($headers[$prev_header])) {
265 265
                         $headers[$prev_header][] = $line;
266
-                    }else{
266
+                    } else {
267 267
                         $headers[$prev_header] .= $line;
268 268
                     }
269 269
                 }
270
-            }else{
270
+            } else {
271 271
                 if (($pos = strpos($line, ":")) > 0) {
272 272
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
273 273
                     $key = str_replace("-", "_", $key);
274 274
 
275 275
                     $value = trim(rtrim(substr($line, $pos + 1)));
276 276
                     if (isset($headers[$key])) {
277
-                        $headers[$key][]  = $value;
278
-                    }else{
277
+                        $headers[$key][] = $value;
278
+                    } else {
279 279
                         $headers[$key] = [$value];
280 280
                     }
281 281
                     $prev_header = $key;
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
             }
284 284
         }
285 285
 
286
-        foreach($headers as $key => $values) {
286
+        foreach ($headers as $key => $values) {
287 287
             if (isset($imap_headers[$key])) continue;
288 288
             $value = null;
289
-            switch($key){
289
+            switch ($key) {
290 290
                 case 'from':
291 291
                 case 'to':
292 292
                 case 'cc':
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                     break;
302 302
                 default:
303 303
                     if (is_array($values)) {
304
-                        foreach($values as $k => $v) {
304
+                        foreach ($values as $k => $v) {
305 305
                             if ($v == "") {
306 306
                                 unset($values[$k]);
307 307
                             }
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
      * @return array The decoded elements are returned in an array of objects, where each
334 334
      * object has two properties, charset and text.
335 335
      */
336
-    public function mime_header_decode($text){
336
+    public function mime_header_decode($text) {
337 337
         if (extension_loaded('imap')) {
338 338
             return \imap_mime_header_decode($text);
339 339
         }
340 340
         $charset = $this->getEncoding($text);
341
-        return [(object)[
341
+        return [(object) [
342 342
             "charset" => $charset,
343 343
             "text" => $this->convertEncoding($text, $charset)
344 344
         ]];
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             }
424 424
         }elseif (property_exists($structure, 'charset')) {
425 425
             return EncodingAliases::get($structure->charset, $this->fallback_encoding);
426
-        }elseif (is_string($structure) === true){
426
+        }elseif (is_string($structure) === true) {
427 427
             return mb_detect_encoding($structure);
428 428
         }
429 429
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         if ($value !== null) {
457 457
             $is_utf8_base = $this->is_uft8($value);
458 458
 
459
-            if($decoder === 'utf-8' && extension_loaded('imap')) {
459
+            if ($decoder === 'utf-8' && extension_loaded('imap')) {
460 460
                 $value = \imap_utf8($value);
461 461
                 $is_utf8_base = $this->is_uft8($value);
462 462
                 if ($is_utf8_base) {
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
                 if ($this->notDecoded($original_value, $value)) {
466 466
                     $decoded_value = $this->mime_header_decode($value);
467 467
                     if (count($decoded_value) > 0) {
468
-                        if(property_exists($decoded_value[0], "text")) {
468
+                        if (property_exists($decoded_value[0], "text")) {
469 469
                             $value = $decoded_value[0]->text;
470 470
                         }
471 471
                     }
472 472
                 }
473
-            }elseif($decoder === 'iconv' && $is_utf8_base) {
473
+            }elseif ($decoder === 'iconv' && $is_utf8_base) {
474 474
                 $value = iconv_mime_decode($value);
475
-            }elseif($is_utf8_base){
475
+            }elseif ($is_utf8_base) {
476 476
                 $value = mb_decode_mimeheader($value);
477 477
             }
478 478
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      * @return array
496 496
      */
497 497
     private function decodeArray($values) {
498
-        foreach($values as $key => $value) {
498
+        foreach ($values as $key => $value) {
499 499
             $values[$key] = $this->decode($value);
500 500
         }
501 501
         return $values;
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
      * Try to extract the priority from a given raw header string
506 506
      */
507 507
     private function findPriority() {
508
-        if(($priority = $this->get("x_priority")) === null) return;
509
-        switch((int)"$priority"){
508
+        if (($priority = $this->get("x_priority")) === null) return;
509
+        switch ((int) "$priority") {
510 510
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
511 511
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
512 512
                 break;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
                     if (isset($parsed_address['address'])) {
546 546
                         $mail_address = explode('@', $parsed_address['address']);
547 547
                         if (count($mail_address) == 2) {
548
-                            $addresses[] = (object)[
548
+                            $addresses[] = (object) [
549 549
                                 "personal" => isset($parsed_address['display']) ? $parsed_address['display'] : '',
550 550
                                 "mailbox" => $mail_address[0],
551 551
                                 "host" => $mail_address[1],
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
             return $addresses;
559 559
         }
560 560
 
561
-        foreach($values as $address) {
561
+        foreach ($values as $address) {
562 562
             foreach (preg_split('/, (?=(?:[^"]*"[^"]*")*[^"]*$)/', $address) as $split_address) {
563 563
                 $split_address = trim(rtrim($split_address));
564 564
 
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                     $name = trim(rtrim($matches["name"]));
574 574
                     $email = trim(rtrim($matches["email"]));
575 575
                     list($mailbox, $host) = array_pad(explode("@", $email), 2, null);
576
-                    $addresses[] = (object)[
576
+                    $addresses[] = (object) [
577 577
                         "personal" => $name,
578 578
                         "mailbox" => $mailbox,
579 579
                         "host" => $host,
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
      * @param object $header
591 591
      */
592 592
     private function extractAddresses($header) {
593
-        foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key){
593
+        foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key) {
594 594
             if (property_exists($header, $key)) {
595 595
                 $this->set($key, $this->parseAddresses($header->$key));
596 596
             }
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
             } else {
625 625
                 $personalParts = $this->mime_header_decode($address->personal);
626 626
 
627
-                if(is_array($personalParts)) {
627
+                if (is_array($personalParts)) {
628 628
                     $address->personal = '';
629 629
                     foreach ($personalParts as $p) {
630 630
                         $address->personal .= $this->convertEncoding($p->text, $this->getEncoding($p));
@@ -648,23 +648,23 @@  discard block
 block discarded – undo
648 648
     /**
649 649
      * Search and extract potential header extensions
650 650
      */
651
-    private function extractHeaderExtensions(){
651
+    private function extractHeaderExtensions() {
652 652
         foreach ($this->attributes as $key => $value) {
653 653
             if (is_array($value)) {
654 654
                 $value = implode(", ", $value);
655
-            }else{
656
-                $value = (string)$value;
655
+            } else {
656
+                $value = (string) $value;
657 657
             }
658 658
             // Only parse strings and don't parse any attributes like the user-agent
659 659
             if (in_array($key, ["user_agent"]) === false) {
660
-                if (($pos = strpos($value, ";")) !== false){
660
+                if (($pos = strpos($value, ";")) !== false) {
661 661
                     $original = substr($value, 0, $pos);
662 662
                     $this->set($key, trim(rtrim($original)), true);
663 663
 
664 664
                     // Get all potential extensions
665 665
                     $extensions = explode(";", substr($value, $pos + 1));
666
-                    foreach($extensions as $extension) {
667
-                        if (($pos = strpos($extension, "=")) !== false){
666
+                    foreach ($extensions as $extension) {
667
+                        if (($pos = strpos($extension, "=")) !== false) {
668 668
                             $key = substr($extension, 0, $pos);
669 669
                             $key = trim(rtrim(strtolower($key)));
670 670
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
             $parsed_date = null;
708 708
             $date = $header->date;
709 709
 
710
-            if(preg_match('/\+0580/', $date)) {
710
+            if (preg_match('/\+0580/', $date)) {
711 711
                 $date = str_replace('+0580', '+0530', $date);
712 712
             }
713 713
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                         $date = trim(array_pop($array));
731 731
                         break;
732 732
                 }
733
-                try{
733
+                try {
734 734
                     $parsed_date = Carbon::parse($date);
735 735
                 } catch (\Exception $_e) {
736 736
                     throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id"), 1100, $e);
Please login to merge, or discard this patch.
htdocs/includes/webklex/php-imap/src/Message.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $this->boot();
193 193
 
194 194
         $default_mask = $client->getDefaultMessageMask();
195
-        if($default_mask != null) {
195
+        if ($default_mask != null) {
196 196
             $this->mask = $default_mask;
197 197
         }
198 198
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
      * @throws Exceptions\RuntimeException
247 247
      * @throws Exceptions\MessageNotFoundException
248 248
      */
249
-    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){
249
+    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) {
250 250
         $reflection = new ReflectionClass(self::class);
251 251
         /** @var self $instance */
252 252
         $instance = $reflection->newInstanceWithoutConstructor();
253 253
         $instance->boot();
254 254
 
255 255
         $default_mask = $client->getDefaultMessageMask();
256
-        if($default_mask != null) {
256
+        if ($default_mask != null) {
257 257
             $instance->setMask($default_mask);
258 258
         }
259 259
         $instance->setEvents([
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     /**
279 279
      * Boot a new instance
280 280
      */
281
-    public function boot(){
281
+    public function boot() {
282 282
         $this->attributes = [];
283 283
 
284 284
         $this->config = ClientManager::get('options');
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
      * @throws MethodNotFoundException
298 298
      */
299 299
     public function __call($method, $arguments) {
300
-        if(strtolower(substr($method, 0, 3)) === 'get') {
300
+        if (strtolower(substr($method, 0, 3)) === 'get') {
301 301
             $name = Str::snake(substr($method, 3));
302 302
             return $this->get($name);
303 303
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
304 304
             $name = Str::snake(substr($method, 3));
305 305
 
306
-            if(in_array($name, array_keys($this->attributes))) {
306
+            if (in_array($name, array_keys($this->attributes))) {
307 307
                 return $this->__set($name, array_pop($arguments));
308 308
             }
309 309
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      * @return Attribute|mixed|null
343 343
      */
344 344
     public function get($name) {
345
-        if(isset($this->attributes[$name])) {
345
+        if (isset($this->attributes[$name])) {
346 346
             return $this->attributes[$name];
347 347
         }
348 348
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      *
417 417
      * @throws InvalidMessageDateException
418 418
      */
419
-    public function parseRawHeader($raw_header){
419
+    public function parseRawHeader($raw_header) {
420 420
         $this->header = new Header($raw_header);
421 421
     }
422 422
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
     public function parseRawFlags($raw_flags) {
428 428
         $this->flags = FlagCollection::make([]);
429 429
 
430
-        foreach($raw_flags as $flag) {
431
-            if (strpos($flag, "\\") === 0){
430
+        foreach ($raw_flags as $flag) {
431
+            if (strpos($flag, "\\") === 0) {
432 432
                 $flag = substr($flag, 1);
433 433
             }
434 434
             $flag_key = strtolower($flag);
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      * @throws MessageFlagException
502 502
      * @throws Exceptions\RuntimeException
503 503
      */
504
-    public function peek(){
504
+    public function peek() {
505 505
         if ($this->fetch_options == IMAP::FT_PEEK) {
506 506
             if ($this->getFlags()->get("seen") == null) {
507 507
                 $this->unsetFlag("Seen");
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     private function fetchPart(Part $part) {
551 551
         if ($part->isAttachment()) {
552 552
             $this->fetchAttachment($part);
553
-        }else{
553
+        } else {
554 554
             $encoding = $this->getEncoding($part);
555 555
 
556 556
             $content = $this->decodeString($part->content, $part->encoding);
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
             if (isset($this->bodies[$subtype])) {
577 577
                 $this->bodies[$subtype] .= "\n".$content;
578
-            }else{
578
+            } else {
579 579
                 $this->bodies[$subtype] = $content;
580 580
             }
581 581
         }
@@ -746,9 +746,9 @@  discard block
 block discarded – undo
746 746
                     return EncodingAliases::get($parameter->value);
747 747
                 }
748 748
             }
749
-        }elseif (property_exists($structure, 'charset')){
749
+        }elseif (property_exists($structure, 'charset')) {
750 750
             return EncodingAliases::get($structure->charset);
751
-        }elseif (is_string($structure) === true){
751
+        }elseif (is_string($structure) === true) {
752 752
             return mb_detect_encoding($structure);
753 753
         }
754 754
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
      * @throws Exceptions\FolderFetchingException
764 764
      * @throws Exceptions\RuntimeException
765 765
      */
766
-    public function getFolder(){
766
+    public function getFolder() {
767 767
         return $this->client->getFolderByPath($this->folder_path);
768 768
     }
769 769
 
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
      * @throws Exceptions\GetMessagesFailedException
780 780
      * @throws Exceptions\RuntimeException
781 781
      */
782
-    public function thread($sent_folder = null, &$thread = null, $folder = null){
782
+    public function thread($sent_folder = null, &$thread = null, $folder = null) {
783 783
         $thread = $thread ? $thread : MessageCollection::make([]);
784
-        $folder = $folder ? $folder :  $this->getFolder();
784
+        $folder = $folder ? $folder : $this->getFolder();
785 785
         $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
786 786
 
787 787
         /** @var Message $message */
788
-        foreach($thread as $message) {
788
+        foreach ($thread as $message) {
789 789
             if ($message->message_id->first() == $this->message_id->first()) {
790 790
                 return $thread;
791 791
             }
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
797 797
 
798 798
         if (is_array($this->in_reply_to)) {
799
-            foreach($this->in_reply_to as $in_reply_to) {
799
+            foreach ($this->in_reply_to as $in_reply_to) {
800 800
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
801 801
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
802 802
             }
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
      * @throws Exceptions\GetMessagesFailedException
818 818
      * @throws Exceptions\RuntimeException
819 819
      */
820
-    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){
820
+    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) {
821 821
         $primary_folder->query()->inReplyTo($in_reply_to)
822 822
         ->setFetchBody($this->getFetchBodyOption())
823 823
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
      * @throws Exceptions\GetMessagesFailedException
839 839
      * @throws Exceptions\RuntimeException
840 840
      */
841
-    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){
841
+    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) {
842 842
         $primary_folder->query()->messageId($message_id)
843 843
         ->setFetchBody($this->getFetchBodyOption())
844 844
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
      * @throws MessageFlagException
935 935
      * @throws MessageHeaderFetchingException
936 936
      */
937
-    protected function fetchNewMail($folder, $next_uid, $event, $expunge){
938
-        if($expunge) $this->client->expunge();
937
+    protected function fetchNewMail($folder, $next_uid, $event, $expunge) {
938
+        if ($expunge) $this->client->expunge();
939 939
 
940 940
         $this->client->openFolder($folder->path);
941 941
 
942 942
         if ($this->sequence === IMAP::ST_UID) {
943 943
             $sequence_id = $next_uid;
944
-        }else{
944
+        } else {
945 945
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
946 946
         }
947 947
 
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
      */
965 965
     public function delete($expunge = true) {
966 966
         $status = $this->setFlag("Deleted");
967
-        if($expunge) $this->client->expunge();
967
+        if ($expunge) $this->client->expunge();
968 968
 
969 969
         $event = $this->getEvent("message", "deleted");
970 970
         $event::dispatch($this);
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
      */
985 985
     public function restore($expunge = true) {
986 986
         $status = $this->unsetFlag("Deleted");
987
-        if($expunge) $this->client->expunge();
987
+        if ($expunge) $this->client->expunge();
988 988
 
989 989
         $event = $this->getEvent("message", "restored");
990 990
         $event::dispatch($this);
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
      *
1090 1090
      * @return AttachmentCollection
1091 1091
      */
1092
-    public function attachments(){
1092
+    public function attachments() {
1093 1093
         return $this->getAttachments();
1094 1094
     }
1095 1095
 
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
      *
1188 1188
      * @return FlagCollection
1189 1189
      */
1190
-    public function flags(){
1190
+    public function flags() {
1191 1191
         return $this->getFlags();
1192 1192
     }
1193 1193
 
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
      *
1197 1197
      * @return Structure|null
1198 1198
      */
1199
-    public function getStructure(){
1199
+    public function getStructure() {
1200 1200
         return $this->structure;
1201 1201
     }
1202 1202
 
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
      *
1223 1223
      * @return array
1224 1224
      */
1225
-    public function getAttributes(){
1225
+    public function getAttributes() {
1226 1226
         return array_merge($this->attributes, $this->header->getAttributes());
1227 1227
     }
1228 1228
 
@@ -1232,8 +1232,8 @@  discard block
 block discarded – undo
1232 1232
      *
1233 1233
      * @return $this
1234 1234
      */
1235
-    public function setMask($mask){
1236
-        if(class_exists($mask)){
1235
+    public function setMask($mask) {
1236
+        if (class_exists($mask)) {
1237 1237
             $this->mask = $mask;
1238 1238
         }
1239 1239
 
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
      *
1246 1246
      * @return string
1247 1247
      */
1248
-    public function getMask(){
1248
+    public function getMask() {
1249 1249
         return $this->mask;
1250 1250
     }
1251 1251
 
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
      * @return mixed
1257 1257
      * @throws MaskNotFoundException
1258 1258
      */
1259
-    public function mask($mask = null){
1259
+    public function mask($mask = null) {
1260 1260
         $mask = $mask !== null ? $mask : $this->mask;
1261
-        if(class_exists($mask)){
1261
+        if (class_exists($mask)) {
1262 1262
             return new $mask($this);
1263 1263
         }
1264 1264
 
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
      *
1271 1271
      * @return string
1272 1272
      */
1273
-    public function getFolderPath(){
1273
+    public function getFolderPath() {
1274 1274
         return $this->folder_path;
1275 1275
     }
1276 1276
 
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
      *
1281 1281
      * @return $this
1282 1282
      */
1283
-    public function setFolderPath($folder_path){
1283
+    public function setFolderPath($folder_path) {
1284 1284
         $this->folder_path = $folder_path;
1285 1285
 
1286 1286
         return $this;
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
      *
1293 1293
      * @return $this
1294 1294
      */
1295
-    public function setConfig($config){
1295
+    public function setConfig($config) {
1296 1296
         $this->config = $config;
1297 1297
 
1298 1298
         return $this;
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
      *
1305 1305
      * @return $this
1306 1306
      */
1307
-    public function setAvailableFlags($available_flags){
1307
+    public function setAvailableFlags($available_flags) {
1308 1308
         $this->available_flags = $available_flags;
1309 1309
 
1310 1310
         return $this;
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
      *
1317 1317
      * @return $this
1318 1318
      */
1319
-    public function setAttachments($attachments){
1319
+    public function setAttachments($attachments) {
1320 1320
         $this->attachments = $attachments;
1321 1321
 
1322 1322
         return $this;
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
      *
1329 1329
      * @return $this
1330 1330
      */
1331
-    public function setFlags($flags){
1331
+    public function setFlags($flags) {
1332 1332
         $this->flags = $flags;
1333 1333
 
1334 1334
         return $this;
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
      * @throws Exceptions\RuntimeException
1343 1343
      * @throws Exceptions\ConnectionFailedException
1344 1344
      */
1345
-    public function setClient($client){
1345
+    public function setClient($client) {
1346 1346
         $this->client = $client;
1347 1347
         $this->client->openFolder($this->folder_path);
1348 1348
 
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
      * @throws Exceptions\MessageNotFoundException
1358 1358
      * @throws Exceptions\ConnectionFailedException
1359 1359
      */
1360
-    public function setUid($uid){
1360
+    public function setUid($uid) {
1361 1361
         $this->uid = $uid;
1362 1362
         $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid);
1363 1363
         $this->msglist = null;
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
      * @throws Exceptions\MessageNotFoundException
1375 1375
      * @throws Exceptions\ConnectionFailedException
1376 1376
      */
1377
-    public function setMsgn($msgn, $msglist = null){
1377
+    public function setMsgn($msgn, $msglist = null) {
1378 1378
         $this->msgn = $msgn;
1379 1379
         $this->msglist = $msglist;
1380 1380
         $this->uid = $this->client->getConnection()->getUid($this->msgn);
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
      *
1388 1388
      * @return int
1389 1389
      */
1390
-    public function getSequence(){
1390
+    public function getSequence() {
1391 1391
         return $this->sequence;
1392 1392
     }
1393 1393
 
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
      *
1397 1397
      * @return int
1398 1398
      */
1399
-    public function getSequenceId(){
1399
+    public function getSequenceId() {
1400 1400
         return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn;
1401 1401
     }
1402 1402
 
@@ -1408,11 +1408,11 @@  discard block
 block discarded – undo
1408 1408
      * @throws Exceptions\ConnectionFailedException
1409 1409
      * @throws Exceptions\MessageNotFoundException
1410 1410
      */
1411
-    public function setSequenceId($uid, $msglist = null){
1411
+    public function setSequenceId($uid, $msglist = null) {
1412 1412
         if ($this->getSequence() === IMAP::ST_UID) {
1413 1413
             $this->setUid($uid);
1414 1414
             $this->setMsglist($msglist);
1415
-        }else{
1415
+        } else {
1416 1416
             $this->setMsgn($uid, $msglist);
1417 1417
         }
1418 1418
     }
Please login to merge, or discard this patch.
htdocs/includes/webklex/php-imap/src/Traits/HasEvents.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
      *
71 71
      * @return array
72 72
      */
73
-    public function getEvents(){
73
+    public function getEvents() {
74 74
         return $this->events;
75 75
     }
76 76
 
Please login to merge, or discard this patch.
htdocs/includes/php-iban/oophp-iban.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
   $this->iban = $iban;
10 10
  }
11 11
 
12
- public function Verify($iban='',$machine_format_only=false) {
13
-  if($iban!='') { return verify_iban($iban,$machine_format_only); }
14
-  return verify_iban($this->iban,$machine_format_only);
12
+ public function Verify($iban = '', $machine_format_only = false) {
13
+  if ($iban != '') { return verify_iban($iban, $machine_format_only); }
14
+  return verify_iban($this->iban, $machine_format_only);
15 15
   # we could throw exceptions of various types, but why - does it really
16 16
   # add anything? possibly some slightly better user feedback potential.
17 17
   # however, this can be written by hand by performing individual checks
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
   # maintenance/documentation cost, i say, therefore: no. no exceptions.
21 21
  }
22 22
 
23
- public function VerifyMachineFormatOnly($iban='') {
24
-  if($iban!='') { return verify_iban($iban,true); }
25
-  return verify_iban($this->iban,true);
23
+ public function VerifyMachineFormatOnly($iban = '') {
24
+  if ($iban != '') { return verify_iban($iban, true); }
25
+  return verify_iban($this->iban, true);
26 26
  }
27 27
 
28 28
  public function MistranscriptionSuggestions() {
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
   return iban_to_obfuscated_format($this->iban);
42 42
  }
43 43
 
44
- public function Country($iban='') {
44
+ public function Country($iban = '') {
45 45
   return iban_get_country_part($this->iban);
46 46
  }
47 47
 
48
- public function Checksum($iban='') {
48
+ public function Checksum($iban = '') {
49 49
   return iban_get_checksum_part($this->iban);
50 50
  }
51 51
 
52
- public function NationalChecksum($iban='') {
52
+ public function NationalChecksum($iban = '') {
53 53
   return iban_get_nationalchecksum_part($this->iban);
54 54
  }
55 55
 
Please login to merge, or discard this patch.
htdocs/includes/php-iban/php-iban.php 1 patch
Spacing   +313 added lines, -313 removed lines patch added patch discarded remove patch
@@ -3,22 +3,22 @@  discard block
 block discarded – undo
3 3
 # PHP IBAN - http://github.com/globalcitizen/php-iban - LGPLv3
4 4
 
5 5
 # Global flag by request
6
-$__disable_iiban_gmp_extension=false;
6
+$__disable_iiban_gmp_extension = false;
7 7
 
8 8
 # Verify an IBAN number.
9 9
 #  If $machine_format_only, do not tolerate unclean (eg. spaces, dashes, leading 'IBAN ' or 'IIBAN ', lower case) input.
10 10
 #  (Otherwise, input can be printed 'IIBAN xx xx xx...' or 'IBAN xx xx xx...' or machine 'xxxxx' format.)
11 11
 #  Returns true or false.
12
-function verify_iban($iban,$machine_format_only=false) {
12
+function verify_iban($iban, $machine_format_only = false) {
13 13
 
14 14
  # First convert to machine format.
15
- if(!$machine_format_only) { $iban = iban_to_machine_format($iban); }
15
+ if (!$machine_format_only) { $iban = iban_to_machine_format($iban); }
16 16
 
17 17
  # Get country of IBAN
18 18
  $country = iban_get_country_part($iban);
19 19
 
20 20
  # Test length of IBAN
21
- if(strlen($iban)!=iban_country_get_iban_length($country)) { return false; }
21
+ if (strlen($iban) != iban_country_get_iban_length($country)) { return false; }
22 22
 
23 23
  # Get checksum of IBAN
24 24
  $checksum = iban_get_checksum_part($iban);
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
  $regex = '/'.iban_country_get_iban_format_regex($country).'/';
28 28
 
29 29
  # Check regex
30
- if(preg_match($regex,$iban)) {
30
+ if (preg_match($regex, $iban)) {
31 31
   # Regex passed, check checksum
32
-  if(!iban_verify_checksum($iban)) { 
32
+  if (!iban_verify_checksum($iban)) { 
33 33
    return false;
34 34
   }
35 35
  }
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
  # Uppercase and trim spaces from left
49 49
  $iban = ltrim(strtoupper($iban));
50 50
  # Remove IIBAN or IBAN from start of string, if present
51
- $iban = preg_replace('/^I?IBAN/','',$iban);
51
+ $iban = preg_replace('/^I?IBAN/', '', $iban);
52 52
  # Remove all non basic roman letter / digit characters
53
- $iban = preg_replace('/[^a-zA-Z0-9]/','',$iban);
53
+ $iban = preg_replace('/[^a-zA-Z0-9]/', '', $iban);
54 54
  return $iban;
55 55
 }
56 56
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 # http://www.europeanpaymentscouncil.eu/knowledge_bank_download.cfm?file=ECBS%20standard%20implementation%20guidelines%20SIG203V3.2.pdf 
62 62
 function iban_to_human_format($iban) {
63 63
  # Remove all spaces
64
- $iban = str_replace(' ','',$iban);
64
+ $iban = str_replace(' ', '', $iban);
65 65
  # Add spaces every four characters
66
- return wordwrap($iban,4,' ',true);
66
+ return wordwrap($iban, 4, ' ', true);
67 67
 }
68 68
 
69 69
 # Convert an IBAN to obfuscated presentation. To do this, we
@@ -84,30 +84,30 @@  discard block
 block discarded – undo
84 84
 # unambiguous relative identification.
85 85
 function iban_to_obfuscated_format($iban) {
86 86
  $iban = iban_to_machine_format($iban);
87
- $tr = substr($iban,0,2);
88
- for($i=2;$i<strlen($iban)-4;$i++) {
87
+ $tr = substr($iban, 0, 2);
88
+ for ($i = 2; $i < strlen($iban) - 4; $i++) {
89 89
   $tr .= '*';
90 90
  }
91
- $tr .= substr($iban,strlen($iban)-4);
91
+ $tr .= substr($iban, strlen($iban) - 4);
92 92
  return iban_to_human_format($tr);
93 93
 }
94 94
 
95 95
 # Get the country part from an IBAN
96 96
 function iban_get_country_part($iban) {
97 97
  $iban = iban_to_machine_format($iban);
98
- return substr($iban,0,2);
98
+ return substr($iban, 0, 2);
99 99
 }
100 100
 
101 101
 # Get the checksum part from an IBAN
102 102
 function iban_get_checksum_part($iban) {
103 103
  $iban = iban_to_machine_format($iban);
104
- return substr($iban,2,2);
104
+ return substr($iban, 2, 2);
105 105
 }
106 106
 
107 107
 # Get the BBAN part from an IBAN
108 108
 function iban_get_bban_part($iban) {
109 109
  $iban = iban_to_machine_format($iban);
110
- return substr($iban,4);
110
+ return substr($iban, 4);
111 111
 }
112 112
 
113 113
 # Check the checksum of an IBAN - code modified from Validate_Finance PEAR class
@@ -132,31 +132,31 @@  discard block
 block discarded – undo
132 132
 function iban_find_checksum($iban) {
133 133
  $iban = iban_to_machine_format($iban);
134 134
  # move first 4 chars to right
135
- $left = substr($iban,0,2) . '00'; # but set right-most 2 (checksum) to '00'
136
- $right = substr($iban,4);
135
+ $left = substr($iban, 0, 2).'00'; # but set right-most 2 (checksum) to '00'
136
+ $right = substr($iban, 4);
137 137
  # glue back together
138
- $tmp = $right . $left;
138
+ $tmp = $right.$left;
139 139
  # convert letters using conversion table
140 140
  $tmp = iban_checksum_string_replace($tmp);
141 141
  # get mod97-10 output
142 142
  $checksum = iban_mod97_10_checksum($tmp);
143 143
  # return 98 minus the mod97-10 output, left zero padded to two digits
144
- return str_pad((98-$checksum),2,'0',STR_PAD_LEFT);
144
+ return str_pad((98 - $checksum), 2, '0', STR_PAD_LEFT);
145 145
 }
146 146
 
147 147
 # Set the correct checksum for an IBAN
148 148
 #  $iban  IBAN whose checksum should be set
149 149
 function iban_set_checksum($iban) {
150 150
  $iban = iban_to_machine_format($iban);
151
- return substr($iban,0,2) . iban_find_checksum($iban) . substr($iban,4);
151
+ return substr($iban, 0, 2).iban_find_checksum($iban).substr($iban, 4);
152 152
 }
153 153
 
154 154
 # Character substitution required for IBAN MOD97-10 checksum validation/generation
155 155
 #  $s  Input string (IBAN)
156 156
 function iban_checksum_string_replace($s) {
157
- $iban_replace_chars = range('A','Z');
158
- foreach (range(10,35) as $tempvalue) { $iban_replace_values[]=strval($tempvalue); }
159
- return str_replace($iban_replace_chars,$iban_replace_values,$s);
157
+ $iban_replace_chars = range('A', 'Z');
158
+ foreach (range(10, 35) as $tempvalue) { $iban_replace_values[] = strval($tempvalue); }
159
+ return str_replace($iban_replace_chars, $iban_replace_values, $s);
160 160
 }
161 161
 
162 162
 # Same as below but actually returns resulting checksum
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
  $checksum = intval(substr($numeric_representation, 0, 1));
165 165
  for ($position = 1; $position < strlen($numeric_representation); $position++) {
166 166
   $checksum *= 10;
167
-  $checksum += intval(substr($numeric_representation,$position,1));
167
+  $checksum += intval(substr($numeric_representation, $position, 1));
168 168
   $checksum %= 97;
169 169
  }
170 170
  return $checksum;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 function iban_mod97_10($numeric_representation) {
175 175
  global $__disable_iiban_gmp_extension;
176 176
  # prefer php5 gmp extension if available
177
- if(!($__disable_iiban_gmp_extension) && function_exists('gmp_intval') && $numeric_representation!='') { return gmp_intval(gmp_mod(gmp_init($numeric_representation, 10),'97')) === 1; }
177
+ if (!($__disable_iiban_gmp_extension) && function_exists('gmp_intval') && $numeric_representation != '') { return gmp_intval(gmp_mod(gmp_init($numeric_representation, 10), '97')) === 1; }
178 178
 
179 179
 /*
180 180
  # old manual processing (~16x slower)
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
  $rest = "";
193 193
  $position = 0;
194 194
  while ($position < $length) {
195
-        $value = 9-strlen($rest);
196
-        $n = $rest . substr($numeric_representation,$position,$value);
195
+        $value = 9 - strlen($rest);
196
+        $n = $rest.substr($numeric_representation, $position, $value);
197 197
         $rest = $n % 97;
198 198
         $position = $position + $value;
199 199
  }
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
  $country = iban_get_country_part($iban);
220 220
  $start = iban_country_get_bankid_start_offset($country);
221 221
  $stop = iban_country_get_bankid_stop_offset($country);
222
- if($start!=''&&$stop!='') {
222
+ if ($start != '' && $stop != '') {
223 223
   $bban = iban_get_bban_part($iban);
224
-  return substr($bban,$start,($stop-$start+1));
224
+  return substr($bban, $start, ($stop - $start + 1));
225 225
  }
226 226
  return '';
227 227
 }
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
  $country = iban_get_country_part($iban);
233 233
  $start = iban_country_get_branchid_start_offset($country);
234 234
  $stop = iban_country_get_branchid_stop_offset($country);
235
- if($start!=''&&$stop!='') {
235
+ if ($start != '' && $stop != '') {
236 236
   $bban = iban_get_bban_part($iban);
237
-  return substr($bban,$start,($stop-$start+1));
237
+  return substr($bban, $start, ($stop - $start + 1));
238 238
  }
239 239
  return '';
240 240
 }
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
  $iban = iban_to_machine_format($iban);
245 245
  $country = iban_get_country_part($iban);
246 246
  $start = iban_country_get_branchid_stop_offset($country);
247
- if($start=='') {
247
+ if ($start == '') {
248 248
   $start = iban_country_get_bankid_stop_offset($country);
249 249
  }
250
- if($start!='') {
250
+ if ($start != '') {
251 251
   $bban = iban_get_bban_part($iban);
252
-  return substr($bban,$start+1);
252
+  return substr($bban, $start + 1);
253 253
  }
254 254
  return '';
255 255
 }
@@ -259,137 +259,137 @@  discard block
 block discarded – undo
259 259
  $iban = iban_to_machine_format($iban);
260 260
  $country = iban_get_country_part($iban);
261 261
  $start = iban_country_get_nationalchecksum_start_offset($country);
262
- if($start == '') { return ''; }
262
+ if ($start == '') { return ''; }
263 263
  $stop = iban_country_get_nationalchecksum_stop_offset($country);
264
- if($stop == '') { return ''; }
264
+ if ($stop == '') { return ''; }
265 265
  $bban = iban_get_bban_part($iban);
266
- return substr($bban,$start,($stop-$start+1));
266
+ return substr($bban, $start, ($stop - $start + 1));
267 267
 }
268 268
 
269 269
 # Get the name of an IBAN country
270 270
 function iban_country_get_country_name($iban_country) {
271
- return _iban_country_get_info($iban_country,'country_name');
271
+ return _iban_country_get_info($iban_country, 'country_name');
272 272
 }
273 273
 
274 274
 # Get the domestic example for an IBAN country
275 275
 function iban_country_get_domestic_example($iban_country) {
276
- return _iban_country_get_info($iban_country,'domestic_example');
276
+ return _iban_country_get_info($iban_country, 'domestic_example');
277 277
 }
278 278
 
279 279
 # Get the BBAN example for an IBAN country
280 280
 function iban_country_get_bban_example($iban_country) {
281
- return _iban_country_get_info($iban_country,'bban_example');
281
+ return _iban_country_get_info($iban_country, 'bban_example');
282 282
 }
283 283
 
284 284
 # Get the BBAN format (in SWIFT format) for an IBAN country
285 285
 function iban_country_get_bban_format_swift($iban_country) {
286
- return _iban_country_get_info($iban_country,'bban_format_swift');
286
+ return _iban_country_get_info($iban_country, 'bban_format_swift');
287 287
 }
288 288
 
289 289
 # Get the BBAN format (as a regular expression) for an IBAN country
290 290
 function iban_country_get_bban_format_regex($iban_country) {
291
- return _iban_country_get_info($iban_country,'bban_format_regex');
291
+ return _iban_country_get_info($iban_country, 'bban_format_regex');
292 292
 }
293 293
 
294 294
 # Get the BBAN length for an IBAN country
295 295
 function iban_country_get_bban_length($iban_country) {
296
- return _iban_country_get_info($iban_country,'bban_length');
296
+ return _iban_country_get_info($iban_country, 'bban_length');
297 297
 }
298 298
 
299 299
 # Get the IBAN example for an IBAN country
300 300
 function iban_country_get_iban_example($iban_country) {
301
- return _iban_country_get_info($iban_country,'iban_example');
301
+ return _iban_country_get_info($iban_country, 'iban_example');
302 302
 }
303 303
 
304 304
 # Get the IBAN format (in SWIFT format) for an IBAN country
305 305
 function iban_country_get_iban_format_swift($iban_country) {
306
- return _iban_country_get_info($iban_country,'iban_format_swift');
306
+ return _iban_country_get_info($iban_country, 'iban_format_swift');
307 307
 }
308 308
 
309 309
 # Get the IBAN format (as a regular expression) for an IBAN country
310 310
 function iban_country_get_iban_format_regex($iban_country) {
311
- return _iban_country_get_info($iban_country,'iban_format_regex');
311
+ return _iban_country_get_info($iban_country, 'iban_format_regex');
312 312
 }
313 313
 
314 314
 # Get the IBAN length for an IBAN country
315 315
 function iban_country_get_iban_length($iban_country) {
316
- return _iban_country_get_info($iban_country,'iban_length');
316
+ return _iban_country_get_info($iban_country, 'iban_length');
317 317
 }
318 318
 
319 319
 # Get the BBAN Bank ID start offset for an IBAN country
320 320
 function iban_country_get_bankid_start_offset($iban_country) {
321
- return _iban_country_get_info($iban_country,'bban_bankid_start_offset');
321
+ return _iban_country_get_info($iban_country, 'bban_bankid_start_offset');
322 322
 }
323 323
 
324 324
 # Get the BBAN Bank ID stop offset for an IBAN country
325 325
 function iban_country_get_bankid_stop_offset($iban_country) {
326
- return _iban_country_get_info($iban_country,'bban_bankid_stop_offset');
326
+ return _iban_country_get_info($iban_country, 'bban_bankid_stop_offset');
327 327
 }
328 328
 
329 329
 # Get the BBAN Branch ID start offset for an IBAN country
330 330
 function iban_country_get_branchid_start_offset($iban_country) {
331
- return _iban_country_get_info($iban_country,'bban_branchid_start_offset');
331
+ return _iban_country_get_info($iban_country, 'bban_branchid_start_offset');
332 332
 }
333 333
 
334 334
 # Get the BBAN Branch ID stop offset for an IBAN country
335 335
 function iban_country_get_branchid_stop_offset($iban_country) {
336
- return _iban_country_get_info($iban_country,'bban_branchid_stop_offset');
336
+ return _iban_country_get_info($iban_country, 'bban_branchid_stop_offset');
337 337
 }
338 338
 
339 339
 # Get the BBAN (national) checksum start offset for an IBAN country
340 340
 #  Returns '' when (often) not present)
341 341
 function iban_country_get_nationalchecksum_start_offset($iban_country) {
342
- return _iban_country_get_info($iban_country,'bban_checksum_start_offset');
342
+ return _iban_country_get_info($iban_country, 'bban_checksum_start_offset');
343 343
 }
344 344
 
345 345
 # Get the BBAN (national) checksum stop offset for an IBAN country
346 346
 #  Returns '' when (often) not present)
347 347
 function iban_country_get_nationalchecksum_stop_offset($iban_country) {
348
- return _iban_country_get_info($iban_country,'bban_checksum_stop_offset');
348
+ return _iban_country_get_info($iban_country, 'bban_checksum_stop_offset');
349 349
 }
350 350
 
351 351
 # Get the registry edition for an IBAN country
352 352
 function iban_country_get_registry_edition($iban_country) {
353
- return _iban_country_get_info($iban_country,'registry_edition');
353
+ return _iban_country_get_info($iban_country, 'registry_edition');
354 354
 }
355 355
 
356 356
 # Is the IBAN country one official issued by SWIFT?
357 357
 function iban_country_get_country_swift_official($iban_country) {
358
- return _iban_country_get_info($iban_country,'country_swift_official');
358
+ return _iban_country_get_info($iban_country, 'country_swift_official');
359 359
 }
360 360
 
361 361
 # Is the IBAN country a SEPA member?
362 362
 function iban_country_is_sepa($iban_country) {
363
- return _iban_country_get_info($iban_country,'country_sepa');
363
+ return _iban_country_get_info($iban_country, 'country_sepa');
364 364
 }
365 365
 
366 366
 # Get the IANA code of an IBAN country
367 367
 function iban_country_get_iana($iban_country) {
368
- return _iban_country_get_info($iban_country,'country_iana');
368
+ return _iban_country_get_info($iban_country, 'country_iana');
369 369
 }
370 370
 
371 371
 # Get the ISO3166-1 alpha-2 code of an IBAN country
372 372
 function iban_country_get_iso3166($iban_country) {
373
- return _iban_country_get_info($iban_country,'country_iso3166');
373
+ return _iban_country_get_info($iban_country, 'country_iso3166');
374 374
 }
375 375
 
376 376
 # Get the parent registrar IBAN country of an IBAN country
377 377
 function iban_country_get_parent_registrar($iban_country) {
378
- return _iban_country_get_info($iban_country,'parent_registrar');
378
+ return _iban_country_get_info($iban_country, 'parent_registrar');
379 379
 }
380 380
 
381 381
 # Get the official currency of an IBAN country as an ISO4217 alpha code
382 382
 # (Note: Returns '' if there is no official currency, eg. for AA (IIBAN))
383 383
 function iban_country_get_currency_iso4217($iban_country) {
384
- return _iban_country_get_info($iban_country,'currency_iso4217');
384
+ return _iban_country_get_info($iban_country, 'currency_iso4217');
385 385
 }
386 386
 
387 387
 # Get the URL of an IBAN country's central bank
388 388
 # (Note: Returns '' if there is no central bank. Also, note that
389 389
 #        sometimes multiple countries share one central bank)
390 390
 function iban_country_get_central_bank_url($iban_country) {
391
- $result = _iban_country_get_info($iban_country,'central_bank_url');
392
- if($result!='') { $result = 'http://' . $result . '/'; }
391
+ $result = _iban_country_get_info($iban_country, 'central_bank_url');
392
+ if ($result != '') { $result = 'http://'.$result.'/'; }
393 393
  return $result;
394 394
 }
395 395
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 # (Note: Returns '' if there is no central bank. Also, note that
398 398
 #        sometimes multiple countries share one central bank)
399 399
 function iban_country_get_central_bank_name($iban_country) {
400
- return _iban_country_get_info($iban_country,'central_bank_name');
400
+ return _iban_country_get_info($iban_country, 'central_bank_name');
401 401
 }
402 402
 
403 403
 # Get the list of all IBAN countries
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
 # Get the membership of an IBAN country
411 411
 # (Note: Possible Values eu_member, efta_member, other_member, non_member)
412 412
 function iban_country_get_membership($iban_country) {
413
- return _iban_country_get_info($iban_country,'membership');
413
+ return _iban_country_get_info($iban_country, 'membership');
414 414
 }
415 415
 
416 416
 # Get the membership of an IBAN country
417 417
 # (Note: Possible Values eu_member, efta_member, other_member, non_member)
418 418
 function iban_country_get_is_eu_member($iban_country) {
419
- $membership = _iban_country_get_info($iban_country,'membership');
419
+ $membership = _iban_country_get_info($iban_country, 'membership');
420 420
  if ($membership === 'eu_member') {
421 421
   $result = true;
422 422
  } else {
@@ -445,10 +445,10 @@  discard block
 block discarded – undo
445 445
  
446 446
  # abort on ridiculous length input (but be liberal)
447 447
  $length = strlen($incorrect_iban);
448
- if($length<5 || $length>34) { return array('(supplied iban length insane)'); }
448
+ if ($length < 5 || $length > 34) { return array('(supplied iban length insane)'); }
449 449
 
450 450
  # abort if mistranscriptions data is unable to load
451
- if(!_iban_load_mistranscriptions()) { return array('(failed to load mistranscriptions)'); }
451
+ if (!_iban_load_mistranscriptions()) { return array('(failed to load mistranscriptions)'); }
452 452
 
453 453
  # init
454 454
  global $_iban_mistranscriptions;
@@ -456,27 +456,27 @@  discard block
 block discarded – undo
456 456
 
457 457
  # we have a string of approximately IBAN-like length.
458 458
  # ... now let's make suggestions.
459
- $numbers = array('0','1','2','3','4','5','6','7','8','9');
460
- for($i=0;$i<$length;$i++) {
459
+ $numbers = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
460
+ for ($i = 0; $i < $length; $i++) {
461 461
   # get the character at this position
462
-  $character = substr($incorrect_iban,$i,1);
462
+  $character = substr($incorrect_iban, $i, 1);
463 463
   # for each known transcription error resulting in this character
464
-  foreach($_iban_mistranscriptions[$character] as $possible_origin) {
464
+  foreach ($_iban_mistranscriptions[$character] as $possible_origin) {
465 465
    # if we're:
466 466
    #  - in the first 2 characters (country) and the possible replacement
467 467
    #    is a letter
468 468
    #  - in the 3rd or 4th characters (checksum) and the possible
469 469
    #    replacement is a number
470 470
    #  - later in the string
471
-   if(($i<2 && !in_array($possible_origin,$numbers)) ||
472
-      ($i>=2 && $i<=3 && in_array($possible_origin,$numbers)) ||
473
-      $i>3) {
471
+   if (($i < 2 && !in_array($possible_origin, $numbers)) ||
472
+      ($i >= 2 && $i <= 3 && in_array($possible_origin, $numbers)) ||
473
+      $i > 3) {
474 474
     # construct a possible IBAN using this possible origin for the
475 475
     # mistranscribed character, replaced at this position only
476
-    $possible_iban = substr($incorrect_iban,0,$i) . $possible_origin .  substr($incorrect_iban,$i+1);
476
+    $possible_iban = substr($incorrect_iban, 0, $i).$possible_origin.substr($incorrect_iban, $i + 1);
477 477
     # if the checksum passes, return it as a possibility
478
-    if(verify_iban($possible_iban)) {
479
-     array_push($suggestions,$possible_iban);
478
+    if (verify_iban($possible_iban)) {
479
+     array_push($suggestions, $possible_iban);
480 480
     }
481 481
    }
482 482
   }
@@ -486,23 +486,23 @@  discard block
 block discarded – undo
486 486
  # the characters of a certain type within a string were mistransposed.
487 487
  #  - first generate a character frequency table
488 488
  $char_freqs = array();
489
- for($i=0;$i<strlen($incorrect_iban);$i++) {
490
-  if(!isset($char_freqs[substr($incorrect_iban,$i,1)])) {
491
-   $char_freqs[substr($incorrect_iban,$i,1)] = 1;
489
+ for ($i = 0; $i < strlen($incorrect_iban); $i++) {
490
+  if (!isset($char_freqs[substr($incorrect_iban, $i, 1)])) {
491
+   $char_freqs[substr($incorrect_iban, $i, 1)] = 1;
492 492
   }
493 493
   else {
494
-   $char_freqs[substr($incorrect_iban,$i,1)]++;
494
+   $char_freqs[substr($incorrect_iban, $i, 1)]++;
495 495
   }
496 496
  }
497 497
  #  - now, for each of the characters in the string...
498
- foreach($char_freqs as $char=>$freq) {
498
+ foreach ($char_freqs as $char=>$freq) {
499 499
   # if the character occurs more than once
500
-  if($freq>1) {
500
+  if ($freq > 1) {
501 501
    # check the 'all occurrences of <char> were mistranscribed' case
502
-   foreach($_iban_mistranscriptions[$char] as $possible_origin) {
503
-    $possible_iban = str_replace($char,$possible_origin,$incorrect_iban);
504
-    if(verify_iban($possible_iban)) {
505
-     array_push($suggestions,$possible_iban);
502
+   foreach ($_iban_mistranscriptions[$char] as $possible_origin) {
503
+    $possible_iban = str_replace($char, $possible_origin, $incorrect_iban);
504
+    if (verify_iban($possible_iban)) {
505
+     array_push($suggestions, $possible_iban);
506 506
     }
507 507
    }
508 508
   }
@@ -520,26 +520,26 @@  discard block
 block discarded – undo
520 520
 function _iban_load_registry() {
521 521
  global $_iban_registry;
522 522
  # if the registry is not yet loaded, or has been corrupted, reload
523
- if(!is_array($_iban_registry) || count($_iban_registry)<1) {
524
-  $data = file_get_contents(dirname(__FILE__) . '/registry.txt');
525
-  $lines = explode("\n",$data);
523
+ if (!is_array($_iban_registry) || count($_iban_registry) < 1) {
524
+  $data = file_get_contents(dirname(__FILE__).'/registry.txt');
525
+  $lines = explode("\n", $data);
526 526
   array_shift($lines); # drop leading description line
527 527
   # loop through lines
528
-  foreach($lines as $line) {
529
-   if($line!='') {
528
+  foreach ($lines as $line) {
529
+   if ($line != '') {
530 530
     # avoid spewing tonnes of PHP warnings under bad PHP configs - see issue #69
531
-    if(function_exists('ini_set')) {
531
+    if (function_exists('ini_set')) {
532 532
      # split to fields
533 533
      $old_display_errors_value = ini_get('display_errors');
534
-     ini_set('display_errors',false);
534
+     ini_set('display_errors', false);
535 535
      $old_error_reporting_value = ini_get('error_reporting');
536
-     ini_set('error_reporting',false);
536
+     ini_set('error_reporting', false);
537 537
     }
538
-    list($country,$country_name,$domestic_example,$bban_example,$bban_format_swift,$bban_format_regex,$bban_length,$iban_example,$iban_format_swift,$iban_format_regex,$iban_length,$bban_bankid_start_offset,$bban_bankid_stop_offset,$bban_branchid_start_offset,$bban_branchid_stop_offset,$registry_edition,$country_sepa,$country_swift_official,$bban_checksum_start_offset,$bban_checksum_stop_offset,$country_iana,$country_iso3166,$parent_registrar,$currency_iso4217,$central_bank_url,$central_bank_name,$membership) = explode('|',$line);
538
+    list($country, $country_name, $domestic_example, $bban_example, $bban_format_swift, $bban_format_regex, $bban_length, $iban_example, $iban_format_swift, $iban_format_regex, $iban_length, $bban_bankid_start_offset, $bban_bankid_stop_offset, $bban_branchid_start_offset, $bban_branchid_stop_offset, $registry_edition, $country_sepa, $country_swift_official, $bban_checksum_start_offset, $bban_checksum_stop_offset, $country_iana, $country_iso3166, $parent_registrar, $currency_iso4217, $central_bank_url, $central_bank_name, $membership) = explode('|', $line);
539 539
     # avoid spewing tonnes of PHP warnings under bad PHP configs - see issue #69
540
-    if(function_exists('ini_set')) {
541
-     ini_set('display_errors',$old_display_errors_value);
542
-     ini_set('error_reporting',$old_error_reporting_value);
540
+    if (function_exists('ini_set')) {
541
+     ini_set('display_errors', $old_display_errors_value);
542
+     ini_set('error_reporting', $old_error_reporting_value);
543 543
     }
544 544
     # assign to registry
545 545
     $_iban_registry[$country] = array(
@@ -577,19 +577,19 @@  discard block
 block discarded – undo
577 577
 }
578 578
 
579 579
 # Get information from the IBAN registry by example IBAN / code combination
580
-function _iban_get_info($iban,$code) {
580
+function _iban_get_info($iban, $code) {
581 581
  $country = iban_get_country_part($iban);
582
- return _iban_country_get_info($country,$code);
582
+ return _iban_country_get_info($country, $code);
583 583
 }
584 584
 
585 585
 # Get information from the IBAN registry by country / code combination
586
-function _iban_country_get_info($country,$code) {
586
+function _iban_country_get_info($country, $code) {
587 587
  _iban_load_registry();
588 588
  global $_iban_registry;
589 589
  $country = strtoupper($country);
590 590
  $code = strtolower($code);
591
- if(array_key_exists($country,$_iban_registry)) {
592
-  if(array_key_exists($code,$_iban_registry[$country])) {
591
+ if (array_key_exists($country, $_iban_registry)) {
592
+  if (array_key_exists($code, $_iban_registry[$country])) {
593 593
    return $_iban_registry[$country][$code];
594 594
   }
595 595
  }
@@ -600,19 +600,19 @@  discard block
 block discarded – undo
600 600
 function _iban_load_mistranscriptions() {
601 601
  global $_iban_mistranscriptions;
602 602
  # do not reload if already present
603
- if(is_array($_iban_mistranscriptions) && count($_iban_mistranscriptions) == 36) { return true; }
603
+ if (is_array($_iban_mistranscriptions) && count($_iban_mistranscriptions) == 36) { return true; }
604 604
  $_iban_mistranscriptions = array();
605
- $file = dirname(__FILE__) . '/mistranscriptions.txt';
606
- if(!file_exists($file) || !is_readable($file)) { return false; }
605
+ $file = dirname(__FILE__).'/mistranscriptions.txt';
606
+ if (!file_exists($file) || !is_readable($file)) { return false; }
607 607
  $data = file_get_contents($file);
608
- $lines = explode("\n",$data);
609
- foreach($lines as $line) {
608
+ $lines = explode("\n", $data);
609
+ foreach ($lines as $line) {
610 610
   # match lines with ' c-<x> = <something>' where x is a word-like character
611
-  if(preg_match('/^ *c-(\w) = (.*?)$/',$line,$matches)) {
611
+  if (preg_match('/^ *c-(\w) = (.*?)$/', $line, $matches)) {
612 612
    # normalize the character to upper case
613 613
    $character = strtoupper($matches[1]);
614 614
    # break the possible origins list at '/', strip quotes & spaces
615
-   $chars = explode(' ',str_replace('"','',preg_replace('/ *?\/ *?/','',$matches[2])));
615
+   $chars = explode(' ', str_replace('"', '', preg_replace('/ *?\/ *?/', '', $matches[2])));
616 616
    # assign as possible mistranscriptions for that character
617 617
    $_iban_mistranscriptions[$character] = $chars;
618 618
   }
@@ -624,42 +624,42 @@  discard block
 block discarded – undo
624 624
 #  (Returns the correct national checksum as a string, or '' if unimplemented for this IBAN's country)
625 625
 #  (NOTE: only works for some countries)
626 626
 function iban_find_nationalchecksum($iban) {
627
- return _iban_nationalchecksum_implementation($iban,'find');
627
+ return _iban_nationalchecksum_implementation($iban, 'find');
628 628
 }
629 629
 
630 630
 # Verify the correct national checksum for an IBAN
631 631
 #  (Returns true or false, or '' if unimplemented for this IBAN's country)
632 632
 #  (NOTE: only works for some countries)
633 633
 function iban_verify_nationalchecksum($iban) {
634
- return _iban_nationalchecksum_implementation($iban,'verify');
634
+ return _iban_nationalchecksum_implementation($iban, 'verify');
635 635
 }
636 636
 
637 637
 # Verify the correct national checksum for an IBAN
638 638
 #  (Returns the (possibly) corrected IBAN, or '' if unimplemented for this IBAN's country)
639 639
 #  (NOTE: only works for some countries)
640 640
 function iban_set_nationalchecksum($iban) {
641
- $result = _iban_nationalchecksum_implementation($iban,'set');
642
- if($result != '' ) {
641
+ $result = _iban_nationalchecksum_implementation($iban, 'set');
642
+ if ($result != '') {
643 643
   $result = iban_set_checksum($result); # recalculate IBAN-level checksum
644 644
  }
645 645
  return $result;
646 646
 }
647 647
 
648 648
 # Internal function to overwrite the national checksum portion of an IBAN
649
-function _iban_nationalchecksum_set($iban,$nationalchecksum) {
649
+function _iban_nationalchecksum_set($iban, $nationalchecksum) {
650 650
  $country = iban_get_country_part($iban);
651 651
  $start = iban_country_get_nationalchecksum_start_offset($country);
652
- if($start == '') { return ''; }
652
+ if ($start == '') { return ''; }
653 653
  $stop = iban_country_get_nationalchecksum_stop_offset($country);
654
- if($stop == '') { return ''; }
654
+ if ($stop == '') { return ''; }
655 655
  # determine the BBAN
656 656
  $bban = iban_get_bban_part($iban);
657 657
  # alter the BBAN
658
- $firstbit = substr($bban,0,$start);  # 'string before the checksum'
659
- $lastbit = substr($bban,$stop+1);    # 'string after the checksum'
660
- $fixed_bban = $firstbit . $nationalchecksum . $lastbit;
658
+ $firstbit = substr($bban, 0, $start); # 'string before the checksum'
659
+ $lastbit = substr($bban, $stop + 1); # 'string after the checksum'
660
+ $fixed_bban = $firstbit.$nationalchecksum.$lastbit;
661 661
  # reconstruct the fixed IBAN
662
- $fixed_iban = $country . iban_get_checksum_part($iban) . $fixed_bban;
662
+ $fixed_iban = $country.iban_get_checksum_part($iban).$fixed_bban;
663 663
  return $fixed_iban;
664 664
 }
665 665
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
  }
675 675
  $p %= 11;
676 676
  $result = (12 - $p) % 11;
677
- if($result == 10) { $result = 'X'; }
677
+ if ($result == 10) { $result = 'X'; }
678 678
  return $result;
679 679
 }
680 680
 
@@ -693,41 +693,41 @@  discard block
 block discarded – undo
693 693
   $w1 = $wi[($i_size1 - $i) % 10];
694 694
   $sigma += ($i1 * $w1) % 11; 
695 695
  }
696
- if($bModify) return str_replace('?', $hash_map[($sigma % 11)], $vString);
696
+ if ($bModify) return str_replace('?', $hash_map[($sigma % 11)], $vString);
697 697
  else return $hash_map[($sigma % 11)];
698 698
 }
699 699
 
700 700
 # ISO7064 MOD97-10 (Bosnia, etc.)
701 701
 # (Credit: Adapted from https://github.com/stvkoch/ISO7064-Mod-97-10/blob/master/ISO7064Mod97_10.php)
702 702
 function _iso7064_mod97_10($str) {
703
- $ai=1;
704
- $ch = ord($str[strlen($str)-1]) - 48;
705
- if($ch < 0 || $ch > 9) return false;
706
- $check=$ch;
707
- for($i=strlen($str)-2;$i>=0;$i--) {
703
+ $ai = 1;
704
+ $ch = ord($str[strlen($str) - 1]) - 48;
705
+ if ($ch < 0 || $ch > 9) return false;
706
+ $check = $ch;
707
+ for ($i = strlen($str) - 2; $i >= 0; $i--) {
708 708
   $ch = ord($str[$i]) - 48;
709 709
   if ($ch < 0 || $ch > 9) return false;
710
-  $ai=($ai*10)%97;
711
-  $check+= ($ai * ((int)$ch));
710
+  $ai = ($ai * 10) % 97;
711
+  $check += ($ai * ((int) $ch));
712 712
  }
713
- return (98-($check%97));
713
+ return (98 - ($check % 97));
714 714
 }
715 715
 
716 716
 # Implement the national checksum for a Belgium (BE) IBAN
717 717
 #  (Credit: @gaetan-be, fixed by @Olympic1)
718
-function _iban_nationalchecksum_implementation_be($iban,$mode) {
719
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
718
+function _iban_nationalchecksum_implementation_be($iban, $mode) {
719
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
720 720
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
721 721
  $bban = iban_get_bban_part($iban);
722 722
  $bban_less_checksum = substr($bban, 0, -strlen($nationalchecksum));
723 723
  $expected_nationalchecksum = $bban_less_checksum % 97;
724
- if($mode=='find') {
724
+ if ($mode == 'find') {
725 725
   return $expected_nationalchecksum;
726 726
  }
727
- elseif($mode=='set') {
728
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
727
+ elseif ($mode == 'set') {
728
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
729 729
  }
730
- elseif($mode=='verify') {
730
+ elseif ($mode == 'verify') {
731 731
   return ($nationalchecksum == $expected_nationalchecksum);
732 732
  }
733 733
 }
@@ -735,11 +735,11 @@  discard block
 block discarded – undo
735 735
 # MOD11 helper function for the Spanish (ES) IBAN national checksum implementation
736 736
 #  (Credit: @dem3trio, code lifted from Spanish Wikipedia at https://es.wikipedia.org/wiki/C%C3%B3digo_cuenta_cliente)
737 737
 function _iban_nationalchecksum_implementation_es_mod11_helper($numero) {
738
- if(strlen($numero)!=10) return "?";
739
- $cifras = Array(1,2,4,8,5,10,9,7,3,6);
740
- $chequeo=0;
741
- for($i=0; $i<10; $i++) {
742
-  $chequeo += substr($numero,$i,1) * $cifras[$i];
738
+ if (strlen($numero) != 10) return "?";
739
+ $cifras = Array(1, 2, 4, 8, 5, 10, 9, 7, 3, 6);
740
+ $chequeo = 0;
741
+ for ($i = 0; $i < 10; $i++) {
742
+  $chequeo += substr($numero, $i, 1) * $cifras[$i];
743 743
  }
744 744
  $chequeo = 11 - ($chequeo % 11);
745 745
  if ($chequeo == 11) $chequeo = 0;
@@ -749,24 +749,24 @@  discard block
 block discarded – undo
749 749
 
750 750
 # Implement the national checksum for a Spanish (ES) IBAN
751 751
 #  (Credit: @dem3trio, adapted from code on Spanish Wikipedia at https://es.wikipedia.org/wiki/C%C3%B3digo_cuenta_cliente)
752
-function _iban_nationalchecksum_implementation_es($iban,$mode) {
753
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
752
+function _iban_nationalchecksum_implementation_es($iban, $mode) {
753
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
754 754
  # extract appropriate substrings
755
- $bankprefix = iban_get_bank_part($iban) . iban_get_branch_part($iban);
755
+ $bankprefix = iban_get_bank_part($iban).iban_get_branch_part($iban);
756 756
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
757 757
  $account = iban_get_account_part($iban);
758
- $account_less_checksum = substr($account,2);
758
+ $account_less_checksum = substr($account, 2);
759 759
  # first we calculate the initial checksum digit, which is MOD11 of the bank prefix with '00' prepended
760 760
  $expected_nationalchecksum  = _iban_nationalchecksum_implementation_es_mod11_helper("00".$bankprefix);
761 761
  # then we append the second digit, which is MOD11 of the account
762 762
  $expected_nationalchecksum .= _iban_nationalchecksum_implementation_es_mod11_helper($account_less_checksum);
763
- if($mode=='find') {
763
+ if ($mode == 'find') {
764 764
   return $expected_nationalchecksum;
765 765
  }
766
- elseif($mode=='set') {
767
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
766
+ elseif ($mode == 'set') {
767
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
768 768
  }
769
- elseif($mode=='verify') {
769
+ elseif ($mode == 'verify') {
770 770
   return ($nationalchecksum == $expected_nationalchecksum);
771 771
  }
772 772
 }
@@ -780,13 +780,13 @@  discard block
 block discarded – undo
780 780
                      "J" => 1, "K" => 2, "L" => 3, "M" => 4, "N" => 5, "O" => 6, "P" => 7, "Q" => 8, "R" => 9, 
781 781
                      "S" => 2, "T" => 3, "U" => 4, "V" => 5, "W" => 6, "X" => 7, "Y" => 8, "Z" => 9
782 782
                     );
783
- for ($i=0; $i < strlen($bban); $i++) {
784
-  if(is_numeric($bban[$i])) {
783
+ for ($i = 0; $i < strlen($bban); $i++) {
784
+  if (is_numeric($bban[$i])) {
785 785
    $allNumbers .= $bban[$i];
786 786
   }
787 787
   else {
788 788
    $letter = strtoupper($bban[$i]);
789
-   if(array_key_exists($letter, $conversion)) {
789
+   if (array_key_exists($letter, $conversion)) {
790 790
     $allNumbers .= $conversion[$letter];
791 791
    }
792 792
    else {
@@ -811,82 +811,82 @@  discard block
 block discarded – undo
811 811
 #       correlation, we are going to assume that the first error is theirs.
812 812
 #
813 813
 # Implement the national checksum for a Central African Republic (CF) IBAN
814
-function _iban_nationalchecksum_implementation_cf($iban,$mode) {
815
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
814
+function _iban_nationalchecksum_implementation_cf($iban, $mode) {
815
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
816 816
 }
817 817
 
818 818
 # Implement the national checksum for a Chad (TD) IBAN
819
-function _iban_nationalchecksum_implementation_td($iban,$mode) {
820
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
819
+function _iban_nationalchecksum_implementation_td($iban, $mode) {
820
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
821 821
 }
822 822
 
823 823
 # Implement the national checksum for a Comoros (KM) IBAN
824
-function _iban_nationalchecksum_implementation_km($iban,$mode) {
825
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
824
+function _iban_nationalchecksum_implementation_km($iban, $mode) {
825
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
826 826
 }
827 827
 
828 828
 # Implement the national checksum for a Congo (CG) IBAN
829
-function _iban_nationalchecksum_implementation_cg($iban,$mode) {
830
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
829
+function _iban_nationalchecksum_implementation_cg($iban, $mode) {
830
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
831 831
 }
832 832
 
833 833
 # Implement the national checksum for a Djibouti (DJ) IBAN
834
-function _iban_nationalchecksum_implementation_dj($iban,$mode) {
835
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
834
+function _iban_nationalchecksum_implementation_dj($iban, $mode) {
835
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
836 836
 }
837 837
 
838 838
 # Implement the national checksum for an Equitorial Guinea (GQ) IBAN
839
-function _iban_nationalchecksum_implementation_gq($iban,$mode) {
840
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
839
+function _iban_nationalchecksum_implementation_gq($iban, $mode) {
840
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
841 841
 }
842 842
 
843 843
 # Implement the national checksum for a Gabon (GA) IBAN
844
-function _iban_nationalchecksum_implementation_ga($iban,$mode) {
845
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
844
+function _iban_nationalchecksum_implementation_ga($iban, $mode) {
845
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
846 846
 }
847 847
 
848 848
 # Implement the national checksum for a Monaco (MC) IBAN
849 849
 #  (Credit: @gaetan-be)
850
-function _iban_nationalchecksum_implementation_mc($iban,$mode) {
851
- return _iban_nationalchecksum_implementation_fr($iban,$mode);
850
+function _iban_nationalchecksum_implementation_mc($iban, $mode) {
851
+ return _iban_nationalchecksum_implementation_fr($iban, $mode);
852 852
 }
853 853
 
854 854
 # Implement the national checksum for a France (FR) IBAN
855 855
 #  (Credit: @gaetan-be, http://www.credit-card.be/BankAccount/ValidationRules.htm#FR_Validation and 
856 856
 #           https://docs.oracle.com/cd/E18727_01/doc.121/e13483/T359831T498954.htm)
857
-function _iban_nationalchecksum_implementation_fr($iban,$mode) {
858
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
857
+function _iban_nationalchecksum_implementation_fr($iban, $mode) {
858
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
859 859
  # first, extract the BBAN
860 860
  $bban = iban_get_bban_part($iban);
861 861
  # convert to numeric form
862 862
  $bban_numeric_form = _iban_nationalchecksum_implementation_fr_letters2numbers_helper($bban);
863 863
  # if the result was null, something is horribly wrong
864
- if(is_null($bban_numeric_form)) { return ''; }
864
+ if (is_null($bban_numeric_form)) { return ''; }
865 865
  # extract other parts
866
- $bank = substr($bban_numeric_form,0,5);
867
- $branch = substr($bban_numeric_form,5,5);
868
- $account = substr($bban_numeric_form,10,11);
866
+ $bank = substr($bban_numeric_form, 0, 5);
867
+ $branch = substr($bban_numeric_form, 5, 5);
868
+ $account = substr($bban_numeric_form, 10, 11);
869 869
  # actual implementation: mod97( (89 x bank number "Code banque") + (15 x branch code "Code guichet") + (3 x account number "Numéro de compte") )
870
- $sum = (89*($bank+0)) + ((15*($branch+0)));
871
- $sum += (3*($account+0));
870
+ $sum = (89 * ($bank + 0)) + ((15 * ($branch + 0)));
871
+ $sum += (3 * ($account + 0));
872 872
  $expected_nationalchecksum = 97 - ($sum % 97);
873
- if(strlen($expected_nationalchecksum) == 1) { $expected_nationalchecksum = '0' . $expected_nationalchecksum; }
873
+ if (strlen($expected_nationalchecksum) == 1) { $expected_nationalchecksum = '0'.$expected_nationalchecksum; }
874 874
  # return
875
- if($mode=='find') {
875
+ if ($mode == 'find') {
876 876
   return $expected_nationalchecksum;
877 877
  }
878
- elseif($mode=='set') {
879
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
878
+ elseif ($mode == 'set') {
879
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
880 880
  }
881
- elseif($mode=='verify') {
881
+ elseif ($mode == 'verify') {
882 882
   return (iban_get_nationalchecksum_part($iban) == $expected_nationalchecksum);
883 883
  }
884 884
 }
885 885
 
886 886
 # Implement the national checksum for a Norway (NO) IBAN
887 887
 #  (NOTE: Built from description at https://docs.oracle.com/cd/E18727_01/doc.121/e13483/T359831T498954.htm, not well tested)
888
-function _iban_nationalchecksum_implementation_no($iban,$mode) {
889
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
888
+function _iban_nationalchecksum_implementation_no($iban, $mode) {
889
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
890 890
  # first, extract the BBAN
891 891
  $bban = iban_get_bban_part($iban);
892 892
  # then, the account
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
  # existing checksum
895 895
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
896 896
  # bban less checksum
897
- $bban_less_checksum = substr($bban,0,strlen($bban)-strlen($nationalchecksum));
897
+ $bban_less_checksum = substr($bban, 0, strlen($bban) - strlen($nationalchecksum));
898 898
  # factor table
899
- $factors = array(5,4,3,2,7,6,5,4,3,2);
899
+ $factors = array(5, 4, 3, 2, 7, 6, 5, 4, 3, 2);
900 900
  # calculate checksum
901 901
  $total = 0;
902
- for($i=0;$i<10;$i++) {
902
+ for ($i = 0; $i < 10; $i++) {
903 903
   $total += $bban_less_checksum[$i] * $factors[$i];
904 904
  }
905 905
  $total += $nationalchecksum;
@@ -907,18 +907,18 @@  discard block
 block discarded – undo
907 907
  $remainder = $total % 11;
908 908
  # to find the correct check digit, we add the remainder to the current check digit,
909 909
  #  mod10 (ie. rounding at 10, such that 10 = 0, 11 = 1, etc.)
910
- $calculated_checksum = ($nationalchecksum + $remainder)%10;
911
- if($mode == 'find') {
912
-  if($remainder == 0) { return $nationalchecksum; }
910
+ $calculated_checksum = ($nationalchecksum + $remainder) % 10;
911
+ if ($mode == 'find') {
912
+  if ($remainder == 0) { return $nationalchecksum; }
913 913
   else {
914 914
    return $calculated_checksum;
915 915
   }
916 916
  }
917
- elseif($mode == 'set') {
918
-  return _iban_nationalchecksum_set($iban,$calculated_checksum);
917
+ elseif ($mode == 'set') {
918
+  return _iban_nationalchecksum_set($iban, $calculated_checksum);
919 919
  }
920
- elseif($mode == 'verify') {
921
-  if($remainder == 0) { return true; }
920
+ elseif ($mode == 'verify') {
921
+  if ($remainder == 0) { return true; }
922 922
   return false;
923 923
  }
924 924
 }
@@ -930,86 +930,86 @@  discard block
 block discarded – undo
930 930
 # (Credit: php-iso7064 @ https://github.com/globalcitizen/php-iso7064)
931 931
 function _iso7064_mod11_2($input) {
932 932
  $input = strtoupper($input); # normalize
933
- if(!preg_match('/^[0123456789]+$/',$input)) { return ''; } # bad input
933
+ if (!preg_match('/^[0123456789]+$/', $input)) { return ''; } # bad input
934 934
  $modulus       = 11;
935 935
  $radix         = 2;
936 936
  $output_values = '0123456789X';
937 937
  $p             = 0;
938
- for($i=0; $i<strlen($input); $i++) {
939
-  $val = strpos($output_values,substr($input,$i,1));
940
-  if($val < 0) { return ''; } # illegal character encountered
938
+ for ($i = 0; $i < strlen($input); $i++) {
939
+  $val = strpos($output_values, substr($input, $i, 1));
940
+  if ($val < 0) { return ''; } # illegal character encountered
941 941
   $p = (($p + $val) * $radix) % $modulus;
942 942
  }
943 943
  $checksum = ($modulus - $p + 1) % $modulus;
944
- return substr($output_values,$checksum,1);
944
+ return substr($output_values, $checksum, 1);
945 945
 }
946 946
 
947 947
 # Implement the national checksum systems based on ISO7064 MOD11-2 Algorithm
948
-function _iban_nationalchecksum_implementation_iso7064_mod11_2($iban,$mode,$drop_at_front=0,$drop_at_end=1) {
949
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
948
+function _iban_nationalchecksum_implementation_iso7064_mod11_2($iban, $mode, $drop_at_front = 0, $drop_at_end = 1) {
949
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
950 950
  # first, extract the BBAN
951 951
  $bban = iban_get_bban_part($iban);
952 952
  # get the current and computed checksum
953 953
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
954 954
  # drop characters from the front and end of the BBAN as requested
955
- $bban_less_checksum = substr($bban,$drop_at_front,strlen($bban)-$drop_at_end);
955
+ $bban_less_checksum = substr($bban, $drop_at_front, strlen($bban) - $drop_at_end);
956 956
  # calculate expected checksum
957 957
  $expected_nationalchecksum = _iso7064_mod11_2($bban_less_checksum);
958 958
  # return
959
- if($mode=='find') {
959
+ if ($mode == 'find') {
960 960
   return $expected_nationalchecksum;
961 961
  }
962
- elseif($mode=='set') {
963
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
962
+ elseif ($mode == 'set') {
963
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
964 964
  }
965
- elseif($mode=='verify') {
965
+ elseif ($mode == 'verify') {
966 966
   return (iban_get_nationalchecksum_part($iban) == $expected_nationalchecksum);
967 967
  }
968 968
 }
969 969
 
970 970
 # Implement the national checksum systems based on Damm Algorithm
971
-function _iban_nationalchecksum_implementation_damm($iban,$mode) {
972
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
971
+function _iban_nationalchecksum_implementation_damm($iban, $mode) {
972
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
973 973
  # first, extract the BBAN
974 974
  $bban = iban_get_bban_part($iban);
975 975
  # get the current and computed checksum
976 976
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
977 977
  # drop trailing checksum characters
978
- $bban_less_checksum = substr($bban,0,strlen($bban)-strlen($nationalchecksum));
978
+ $bban_less_checksum = substr($bban, 0, strlen($bban) - strlen($nationalchecksum));
979 979
  # calculate expected checksum
980 980
  $expected_nationalchecksum = _damm($bban_less_checksum);
981 981
  # return
982
- if($mode=='find') {
982
+ if ($mode == 'find') {
983 983
   return $expected_nationalchecksum;
984 984
  }
985
- elseif($mode=='set') {
986
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
985
+ elseif ($mode == 'set') {
986
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
987 987
  }
988
- elseif($mode=='verify') {
988
+ elseif ($mode == 'verify') {
989 989
   return (iban_get_nationalchecksum_part($iban) == $expected_nationalchecksum);
990 990
  }
991 991
 }
992 992
 
993 993
 # Implement the national checksum systems based on Verhoeff Algorithm
994
-function _iban_nationalchecksum_implementation_verhoeff($iban,$mode,$strip_length_end,$strip_length_front=0) {
995
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
994
+function _iban_nationalchecksum_implementation_verhoeff($iban, $mode, $strip_length_end, $strip_length_front = 0) {
995
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
996 996
  # first, extract the BBAN
997 997
  $bban = iban_get_bban_part($iban);
998 998
  # if necessary, drop this many leading characters
999
- $bban = substr($bban,$strip_length_front);
999
+ $bban = substr($bban, $strip_length_front);
1000 1000
  # drop the trailing checksum digit
1001
- $bban_less_checksum = substr($bban,0,strlen($bban)-$strip_length_end);
1001
+ $bban_less_checksum = substr($bban, 0, strlen($bban) - $strip_length_end);
1002 1002
  # get the current and computed checksum
1003 1003
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
1004 1004
  $expected_nationalchecksum = _verhoeff($bban_less_checksum);
1005 1005
  # return
1006
- if($mode=='find') {
1006
+ if ($mode == 'find') {
1007 1007
   return $expected_nationalchecksum;
1008 1008
  }
1009
- elseif($mode=='set') {
1010
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
1009
+ elseif ($mode == 'set') {
1010
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
1011 1011
  }
1012
- elseif($mode=='verify') {
1012
+ elseif ($mode == 'verify') {
1013 1013
   return (iban_get_nationalchecksum_part($iban) == $expected_nationalchecksum);
1014 1014
  }
1015 1015
 }
@@ -1021,80 +1021,80 @@  discard block
 block discarded – undo
1021 1021
 # (Credit: php-iso7064 @ https://github.com/globalcitizen/php-iso7064)
1022 1022
 function _iso7064_mod97_10_generated($input) {
1023 1023
  $input = strtoupper($input); # normalize
1024
- if(!preg_match('/^[0123456789]+$/',$input)) { return ''; } # bad input
1024
+ if (!preg_match('/^[0123456789]+$/', $input)) { return ''; } # bad input
1025 1025
  $modulus       = 97;
1026 1026
  $radix         = 10;
1027 1027
  $output_values = '0123456789';
1028 1028
  $p             = 0;
1029
- for($i=0; $i<strlen($input); $i++) {
1030
-  $val = strpos($output_values,substr($input,$i,1));
1031
-  if($val < 0) { return ''; } # illegal character encountered
1029
+ for ($i = 0; $i < strlen($input); $i++) {
1030
+  $val = strpos($output_values, substr($input, $i, 1));
1031
+  if ($val < 0) { return ''; } # illegal character encountered
1032 1032
   $p = (($p + $val) * $radix) % $modulus;
1033 1033
  }
1034
-$p = ($p*$radix) % $modulus;
1034
+$p = ($p * $radix) % $modulus;
1035 1035
  $checksum = ($modulus - $p + 1) % $modulus;
1036 1036
  $second = $checksum % $radix;
1037 1037
  $first = ($checksum - $second) / $radix;
1038
- return substr($output_values,$first,1) . substr($output_values,$second,1);
1038
+ return substr($output_values, $first, 1).substr($output_values, $second, 1);
1039 1039
 }
1040 1040
 
1041 1041
 # Implement the national checksum for an Montenegro (ME) IBAN
1042 1042
 #  (NOTE: Reverse engineered)
1043
-function _iban_nationalchecksum_implementation_me($iban,$mode) {
1044
- return _iban_nationalchecksum_implementation_mod97_10($iban,$mode);
1043
+function _iban_nationalchecksum_implementation_me($iban, $mode) {
1044
+ return _iban_nationalchecksum_implementation_mod97_10($iban, $mode);
1045 1045
 }
1046 1046
 
1047 1047
 # Implement the national checksum for an Macedonia (MK) IBAN
1048 1048
 #  (NOTE: Reverse engineered)
1049
-function _iban_nationalchecksum_implementation_mk($iban,$mode) {
1050
- return _iban_nationalchecksum_implementation_mod97_10($iban,$mode);
1049
+function _iban_nationalchecksum_implementation_mk($iban, $mode) {
1050
+ return _iban_nationalchecksum_implementation_mod97_10($iban, $mode);
1051 1051
 }
1052 1052
 
1053 1053
 # Implement the national checksum for an Netherlands (NL) IBAN
1054 1054
 #  This applies to most banks, but not to 'INGB', therefore we
1055 1055
 #  treat it specially here.
1056 1056
 #  (Original code: Validate_NL PEAR class, since extended)
1057
-function _iban_nationalchecksum_implementation_nl($iban,$mode) {
1058
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1057
+function _iban_nationalchecksum_implementation_nl($iban, $mode) {
1058
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1059 1059
  $bank = iban_get_bank_part($iban);
1060
- if(strtoupper($bank) == 'INGB') {
1060
+ if (strtoupper($bank) == 'INGB') {
1061 1061
   return '';
1062 1062
  }
1063 1063
  $account = iban_get_account_part($iban);
1064 1064
  $checksum = 0;
1065 1065
  for ($i = 0; $i < 10; $i++) {
1066
-  $checksum += ((int)$account[$i] * (10 - $i));
1066
+  $checksum += ((int) $account[$i] * (10 - $i));
1067 1067
  }
1068 1068
  $remainder = $checksum % 11;
1069
- if($mode=='verify') {
1070
-  return ($remainder==0); # we return the result of mod11, if 0 it's good
1069
+ if ($mode == 'verify') {
1070
+  return ($remainder == 0); # we return the result of mod11, if 0 it's good
1071 1071
  }
1072
- elseif($mode=='set') {
1073
-  if($remainder==0) {
1072
+ elseif ($mode == 'set') {
1073
+  if ($remainder == 0) {
1074 1074
    return $iban; # we return as expected if the checksum is ok
1075 1075
   }
1076 1076
   return ''; # we return unimplemented if the checksum is bad
1077 1077
  }
1078
- elseif($mode=='find') {
1078
+ elseif ($mode == 'find') {
1079 1079
   return ''; # does not make sense for this 0-digit checksum
1080 1080
  }
1081 1081
 }
1082 1082
 
1083 1083
 # Implement the national checksum for an Portugal (PT) IBAN
1084 1084
 #  (NOTE: Reverse engineered)
1085
-function _iban_nationalchecksum_implementation_pt($iban,$mode) {
1086
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1085
+function _iban_nationalchecksum_implementation_pt($iban, $mode) {
1086
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1087 1087
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
1088 1088
  $bban = iban_get_bban_part($iban);
1089
- $bban_less_checksum = substr($bban,0,strlen($bban)-2);
1089
+ $bban_less_checksum = substr($bban, 0, strlen($bban) - 2);
1090 1090
  $expected_nationalchecksum = _iso7064_mod97_10_generated($bban_less_checksum);
1091
- if($mode=='find') {
1091
+ if ($mode == 'find') {
1092 1092
   return $expected_nationalchecksum;
1093 1093
  }
1094
- elseif($mode=='set') {
1095
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
1094
+ elseif ($mode == 'set') {
1095
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
1096 1096
  }
1097
- elseif($mode=='verify') {
1097
+ elseif ($mode == 'verify') {
1098 1098
   return ($nationalchecksum == $expected_nationalchecksum);
1099 1099
  }
1100 1100
 }
@@ -1103,33 +1103,33 @@  discard block
 block discarded – undo
1103 1103
 #  (NOTE: Reverse engineered, including bank 'Narodna banka Srbije' (908) exception. For two 
1104 1104
 #         separately published and legitimate looking IBANs from that bank, there appears to
1105 1105
 #         be a +97 offset on the checksum, so we simply ignore all checksums for this bank.)
1106
-function _iban_nationalchecksum_implementation_rs($iban,$mode) {
1106
+function _iban_nationalchecksum_implementation_rs($iban, $mode) {
1107 1107
  $bank = iban_get_bank_part($iban);
1108
- if($bank == '908') {
1108
+ if ($bank == '908') {
1109 1109
   return '';
1110 1110
  }
1111
- return _iban_nationalchecksum_implementation_mod97_10($iban,$mode);
1111
+ return _iban_nationalchecksum_implementation_mod97_10($iban, $mode);
1112 1112
 }
1113 1113
 
1114 1114
 # Implement the national checksum for an Slovenia (SI) IBAN
1115 1115
 #  Note: It appears that the central bank does not use these
1116 1116
 #        checksums, thus an exception has been added.
1117 1117
 #  (NOTE: Reverse engineered)
1118
-function _iban_nationalchecksum_implementation_si($iban,$mode) {
1118
+function _iban_nationalchecksum_implementation_si($iban, $mode) {
1119 1119
  $bank = iban_get_bank_part($iban);
1120 1120
  # Bank of Slovenia does not use the legacy checksum scheme.
1121 1121
  #  Accounts in this namespace appear to be the central bank 
1122 1122
  #  accounts for licensed local banks.
1123
- if($bank == '01') {
1123
+ if ($bank == '01') {
1124 1124
   return '';
1125 1125
  }
1126
- return _iban_nationalchecksum_implementation_mod97_10($iban,$mode);
1126
+ return _iban_nationalchecksum_implementation_mod97_10($iban, $mode);
1127 1127
 }
1128 1128
 
1129 1129
 # Implement the national checksum for Slovak Republic (SK) IBAN
1130 1130
 # Source of algorithm: https://www.nbs.sk/_img/Documents/_Legislativa/_Vestnik/OPAT8-09.pdf
1131 1131
 # Account number is currently verified only, it's possible to also add validation for bank code and account number prefix
1132
-function _iban_nationalchecksum_implementation_sk($iban,$mode) {
1132
+function _iban_nationalchecksum_implementation_sk($iban, $mode) {
1133 1133
  if ($mode !== 'verify') {
1134 1134
   return '';
1135 1135
  }
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
  $weights = array(6, 3, 7, 9, 10, 5, 8, 4, 2, 1);
1139 1139
 
1140 1140
  $sum = 0;
1141
- for ($i=0; $i < 10; $i++) {
1141
+ for ($i = 0; $i < 10; $i++) {
1142 1142
   $sum += $account[$i] * $weights[$i];
1143 1143
  }
1144 1144
 
@@ -1146,38 +1146,38 @@  discard block
 block discarded – undo
1146 1146
 }
1147 1147
 
1148 1148
 # Implement the national checksum for MOD97-10 countries
1149
-function _iban_nationalchecksum_implementation_mod97_10($iban,$mode) {
1150
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1149
+function _iban_nationalchecksum_implementation_mod97_10($iban, $mode) {
1150
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1151 1151
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
1152 1152
  $bban = iban_get_bban_part($iban);
1153
- $bban_less_checksum = substr($bban,0,strlen($bban)-2);
1153
+ $bban_less_checksum = substr($bban, 0, strlen($bban) - 2);
1154 1154
  $expected_nationalchecksum = _iso7064_mod97_10_generated($bban_less_checksum);
1155
- if($mode=='find') {
1155
+ if ($mode == 'find') {
1156 1156
   return $expected_nationalchecksum;
1157 1157
  }
1158
- elseif($mode=='set') {
1159
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
1158
+ elseif ($mode == 'set') {
1159
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
1160 1160
  }
1161
- elseif($mode=='verify') {
1161
+ elseif ($mode == 'verify') {
1162 1162
   return ($nationalchecksum == $expected_nationalchecksum);
1163 1163
  }
1164 1164
 }
1165 1165
 
1166 1166
 # Implement the national checksum for an Timor-Lest (TL) IBAN
1167 1167
 #  (NOTE: Reverse engineered, but works on 2 different IBAN from official sources)
1168
-function _iban_nationalchecksum_implementation_tl($iban,$mode) {
1169
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1168
+function _iban_nationalchecksum_implementation_tl($iban, $mode) {
1169
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1170 1170
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
1171 1171
  $bban = iban_get_bban_part($iban);
1172
- $bban_less_checksum = substr($bban,0,strlen($bban)-2);
1172
+ $bban_less_checksum = substr($bban, 0, strlen($bban) - 2);
1173 1173
  $expected_nationalchecksum = _iso7064_mod97_10_generated($bban_less_checksum);
1174
- if($mode=='find') {
1174
+ if ($mode == 'find') {
1175 1175
   return $expected_nationalchecksum;
1176 1176
  }
1177
- elseif($mode=='set') {
1178
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
1177
+ elseif ($mode == 'set') {
1178
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
1179 1179
  }
1180
- elseif($mode=='verify') {
1180
+ elseif ($mode == 'verify') {
1181 1181
   return ($nationalchecksum == $expected_nationalchecksum);
1182 1182
  }
1183 1183
 }
@@ -1185,9 +1185,9 @@  discard block
 block discarded – undo
1185 1185
 # Luhn Check
1186 1186
 # (Credit: Adapted from @gajus' https://gist.github.com/troelskn/1287893#gistcomment-857491)
1187 1187
 function _luhn($string) {
1188
- $checksum='';
1188
+ $checksum = '';
1189 1189
  foreach (str_split(strrev((string) $string)) as $i => $d) {
1190
-  $checksum .= $i %2 !== 0 ? $d * 2 : $d;
1190
+  $checksum .= $i % 2 !== 0 ? $d * 2 : $d;
1191 1191
  }
1192 1192
  return array_sum(str_split($checksum)) % 10;
1193 1193
 }
@@ -1195,33 +1195,33 @@  discard block
 block discarded – undo
1195 1195
 # Verhoeff checksum
1196 1196
 # (Credit: Adapted from Semyon Velichko's code at https://en.wikibooks.org/wiki/Algorithm_Implementation/Checksums/Verhoeff_Algorithm#PHP)
1197 1197
 function _verhoeff($input) {
1198
- if($input == '' || preg_match('/[^0-9]/',$input)) { return ''; } # reject non-numeric input
1198
+ if ($input == '' || preg_match('/[^0-9]/', $input)) { return ''; } # reject non-numeric input
1199 1199
  $d = array(
1200
-       array(0,1,2,3,4,5,6,7,8,9),
1201
-       array(1,2,3,4,0,6,7,8,9,5),
1202
-       array(2,3,4,0,1,7,8,9,5,6),
1203
-       array(3,4,0,1,2,8,9,5,6,7),
1204
-       array(4,0,1,2,3,9,5,6,7,8),
1205
-       array(5,9,8,7,6,0,4,3,2,1),
1206
-       array(6,5,9,8,7,1,0,4,3,2),
1207
-       array(7,6,5,9,8,2,1,0,4,3),
1208
-       array(8,7,6,5,9,3,2,1,0,4),
1209
-       array(9,8,7,6,5,4,3,2,1,0)
1200
+       array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
1201
+       array(1, 2, 3, 4, 0, 6, 7, 8, 9, 5),
1202
+       array(2, 3, 4, 0, 1, 7, 8, 9, 5, 6),
1203
+       array(3, 4, 0, 1, 2, 8, 9, 5, 6, 7),
1204
+       array(4, 0, 1, 2, 3, 9, 5, 6, 7, 8),
1205
+       array(5, 9, 8, 7, 6, 0, 4, 3, 2, 1),
1206
+       array(6, 5, 9, 8, 7, 1, 0, 4, 3, 2),
1207
+       array(7, 6, 5, 9, 8, 2, 1, 0, 4, 3),
1208
+       array(8, 7, 6, 5, 9, 3, 2, 1, 0, 4),
1209
+       array(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
1210 1210
       );
1211 1211
   $p = array(
1212
-        array(0,1,2,3,4,5,6,7,8,9),
1213
-        array(1,5,7,6,2,8,3,0,9,4),
1214
-        array(5,8,0,3,7,9,6,1,4,2),
1215
-        array(8,9,1,6,0,4,3,5,2,7),
1216
-        array(9,4,5,3,1,2,6,8,7,0),
1217
-        array(4,2,8,6,5,7,3,9,0,1),
1218
-        array(2,7,9,3,8,0,6,4,1,5),
1219
-        array(7,0,4,6,9,1,3,2,5,8)
1212
+        array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
1213
+        array(1, 5, 7, 6, 2, 8, 3, 0, 9, 4),
1214
+        array(5, 8, 0, 3, 7, 9, 6, 1, 4, 2),
1215
+        array(8, 9, 1, 6, 0, 4, 3, 5, 2, 7),
1216
+        array(9, 4, 5, 3, 1, 2, 6, 8, 7, 0),
1217
+        array(4, 2, 8, 6, 5, 7, 3, 9, 0, 1),
1218
+        array(2, 7, 9, 3, 8, 0, 6, 4, 1, 5),
1219
+        array(7, 0, 4, 6, 9, 1, 3, 2, 5, 8)
1220 1220
        );
1221
-  $inv = array(0,4,3,2,1,5,6,7,8,9);
1221
+  $inv = array(0, 4, 3, 2, 1, 5, 6, 7, 8, 9);
1222 1222
   $r = 0;
1223
-  foreach(array_reverse(str_split($input)) as $n => $N) {
1224
-   $r = $d[$r][$p[($n+1)%8][$N]];
1223
+  foreach (array_reverse(str_split($input)) as $n => $N) {
1224
+   $r = $d[$r][$p[($n + 1) % 8][$N]];
1225 1225
   }
1226 1226
   return $inv[$r];
1227 1227
 }
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 # Damm checksum
1230 1230
 # (Credit: https://en.wikibooks.org/wiki/Algorithm_Implementation/Checksums/Damm_Algorithm#PHP)
1231 1231
 function _damm($input) {
1232
- if($input=='' || preg_match('/[^0-9]/',$input)) { return ''; } # non-numeric input
1232
+ if ($input == '' || preg_match('/[^0-9]/', $input)) { return ''; } # non-numeric input
1233 1233
  // from http://www.md-software.de/math/DAMM_Quasigruppen.txt
1234 1234
  $matrix = array(
1235 1235
                 array(0, 3, 1, 7, 5, 9, 8, 6, 4, 2),
@@ -1244,35 +1244,35 @@  discard block
 block discarded – undo
1244 1244
                 array(2, 5, 8, 1, 4, 3, 6, 7, 9, 0),
1245 1245
            );
1246 1246
  $checksum = 0;
1247
- for ($i=0; $i<strlen($input); $i++) {
1248
-  $character = substr($input,$i,1);
1247
+ for ($i = 0; $i < strlen($input); $i++) {
1248
+  $character = substr($input, $i, 1);
1249 1249
   $checksum = $matrix[$checksum][$character];
1250 1250
  }
1251 1251
  return $checksum;
1252 1252
 }
1253 1253
 
1254 1254
 # Implement the national checksum for an Italian (IT) IBAN
1255
-function _iban_nationalchecksum_implementation_it($iban,$mode) {
1256
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1255
+function _iban_nationalchecksum_implementation_it($iban, $mode) {
1256
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution
1257 1257
  $nationalchecksum = iban_get_nationalchecksum_part($iban);
1258 1258
  $bban = iban_get_bban_part($iban);
1259
- $bban_less_checksum = substr($bban,1);
1259
+ $bban_less_checksum = substr($bban, 1);
1260 1260
  $expected_nationalchecksum = _italian($bban_less_checksum);
1261
- if($mode=='find') {
1261
+ if ($mode == 'find') {
1262 1262
   return $expected_nationalchecksum;
1263 1263
  }
1264
- elseif($mode=='set') {
1265
-  return _iban_nationalchecksum_set($iban,$expected_nationalchecksum);
1264
+ elseif ($mode == 'set') {
1265
+  return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
1266 1266
  }
1267
- elseif($mode=='verify') {
1267
+ elseif ($mode == 'verify') {
1268 1268
   return (iban_get_nationalchecksum_part($iban) == $expected_nationalchecksum);
1269 1269
  }
1270 1270
 }
1271 1271
 
1272 1272
 # Implement the national checksum for a San Marino (SM) IBAN
1273
-function _iban_nationalchecksum_implementation_sm($iban,$mode) {
1273
+function _iban_nationalchecksum_implementation_sm($iban, $mode) {
1274 1274
   // San Marino adheres to Italian rules.
1275
-  return _iban_nationalchecksum_implementation_it($iban,$mode);
1275
+  return _iban_nationalchecksum_implementation_it($iban, $mode);
1276 1276
 }
1277 1277
 
1278 1278
 # Italian (and San Marino's) checksum
@@ -1321,14 +1321,14 @@  discard block
 block discarded – undo
1321 1321
 #  If a national checksum algorithm does not exist or remains unimplemented for this country, or the supplied $iban or $mode is invalid, '' is returned.
1322 1322
 #  (NOTE: We cannot collapse 'verify' mode and implement here via simple string comparison between 'find' mode output and the nationalchecksum part,
1323 1323
 #         because some countries have systems which do not map to this approach, for example the Netherlands has no checksum part yet an algorithm exists)
1324
-function _iban_nationalchecksum_implementation($iban,$mode) {
1325
- if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } #  blank value on return to distinguish from correct execution
1324
+function _iban_nationalchecksum_implementation($iban, $mode) {
1325
+ if ($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } #  blank value on return to distinguish from correct execution
1326 1326
  $iban = iban_to_machine_format($iban);
1327 1327
  $country = iban_get_country_part($iban);
1328
- if(strlen($iban)!=iban_country_get_iban_length($country)) { return ''; }
1329
- $function_name = '_iban_nationalchecksum_implementation_' . strtolower($country);
1330
- if(function_exists($function_name)) {
1331
-  return $function_name($iban,$mode);
1328
+ if (strlen($iban) != iban_country_get_iban_length($country)) { return ''; }
1329
+ $function_name = '_iban_nationalchecksum_implementation_'.strtolower($country);
1330
+ if (function_exists($function_name)) {
1331
+  return $function_name($iban, $mode);
1332 1332
  }
1333 1333
  return '';
1334 1334
 }
Please login to merge, or discard this patch.
htdocs/includes/mike42/escpos-php/autoload.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@
 block discarded – undo
3 3
  * Users who do not have 'composer' to manage dependencies, include this
4 4
  * file to provide auto-loading of the classes in this library. 
5 5
  */
6
-spl_autoload_register ( function ($class) {
6
+spl_autoload_register(function($class) {
7 7
 	/*
8 8
 	 * PSR-4 autoloader, based on PHP Framework Interop Group snippet (Under MIT License.)
9 9
 	 * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
10 10
 	 */
11 11
 	$prefix = "Mike42\\";
12
-	$base_dir = __DIR__ . "/src/Mike42/";
12
+	$base_dir = __DIR__."/src/Mike42/";
13 13
 	
14 14
 	/* Only continue for classes in this namespace */
15
-	$len = strlen ( $prefix );
16
-	if (strncmp ( $prefix, $class, $len ) !== 0) {
15
+	$len = strlen($prefix);
16
+	if (strncmp($prefix, $class, $len) !== 0) {
17 17
 		return;
18 18
 	}
19 19
 	
20 20
 	/* Require the file if it exists */
21
-	$relative_class = substr ( $class, $len );
22
-	$file = $base_dir . str_replace ( '\\', '/', $relative_class ) . '.php';
23
-	if (file_exists ( $file )) {
21
+	$relative_class = substr($class, $len);
22
+	$file = $base_dir.str_replace('\\', '/', $relative_class).'.php';
23
+	if (file_exists($file)) {
24 24
 		require $file;
25 25
 	}
26 26
 } );
Please login to merge, or discard this patch.
htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/GdEscposImage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         if (!is_resource($im)) {
62 62
             throw new Exception("Failed to load image.");
63 63
         } elseif (!EscposImage::isGdLoaded()) {
64
-            throw new Exception(__FUNCTION__ . " requires 'gd' extension.");
64
+            throw new Exception(__FUNCTION__." requires 'gd' extension.");
65 65
         }
66 66
         /* Make a string of 1's and 0's */
67 67
         $imgHeight = imagesy($im);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 /* Faster to average channels, blend alpha and negate the image here than via filters (tested!) */
73 73
                 $cols = imagecolorsforindex($im, imagecolorat($im, $x, $y));
74 74
                 // 1 for white, 0 for black, ignoring transparency
75
-                $greyness = (int)(($cols['red'] + $cols['green'] + $cols['blue']) / 3) >> 7;
75
+                $greyness = (int) (($cols['red'] + $cols['green'] + $cols['blue']) / 3) >> 7;
76 76
                 // 1 for black, 0 for white, taking into account transparency
77 77
                 $black = (1 - $greyness) >> ($cols['alpha'] >> 6);
78 78
                 $imgData[$y * $imgWidth + $x] = $black;
Please login to merge, or discard this patch.
htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/CapabilityProfile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     public static function load(string $profileName)
284 284
     {
285 285
         self::loadCapabilitiesDataFile();
286
-        if (! isset(self::$profiles[$profileName])) {
286
+        if (!isset(self::$profiles[$profileName])) {
287 287
             $suggestionsArray = self::suggestProfileName($profileName);
288 288
             $suggestionsStr = implode(", ", $suggestionsArray);
289 289
             throw new InvalidArgumentException("The CapabilityProfile '$profileName' does not exist. Try one that does exist, such as $suggestionsStr.");
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     protected static function loadCapabilitiesDataFile()
298 298
     {
299 299
         if (self::$profiles === null) {
300
-            $filename = dirname(__FILE__) . "/resources/capabilities.json";
300
+            $filename = dirname(__FILE__)."/resources/capabilities.json";
301 301
             $capabilitiesData = json_decode(file_get_contents($filename), true);
302 302
             self::$profiles = $capabilitiesData['profiles'];
303 303
             self::$encodings = $capabilitiesData['encodings'];
Please login to merge, or discard this patch.