Passed
Push — master ( 9698e0...1a6dcb )
by
unknown
03:06
created
Components/Klarna/Currency.php 2 patches
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
     public static function fromCode($val)
65 65
     {
66 66
         switch(strtolower($val)) {
67
-        case 'dkk':
68
-            return self::DKK;
69
-        case 'eur':
70
-        case 'euro':
71
-            return self::EUR;
72
-        case 'nok':
73
-            return self::NOK;
74
-        case 'sek':
75
-            return self::SEK;
76
-        default:
77
-            return null;
67
+            case 'dkk':
68
+                return self::DKK;
69
+            case 'eur':
70
+            case 'euro':
71
+                return self::EUR;
72
+            case 'nok':
73
+                return self::NOK;
74
+            case 'sek':
75
+                return self::SEK;
76
+            default:
77
+                return null;
78 78
         }
79 79
     }
80 80
 
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
     public static function getCode($val)
89 89
     {
90 90
         switch($val) {
91
-        case self::DKK:
92
-            return 'dkk';
93
-        case self::EUR:
94
-            return 'eur';
95
-        case self::NOK:
96
-            return 'nok';
97
-        case self::SEK:
98
-            return 'sek';
99
-        default:
100
-            return null;
91
+            case self::DKK:
92
+                return 'dkk';
93
+            case self::EUR:
94
+                return 'eur';
95
+            case self::NOK:
96
+                return 'nok';
97
+            case self::SEK:
98
+                return 'sek';
99
+            default:
100
+                return null;
101 101
         }
102 102
     }
