SepaCntryValidationLU::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
namespace SKien\Sepa\CntryValidation;
3
4
/**
5
 * Validation class for luxembourgian IBAN and CI.
6
 *
7
 * #### Valid testvalues
8
 * <table><tbody>
9
 * <tr><td>   IBAN   </td><td> LU28 0019 4006 4475 0000 </td></tr>
10
 * <tr><td>   BIC    </td><td> BSUILULLREG </td></tr>
11
 * <tr><td>   CI     </td><td> ??? </td></tr>
12
 * </tbody></table>
13
 *
14
 * #### IBAN format
15
 * #### ` CCpp bbbk kkkk kkkk kkkk k `
16
 * <table><tbody>
17
 * <tr><td>   CC     </td><td> ISO Country Code </td></tr>
18
 * <tr><td>   pp     </td><td> 3 digits IBAN checksum </td></tr>
19
 * <tr><td>   b      </td><td> 3 digits banking code </td></tr>
20
 * <tr><td>   k      </td><td> 13 digits account number </td></tr>
21
 * </tbody></table>
22
 *
23
 * Length: 20
24
 *
25
 * #### CI format
26
 * #### `CCpp ZZZ 0nnnnnnnnnnnnnnnnnn `
27
 * <table><tbody>
28
 * <tr><td>   C      </td><td> ISO Country Code </td></tr>
29
 * <tr><td>   p      </td><td> 2 digits IBAN checksum </td></tr>
30
 * <tr><td>   Z      </td><td> 3 digits alphanum creditor business code </td></tr>
31
 * <tr><td>   0      </td><td> 1 digit fixed value 0 </td></tr>
32
 * <tr><td>   n      </td><td> 18 digits alphanumeric national identification code </td></tr>
33
 * </tbody></table>
34
 *
35
 * Length: 26
36
 *
37
 * <b>All validation can be done with specification of length and regex to match format! </b>
38
 *
39
 * @package Sepa
40
 * @author Stefanius <[email protected]>
41
 * @copyright MIT License - see the LICENSE file for details
42
 */
43
class SepaCntryValidationLU extends SepaCntryValidationBase
44
{
45
    /**
46
     * Create instance of luxembourgian validation.
47
     * @param string $strCntry  2 sign country code
48
     */
49
    public function __construct(string $strCntry)
50
    {
51
        $this->strCntry = 'LU';
52
        $this->iLenIBAN = 20;
53
        $this->strRegExIBAN = '/^([A-Z]){2}([0-9]){18}?$/';
54
        $this->iLenCI = 26;
55
        $this->strRegExCI = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){3}0([0-9A-Z]){18}?$/';
56
        $this->bAlphaNumCI = true;
57
58
        parent::__construct(strtoupper($strCntry));
59
    }
60
}