103 103
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public static function fromCode($val)
65 65
     {
66
-        switch(strtolower($val)) {
66
+        switch (strtolower($val)) {
67 67
         case 'dkk':
68 68
             return self::DKK;
69 69
         case 'eur':
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public static function getCode($val)
89 89
     {
90
-        switch($val) {
90
+        switch ($val) {
91 91
         case self::DKK:
92 92
             return 'dkk';
93 93
         case self::EUR:
Please login to merge, or discard this patch.
Components/Klarna/klarnacalc.php 2 patches
Switch Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -436,29 +436,29 @@  discard block
 block discarded – undo
436 436
 
437 437
         $type = $pclass->getType();
438 438
         switch($type) {
439
-        case KlarnaPClass::CAMPAIGN:
440
-        case KlarnaPClass::ACCOUNT:
441
-            return round(
442
-                self::_aprAnnuity(
443
-                    $sum, $pclass->getMonths(),
444
-                    $pclass->getInterestRate(),
445
-                    $pclass->getInvoiceFee(),
446
-                    $minpay
447
-                ),
448
-                2
449
-            );
450
-        case KlarnaPClass::SPECIAL:
451
-            throw new Klarna_PClassException(
452
-                'Method is not available for SPECIAL pclasses'
453
-            );
454
-        case KlarnaPClass::FIXED:
455
-            throw new Klarna_PClassException(
456
-                'Method is not available for FIXED pclasses'
457
-            );
458
-        default:
459
-            throw new Klarna_PClassException(
460
-                'Unknown PClass type! ('.$type.')'
461
-            );
439
+            case KlarnaPClass::CAMPAIGN:
440
+            case KlarnaPClass::ACCOUNT:
441
+                return round(
442
+                    self::_aprAnnuity(
443
+                        $sum, $pclass->getMonths(),
444
+                        $pclass->getInterestRate(),
445
+                        $pclass->getInvoiceFee(),
446
+                        $minpay
447
+                    ),
448
+                    2
449
+                );
450
+            case KlarnaPClass::SPECIAL:
451
+                throw new Klarna_PClassException(
452
+                    'Method is not available for SPECIAL pclasses'
453
+                );
454
+            case KlarnaPClass::FIXED:
455
+                throw new Klarna_PClassException(
456
+                    'Method is not available for FIXED pclasses'
457
+                );
458
+            default:
459
+                throw new Klarna_PClassException(
460
+                    'Unknown PClass type! ('.$type.')'
461
+                );
462 462
         }
463 463
     }
464 464
 
@@ -609,21 +609,21 @@  discard block
 block discarded – undo
609 609
         $country = KlarnaCountry::getCode($country);
610 610
 
611 611
         switch (strtoupper($country)) {
612
-        case "SE":
613
-            return 50.0;
614
-        case "NO":
615
-            return 95.0;
616
-        case "FI":
617
-            return 8.95;
618
-        case "DK":
619
-            return 89.0;
620
-        case "DE":
621
-        case "AT":
622
-            return 6.95;
623
-        case "NL":
624
-            return 5.0;
625
-        default:
626
-            throw new KlarnaException("Invalid country {$country}");
612
+            case "SE":
613
+                return 50.0;
614
+            case "NO":
615
+                return 95.0;
616
+            case "FI":
617
+                return 8.95;
618
+            case "DK":
619
+                return 89.0;
620
+            case "DE":
621
+            case "AT":
622
+                return 6.95;
623
+            case "NL":
624
+                return 5.0;
625
+            default:
626
+                throw new KlarnaException("Invalid country {$country}");
627 627
         }
628 628
     }
629 629
 
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
         $multiply = 1; //Round to closest integer
641 641
         $country = KlarnaCountry::getCode($country);
642 642
         switch($country) {
643
-        case "FI":
644
-        case "DE":
645
-        case "NL":
646
-        case "AT":
647
-            $multiply = 10; //Round to closest decimal
648
-            break;
643
+            case "FI":
644
+            case "DE":
645
+            case "NL":
646
+            case "AT":
647
+                $multiply = 10; //Round to closest decimal
648
+                break;
649 649
         }
650 650
 
651 651
         return floor(($value*$multiply)+0.5)/$multiply;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     private static function _midpoint($a, $b)
63 63
     {
64
-        return (($a+$b)/2);
64
+        return (($a + $b) / 2);
65 65
     }
66 66
 
67 67
     /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $month = $fromdayone;
84 84
         foreach ($payarray as $payment) {
85
-            $pval -= $payment / pow(1 + $rate/(12*100.0), $month++);
85
+            $pval -= $payment / pow(1 + $rate / (12 * 100.0), $month++);
86 86
         }
87 87
 
88 88
         return ($pval);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         // Standard divide and conquer.
127 127
         do {
128 128
             $mid = self::_midpoint($low, $high);
129
-            $midval  = self::_npv($pval, $payarray, $mid, $fromdayone);
129
+            $midval = self::_npv($pval, $payarray, $mid, $fromdayone);
130 130
             if (abs($midval) < self::$accuracy) {
131 131
                 //we are close enough
132 132
                 return ($mid);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
             $newpay = max($payment, $minpay);
224 224
             if ($base) {
225
-                $newpay = max($newpay, $bal/24.0 + $fee + $interest);
225
+                $newpay = max($newpay, $bal / 24.0 + $fee + $interest);
226 226
             }
227 227
 
228 228
             $bal = $newbal - $newpay;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
         }
256 256
 
257 257
         if ($rate == 0) {
258
-            return $pval/$months;
258
+            return $pval / $months;
259 259
         }
260 260
 
261
-        $p = $rate / (100.0*12);
262
-        return $pval * $p / (1 - pow((1+$p), -$months));
261
+        $p = $rate / (100.0 * 12);
262
+        return $pval * $p / (1 - pow((1 + $p), -$months));
263 263
     }
264 264
 
265 265
     /**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         }
377 377
 
378 378
         if (!is_numeric($free)) {
379
-            throw new Klarna_InvalidTypeException('free',  'integer');
379
+            throw new Klarna_InvalidTypeException('free', 'integer');
380 380
         }
381 381
 
382 382
         if (is_numeric($free) && !is_int($free)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 
386 386
         if ($free < 0) {
387 387
             throw new KlarnaException(
388
-                'Error in ' . __METHOD__ .
388
+                'Error in '.__METHOD__.
389 389
                 ': Number of free months must be positive or zero!'
390 390
             );
391 391
         }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         ) {
404 404
             throw new Klarna_InvalidTypeException(
405 405
                 'flags',
406
-                KlarnaFlags::CHECKOUT_PAGE . ' or ' . KlarnaFlags::PRODUCT_PAGE
406
+                KlarnaFlags::CHECKOUT_PAGE.' or '.KlarnaFlags::PRODUCT_PAGE
407 407
             );
408 408
         }
409 409
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         ) + $monthsfee;
436 436
 
437 437
         $type = $pclass->getType();
438
-        switch($type) {
438
+        switch ($type) {
439 439
         case KlarnaPClass::CAMPAIGN:
440 440
         case KlarnaPClass::ACCOUNT:
441 441
             return round(
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
         ) {
506 506
             throw new Klarna_InvalidTypeException(
507 507
                 'flags',
508
-                KlarnaFlags::CHECKOUT_PAGE . ' or ' . KlarnaFlags::PRODUCT_PAGE
508
+                KlarnaFlags::CHECKOUT_PAGE.' or '.KlarnaFlags::PRODUCT_PAGE
509 509
             );
510 510
         }
511 511
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         ) {
580 580
             throw new Klarna_InvalidTypeException(
581 581
                 'flags',
582
-                KlarnaFlags::CHECKOUT_PAGE . ' or ' . KlarnaFlags::PRODUCT_PAGE
582
+                KlarnaFlags::CHECKOUT_PAGE.' or '.KlarnaFlags::PRODUCT_PAGE
583 583
             );
584 584
         }
585 585
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     {
640 640
         $multiply = 1; //Round to closest integer
641 641
         $country = KlarnaCountry::getCode($country);
642
-        switch($country) {
642
+        switch ($country) {
643 643
         case "FI":
644 644
         case "DE":
645 645
         case "NL":
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             break;
649 649
         }
650 650
 
651
-        return floor(($value*$multiply)+0.5)/$multiply;
651
+        return floor(($value * $multiply) + 0.5) / $multiply;
652 652
     }
653 653
 
654 654
 }
Please login to merge, or discard this patch.
Components/Klarna/pclasses/pdostorage.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     public function connect($config)
51 51
     {
52
-        if(is_array($config) && $config['pdo'] instanceof PDO) {
52
+        if (is_array($config) && $config['pdo'] instanceof PDO) {
53 53
             $this->pdo = $config['pdo'];
54 54
             $this->dbTable = $config['table'];
55 55
         } else {
Please login to merge, or discard this patch.
Components/Klarna/pclasses/mysqlstorage.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@
 block discarded – undo
337 337
                 "DELETE FROM `{$this->dbName}`.`{$this->dbTable}`",
338 338
                 $this->link
339 339
             );
340
-        } catch(Exception $e) {
340
+        } catch (Exception $e) {
341 341
             throw new Klarna_DatabaseException(
342 342
                 $e->getMessage(), $e->getCode()
343 343
             );
Please login to merge, or discard this patch.
Components/Klarna/pclasses/storage.intf.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      */
53 53
     public function addPClass($pclass)
54 54
     {
55
-        if (! $pclass instanceof KlarnaPClass) {
55
+        if (!$pclass instanceof KlarnaPClass) {
56 56
             throw new Klarna_InvalidTypeException('pclass', 'KlarnaPClass');
57 57
         }
58 58
 
Please login to merge, or discard this patch.
Components/Klarna/pclasses/jsonstorage.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
             } else {
144 144
                 file_put_contents($uri, "");
145 145
             }
146
-        } catch(Exception $e) {
146
+        } catch (Exception $e) {
147 147
             throw new KlarnaException($e->getMessage());
148 148
         }
149 149
     }
Please login to merge, or discard this patch.
Components/Klarna/checkout/checkouthtml.intf.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     {
49 49
         $eid = strval($eid);
50 50
         while (strlen($eid) < 10) {
51
-            $eid = "0" . $eid; //Zero-pad the eid.
51
+            $eid = "0".$eid; //Zero-pad the eid.
52 52
         }
53 53
 
54 54
         $sid = str_replace(array(' ', ',', '.'), '', microtime());
Please login to merge, or discard this patch.
Components/Klarna/Country.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -248,11 +248,11 @@
 block discarded – undo
248 248
 
249 249
     private static $_tlcFlip = array();
250 250
 
251
-      /**
252
-     * Cache for the flipped country array
253
-     *
254
-     * @var array
255
-     */
251
+        /**
252
+         * Cache for the flipped country array
253
+         *
254
+         * @var array
255
+         */
256 256
     private static $_countryFlip = array();
257 257
 
258 258
     /**
Please login to merge, or discard this patch.
Switch Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
     public static function checkLanguage($country, $language)
143 143
     {
144 144
         switch($country) {
145
-        case KlarnaCountry::AT:
146
-        case KlarnaCountry::DE:
147
-            return ($language === KlarnaLanguage::DE);
148
-        case KlarnaCountry::NL:
149
-            return ($language === KlarnaLanguage::NL);
150
-        case KlarnaCountry::FI:
151
-            return ($language === KlarnaLanguage::FI);
152
-        case KlarnaCountry::DK:
153
-            return ($language === KlarnaLanguage::DA);
154
-        case KlarnaCountry::NO:
155
-            return ($language === KlarnaLanguage::NB);
156
-        case KlarnaCountry::SE:
157
-            return ($language === KlarnaLanguage::SV);
158
-        default:
159
-            //Country not yet supported by Klarna.
160
-            return false;
145
+            case KlarnaCountry::AT:
146
+            case KlarnaCountry::DE:
147
+                return ($language === KlarnaLanguage::DE);
148
+            case KlarnaCountry::NL:
149
+                return ($language === KlarnaLanguage::NL);
150
+            case KlarnaCountry::FI:
151
+                return ($language === KlarnaLanguage::FI);
152
+            case KlarnaCountry::DK:
153
+                return ($language === KlarnaLanguage::DA);
154
+            case KlarnaCountry::NO:
155
+                return ($language === KlarnaLanguage::NB);
156
+            case KlarnaCountry::SE:
157
+                return ($language === KlarnaLanguage::SV);
158
+            default:
159
+                //Country not yet supported by Klarna.
160
+                return false;
161 161
         }
162 162
     }
163 163
     /**
@@ -173,20 +173,20 @@  discard block
 block discarded – undo
173 173
     public static function checkCurrency($country, $currency)
174 174
     {
175 175
         switch($country) {
176
-        case KlarnaCountry::AT:
177
-        case KlarnaCountry::DE:
178
-        case KlarnaCountry::NL:
179
-        case KlarnaCountry::FI:
180
-            return ($currency === KlarnaCurrency::EUR);
181
-        case KlarnaCountry::DK:
182
-            return ($currency === KlarnaCurrency::DKK);
183
-        case KlarnaCountry::NO:
184
-            return ($currency === KlarnaCurrency::NOK);
185
-        case KlarnaCountry::SE:
186
-            return ($currency === KlarnaCurrency::SEK);
187
-        default:
188
-            //Country not yet supported by Klarna.
189
-            return false;
176
+            case KlarnaCountry::AT:
177
+            case KlarnaCountry::DE:
178
+            case KlarnaCountry::NL:
179
+            case KlarnaCountry::FI:
180
+                return ($currency === KlarnaCurrency::EUR);
181
+            case KlarnaCountry::DK:
182
+                return ($currency === KlarnaCurrency::DKK);
183
+            case KlarnaCountry::NO:
184
+                return ($currency === KlarnaCurrency::NOK);
185
+            case KlarnaCountry::SE:
186
+                return ($currency === KlarnaCurrency::SEK);
187
+            default:
188
+                //Country not yet supported by Klarna.
189
+                return false;
190 190
         }
191 191
     }
192 192
     /**
@@ -201,21 +201,21 @@  discard block
 block discarded – undo
201 201
     public static function getLanguage($country)
202 202
     {
203 203
         switch($country) {
204
-        case KlarnaCountry::AT:
205
-        case KlarnaCountry::DE:
206
-            return KlarnaLanguage::DE;
207
-        case KlarnaCountry::NL:
208
-            return KlarnaLanguage::NL;
209
-        case KlarnaCountry::FI:
210
-            return KlarnaLanguage::FI;
211
-        case KlarnaCountry::DK:
212
-            return KlarnaLanguage::DA;
213
-        case KlarnaCountry::NO:
214
-            return KlarnaLanguage::NB;
215
-        case KlarnaCountry::SE:
216
-            return KlarnaLanguage::SV;
217
-        default:
218
-            return KlarnaLanguage::EN;
204
+            case KlarnaCountry::AT:
205
+            case KlarnaCountry::DE:
206
+                return KlarnaLanguage::DE;
207
+            case KlarnaCountry::NL:
208
+                return KlarnaLanguage::NL;
209
+            case KlarnaCountry::FI:
210
+                return KlarnaLanguage::FI;
211
+            case KlarnaCountry::DK:
212
+                return KlarnaLanguage::DA;
213
+            case KlarnaCountry::NO:
214
+                return KlarnaLanguage::NB;
215
+            case KlarnaCountry::SE:
216
+                return KlarnaLanguage::SV;
217
+            default:
218
+                return KlarnaLanguage::EN;
219 219
         }
220 220
     }
221 221
     /**
@@ -230,19 +230,19 @@  discard block
 block discarded – undo
230 230
     public static function getCurrency($country)
231 231
     {
232 232
         switch($country) {
233
-        case KlarnaCountry::AT:
234
-        case KlarnaCountry::DE:
235
-        case KlarnaCountry::NL:
236
-        case KlarnaCountry::FI:
237
-            return KlarnaCurrency::EUR;
238
-        case KlarnaCountry::DK:
239
-            return KlarnaCurrency::DKK;
240
-        case KlarnaCountry::NO:
241
-            return KlarnaCurrency::NOK;
242
-        case KlarnaCountry::SE:
243
-            return KlarnaCurrency::SEK;
244
-        default:
245
-            return false;
233
+            case KlarnaCountry::AT:
234
+            case KlarnaCountry::DE:
235
+            case KlarnaCountry::NL:
236
+            case KlarnaCountry::FI:
237
+                return KlarnaCurrency::EUR;
238
+            case KlarnaCountry::DK:
239
+                return KlarnaCurrency::DKK;
240
+            case KlarnaCountry::NO:
241
+                return KlarnaCurrency::NOK;
242
+            case KlarnaCountry::SE:
243
+                return KlarnaCurrency::SEK;
244
+            default:
245
+                return false;
246 246
         }
247 247
     }
248 248
 
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public static function checkLanguage($country, $language)
143 143
     {
144
-        switch($country) {
144
+        switch ($country) {
145 145
         case KlarnaCountry::AT:
146 146
         case KlarnaCountry::DE:
147 147
             return ($language === KlarnaLanguage::DE);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public static function checkCurrency($country, $currency)
174 174
     {
175
-        switch($country) {
175
+        switch ($country) {
176 176
         case KlarnaCountry::AT:
177 177
         case KlarnaCountry::DE:
178 178
         case KlarnaCountry::NL:
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public static function getLanguage($country)
202 202
     {
203
-        switch($country) {
203
+        switch ($country) {
204 204
         case KlarnaCountry::AT:
205 205
         case KlarnaCountry::DE:
206 206
             return KlarnaLanguage::DE;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public static function getCurrency($country)
231 231
     {
232
-        switch($country) {
232
+        switch ($country) {
233 233
         case KlarnaCountry::AT:
234 234
         case KlarnaCountry::DE:
235 235
         case KlarnaCountry::NL:
@@ -261,105 +261,105 @@  discard block
 block discarded – undo
261 261
      * @var array
262 262
      */
263 263
     private static $_countries = array(
264
-        'AF' => 1,   //     AFGHANISTAN
265
-        'AX' => 2,   //     ÅLAND ISLANDS
266
-        'AL' => 3,   //     ALBANIA
267
-        'DZ' => 4,   //     ALGERIA
268
-        'AS' => 5,   //     AMERICAN SAMOA
269
-        'AD' => 6,   //     ANDORRA
270
-        'AO' => 7,   //     ANGOLA
271
-        'AI' => 8,   //     ANGUILLA
272
-        'AQ' => 9,   //     ANTARCTICA
273
-        'AG' => 10,  //     ANTIGUA AND BARBUDA
274
-        'AR' => 11,  //     ARGENTINA
275
-        'AM' => 12,  //     ARMENIA
276
-        'AW' => 13,  //     ARUBA
277
-        'AU' => 14,  //     AUSTRALIA
278
-        'AT' => 15,  //     AUSTRIA
279
-        'AZ' => 16,  //     AZERBAIJAN
280
-        'BS' => 17,  //     BAHAMAS
281
-        'BH' => 18,  //     BAHRAIN
282
-        'BD' => 19,  //     BANGLADESH
283
-        'BB' => 20,  //     BARBADOS
284
-        'BY' => 21,  //     BELARUS
285
-        'BE' => 22,  //     BELGIUM
286
-        'BZ' => 23,  //     BELIZE
287
-        'BJ' => 24,  //     BENIN
288
-        'BM' => 25,  //     BERMUDA
289
-        'BT' => 26,  //     BHUTAN
290
-        'BO' => 27,  //     BOLIVIA
291
-        'BA' => 28,  //     BOSNIA AND HERZEGOVINA
292
-        'BW' => 29,  //     BOTSWANA
293
-        'BV' => 30,  //     BOUVET ISLAND
294
-        'BR' => 31,  //     BRAZIL
295
-        'IO' => 32,  //     BRITISH INDIAN OCEAN TERRITORY
296
-        'BN' => 33,  //     BRUNEI DARUSSALAM
297
-        'BG' => 34,  //     BULGARIA
298
-        'BF' => 35,  //     BURKINA FASO
299
-        'BI' => 36,  //     BURUNDI
300
-        'KH' => 37,  //     CAMBODIA
301
-        'CM' => 38,  //     CAMEROON
302
-        'CA' => 39,  //     CANADA
303
-        'CV' => 40,  //     CAPE VERDE
304
-        'KY' => 41,  //     CAYMAN ISLANDS
305
-        'CF' => 42,  //     CENTRAL AFRICAN REPUBLIC
306
-        'TD' => 43,  //     CHAD
307
-        'CL' => 44,  //     CHILE
308
-        'CN' => 45,  //     CHINA
309
-        'CX' => 46,  //     CHRISTMAS ISLAND
310
-        'CC' => 47,  //     COCOS (KEELING) ISLANDS
311
-        'CO' => 48,  //     COLOMBIA
312
-        'KM' => 49,  //     COMOROS
313
-        'CG' => 50,  //     CONGO
314
-        'CD' => 51,  //     CONGO, THE DEMOCRATIC REPUBLIC OF THE
315
-        'CK' => 52,  //     COOK ISLANDS
316
-        'CR' => 53,  //     COSTA RICA
317
-        'CI' => 54,  //     COTE D'IVOIRE
318
-        'HR' => 55,  //     CROATIA
319
-        'CU' => 56,  //     CUBA
320
-        'CY' => 57,  //     CYPRUS
321
-        'CZ' => 58,  //     CZECH REPUBLIC
322
-        'DK' => 59,  //     DENMARK
323
-        'DJ' => 60,  //     DJIBOUTI
324
-        'DM' => 61,  //     DOMINICA
325
-        'DO' => 62,  //     DOMINICAN REPUBLIC
326
-        'EC' => 63,  //     ECUADOR
327
-        'EG' => 64,  //     EGYPT
328
-        'SV' => 65,  //     EL SALVADOR
329
-        'GQ' => 66,  //     EQUATORIAL GUINEA
330
-        'ER' => 67,  //     ERITREA
331
-        'EE' => 68,  //     ESTONIA
332
-        'ET' => 69,  //     ETHIOPIA
333
-        'FK' => 70,  //     FALKLAND ISLANDS (MALVINAS)
334
-        'FO' => 71,  //     FAROE ISLANDS
335
-        'FJ' => 72,  //     FIJI
336
-        'FI' => 73,  //     FINLAND
337
-        'FR' => 74,  //     FRANCE
338
-        'GF' => 75,  //     FRENCH GUIANA
339
-        'PF' => 76,  //     FRENCH POLYNESIA
340
-        'TF' => 77,  //     FRENCH SOUTHERN TERRITORIES
341
-        'GA' => 78,  //     GABON
342
-        'GM' => 79,  //     GAMBIA
343
-        'GE' => 80,  //     GEORGIA
344
-        'DE' => 81,  //     GERMANY
345
-        'GH' => 82,  //     GHANA
346
-        'GI' => 83,  //     GIBRALTAR
347
-        'GR' => 84,  //     GREECE
348
-        'GL' => 85,  //     GREENLAND
349
-        'GD' => 86,  //     GRENADA
350
-        'GP' => 87,  //     GUADELOUPE
351
-        'GU' => 88,  //     GUAM
352
-        'GT' => 89,  //     GUATEMALA
353
-        'GG' => 90,  //     GUERNSEY
354
-        'GN' => 91,  //     GUINEA
355
-        'GW' => 92,  //     GUINEA-BISSAU
356
-        'GY' => 93,  //     GUYANA
357
-        'HT' => 94,  //     HAITI
358
-        'HM' => 95,  //     HEARD ISLAND AND MCDONALD ISLANDS
359
-        'VA' => 96,  //     HOLY SEE (VATICAN CITY STATE)
360
-        'HN' => 97,  //     HONDURAS
361
-        'HK' => 98,  //     HONG KONG
362
-        'HU' => 99,  //     HUNGARY
264
+        'AF' => 1, //     AFGHANISTAN
265
+        'AX' => 2, //     ÅLAND ISLANDS
266
+        'AL' => 3, //     ALBANIA
267
+        'DZ' => 4, //     ALGERIA
268
+        'AS' => 5, //     AMERICAN SAMOA
269
+        'AD' => 6, //     ANDORRA
270
+        'AO' => 7, //     ANGOLA
271
+        'AI' => 8, //     ANGUILLA
272
+        'AQ' => 9, //     ANTARCTICA
273
+        'AG' => 10, //     ANTIGUA AND BARBUDA
274
+        'AR' => 11, //     ARGENTINA
275
+        'AM' => 12, //     ARMENIA
276
+        'AW' => 13, //     ARUBA
277
+        'AU' => 14, //     AUSTRALIA
278
+        'AT' => 15, //     AUSTRIA
279
+        'AZ' => 16, //     AZERBAIJAN
280
+        'BS' => 17, //     BAHAMAS
281
+        'BH' => 18, //     BAHRAIN
282
+        'BD' => 19, //     BANGLADESH
283
+        'BB' => 20, //     BARBADOS
284
+        'BY' => 21, //     BELARUS
285
+        'BE' => 22, //     BELGIUM
286
+        'BZ' => 23, //     BELIZE
287
+        'BJ' => 24, //     BENIN
288
+        'BM' => 25, //     BERMUDA
289
+        'BT' => 26, //     BHUTAN
290
+        'BO' => 27, //     BOLIVIA
291
+        'BA' => 28, //     BOSNIA AND HERZEGOVINA
292
+        'BW' => 29, //     BOTSWANA
293
+        'BV' => 30, //     BOUVET ISLAND
294
+        'BR' => 31, //     BRAZIL
295
+        'IO' => 32, //     BRITISH INDIAN OCEAN TERRITORY
296
+        'BN' => 33, //     BRUNEI DARUSSALAM
297
+        'BG' => 34, //     BULGARIA
298
+        'BF' => 35, //     BURKINA FASO
299
+        'BI' => 36, //     BURUNDI
300
+        'KH' => 37, //     CAMBODIA
301
+        'CM' => 38, //     CAMEROON
302
+        'CA' => 39, //     CANADA
303
+        'CV' => 40, //     CAPE VERDE
304
+        'KY' => 41, //     CAYMAN ISLANDS
305
+        'CF' => 42, //     CENTRAL AFRICAN REPUBLIC
306
+        'TD' => 43, //     CHAD
307
+        'CL' => 44, //     CHILE
308
+        'CN' => 45, //     CHINA
309
+        'CX' => 46, //     CHRISTMAS ISLAND
310
+        'CC' => 47, //     COCOS (KEELING) ISLANDS
311
+        'CO' => 48, //     COLOMBIA
312
+        'KM' => 49, //     COMOROS
313
+        'CG' => 50, //     CONGO
314
+        'CD' => 51, //     CONGO, THE DEMOCRATIC REPUBLIC OF THE
315
+        'CK' => 52, //     COOK ISLANDS
316
+        'CR' => 53, //     COSTA RICA
317
+        'CI' => 54, //     COTE D'IVOIRE
318
+        'HR' => 55, //     CROATIA
319
+        'CU' => 56, //     CUBA
320
+        'CY' => 57, //     CYPRUS
321
+        'CZ' => 58, //     CZECH REPUBLIC
322
+        'DK' => 59, //     DENMARK
323
+        'DJ' => 60, //     DJIBOUTI
324
+        'DM' => 61, //     DOMINICA
325
+        'DO' => 62, //     DOMINICAN REPUBLIC
326
+        'EC' => 63, //     ECUADOR
327
+        'EG' => 64, //     EGYPT
328
+        'SV' => 65, //     EL SALVADOR
329
+        'GQ' => 66, //     EQUATORIAL GUINEA
330
+        'ER' => 67, //     ERITREA
331
+        'EE' => 68, //     ESTONIA
332
+        'ET' => 69, //     ETHIOPIA
333
+        'FK' => 70, //     FALKLAND ISLANDS (MALVINAS)
334
+        'FO' => 71, //     FAROE ISLANDS
335
+        'FJ' => 72, //     FIJI
336
+        'FI' => 73, //     FINLAND
337
+        'FR' => 74, //     FRANCE
338
+        'GF' => 75, //     FRENCH GUIANA
339
+        'PF' => 76, //     FRENCH POLYNESIA
340
+        'TF' => 77, //     FRENCH SOUTHERN TERRITORIES
341
+        'GA' => 78, //     GABON
342
+        'GM' => 79, //     GAMBIA
343
+        'GE' => 80, //     GEORGIA
344
+        'DE' => 81, //     GERMANY
345
+        'GH' => 82, //     GHANA
346
+        'GI' => 83, //     GIBRALTAR
347
+        'GR' => 84, //     GREECE
348
+        'GL' => 85, //     GREENLAND
349
+        'GD' => 86, //     GRENADA
350
+        'GP' => 87, //     GUADELOUPE
351
+        'GU' => 88, //     GUAM
352
+        'GT' => 89, //     GUATEMALA
353
+        'GG' => 90, //     GUERNSEY
354
+        'GN' => 91, //     GUINEA
355
+        'GW' => 92, //     GUINEA-BISSAU
356
+        'GY' => 93, //     GUYANA
357
+        'HT' => 94, //     HAITI
358
+        'HM' => 95, //     HEARD ISLAND AND MCDONALD ISLANDS
359
+        'VA' => 96, //     HOLY SEE (VATICAN CITY STATE)
360
+        'HN' => 97, //     HONDURAS
361
+        'HK' => 98, //     HONG KONG
362
+        'HU' => 99, //     HUNGARY
363 363
         'IS' => 100, //     ICELAND
364 364
         'IN' => 101, //     INDIA
365 365
         'ID' => 102, //     INDONESIA
Please login to merge, or discard this patch.
Components/Klarna/Encoding.php 2 patches
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -114,22 +114,22 @@  discard block
 block discarded – undo
114 114
     public static function get($country)
115 115
     {
116 116
         switch (strtoupper($country)) {
117
-        case "DE":
118
-            return KlarnaEncoding::PNO_DE;
119
-        case "DK":
120
-            return KlarnaEncoding::PNO_DK;
121
-        case "FI":
122
-            return KlarnaEncoding::PNO_FI;
123
-        case "NL":
124
-            return KlarnaEncoding::PNO_NL;
125
-        case "NO":
126
-            return KlarnaEncoding::PNO_NO;
127
-        case "SE":
128
-            return KlarnaEncoding::PNO_SE;
129
-        case "AT":
130
-            return KlarnaEncoding::PNO_AT;
131
-        default:
132
-            return -1;
117
+            case "DE":
118
+                return KlarnaEncoding::PNO_DE;
119
+            case "DK":
120
+                return KlarnaEncoding::PNO_DK;
121
+            case "FI":
122
+                return KlarnaEncoding::PNO_FI;
123
+            case "NL":
124
+                return KlarnaEncoding::PNO_NL;
125
+            case "NO":
126
+                return KlarnaEncoding::PNO_NO;
127
+            case "SE":
128
+                return KlarnaEncoding::PNO_SE;
129
+            case "AT":
130
+                return KlarnaEncoding::PNO_AT;
131
+            default:
132
+                return -1;
133 133
         }
134 134
     }
135 135
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
     public static function getRegexp($enc)
145 145
     {
146 146
         switch($enc) {
147
-        case self::PNO_SE:
148
-            /*
147
+            case self::PNO_SE:
148
+                /*
149 149
              * All positions except C contain numbers 0-9.
150 150
              *
151 151
              * PNO:
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
              * 16XXXXXX-NNNN
162 162
              *
163 163
              */
164
-            return '/^[0-9]{6,6}(([0-9]{2,2}[-\+]{1,1}[0-9]{4,4})|([-\+]'.
165
-                '{1,1}[0-9]{4,4})|([0-9]{4,6}))$/';
166
-        case self::PNO_NO:
167
-            /*
164
+                return '/^[0-9]{6,6}(([0-9]{2,2}[-\+]{1,1}[0-9]{4,4})|([-\+]'.
165
+                    '{1,1}[0-9]{4,4})|([0-9]{4,6}))$/';
166
+            case self::PNO_NO:
167
+                /*
168 168
              * All positions contain numbers 0-9.
169 169
              *
170 170
              * Pno
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
              *
179 179
              * NNNNNNNNK      (orgno)                         length = 9
180 180
              */
181
-            return '/^[0-9]{6,6}((-[0-9]{5,5})|([0-9]{2,2}((-[0-9]'.
182
-                '{5,5})|([0-9]{1,1})|([0-9]{3,3})|([0-9]{5,5))))$/';
183
-        case self::PNO_FI:
184
-            /*
181
+                return '/^[0-9]{6,6}((-[0-9]{5,5})|([0-9]{2,2}((-[0-9]'.
182
+                    '{5,5})|([0-9]{1,1})|([0-9]{3,3})|([0-9]{5,5))))$/';
183
+            case self::PNO_FI:
184
+                /*
185 185
              * Pno
186 186
              * DDMMYYCIIIT
187 187
              * DDMMYYIIIT
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
              * NNNNNNNT
195 195
              * T = 0-9, A-F, H, J, K-N, P, R-Y
196 196
              */
197
-            return '/^[0-9]{6,6}(([A\+-]{1,1}[0-9]{3,3}[0-9A-FHJK-NPR-Y]'.
198
-                '{1,1})|([0-9]{3,3}[0-9A-FHJK-NPR-Y]{1,1})|([0-9]{1,1}-{0,1}'.
199
-                '[0-9A-FHJK-NPR-Y]{1,1}))$/i';
200
-        case self::PNO_DK:
201
-            /*
197
+                return '/^[0-9]{6,6}(([A\+-]{1,1}[0-9]{3,3}[0-9A-FHJK-NPR-Y]'.
198
+                    '{1,1})|([0-9]{3,3}[0-9A-FHJK-NPR-Y]{1,1})|([0-9]{1,1}-{0,1}'.
199
+                    '[0-9A-FHJK-NPR-Y]{1,1}))$/i';
200
+            case self::PNO_DK:
201
+                /*
202 202
              * Pno
203 203
              * DDMMYYNNNG       length 10
204 204
              * G = gender, odd/even for men/women.
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
              * Orgno
207 207
              * XXXXXXXX         length 8
208 208
              */
209
-            return '/^[0-9]{8,8}([0-9]{2,2})?$/';
210
-        case self::PNO_NL:
211
-        case self::PNO_DE:
212
-            /**
209
+                return '/^[0-9]{8,8}([0-9]{2,2})?$/';
210
+            case self::PNO_NL:
211
+            case self::PNO_DE:
212
+                /**
213 213
              * Pno
214 214
              * DDMMYYYYG         length 9
215 215
              * DDMMYYYY                 8
@@ -217,21 +217,21 @@  discard block
 block discarded – undo
217 217
              * Orgno
218 218
              * XXXXXXX                  7  company org nr
219 219
              */
220
-            return '/^[0-9]{7,9}$/';
221
-        case self::EMAIL:
222
-            /**
220
+                return '/^[0-9]{7,9}$/';
221
+            case self::EMAIL:
222
+                /**
223 223
              * Validates an email.
224 224
              */
225
-            return '/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]'.
226
-                '+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z0-9-][a-zA-Z0-9-]+)+$/';
227
-        case self::CELLNO:
228
-            /**
225
+                return '/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]'.
226
+                    '+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z0-9-][a-zA-Z0-9-]+)+$/';
227
+            case self::CELLNO:
228
+                /**
229 229
              * Validates a cellno.
230 230
              * @TODO Is this encoding only for Sweden?
231 231
              */
232
-            return '/^07[\ \-0-9]{8,13}$/';
233
-        default:
234
-            throw new Klarna_UnknownEncodingException($enc);
232
+                return '/^07[\ \-0-9]{8,13}$/';
233
+            default:
234
+                throw new Klarna_UnknownEncodingException($enc);
235 235
         }
236 236
     }
237 237
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
      */
144 144
     public static function getRegexp($enc)
145 145
     {
146
-        switch($enc) {
146
+        switch ($enc) {
147 147
         case self::PNO_SE:
148 148
             /*
149 149
              * All positions except C contain numbers 0-9.
Please login to merge, or discard this patch.