SepaCntryValidationEE   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 8
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
1
<?php
2
namespace SKien\Sepa\CntryValidation;
3
4
/**
5
 * Validation class for estonian IBAN and CI
6
 *
7
 * #### Valid testvalues
8
 * <table><tbody>
9
 * <tr><td>   IBAN   </td><td> EE38 2200 2210 2014 5685 </td></tr>
10
 * <tr><td>   BIC    </td><td> RIKOEE22CBC </td></tr>
11
 * <tr><td>   CI     </td><td> EE43 ZZZ EE 00012345678 </td></tr>
12
 * </tbody></table>
13
 *
14
 * #### IBAN format
15
 * #### ` CCpp bbss kkkk kkkk kkkP `
16
 * <table><tbody>
17
 * <tr><td>   CC     </td><td> ISO Country Code </td></tr>
18
 * <tr><td>   pp     </td><td> 2 digits IBAN checksum </td></tr>
19
 * <tr><td>   b      </td><td> 2 digits numeric banking code </td></tr>
20
 * <tr><td>   a      </td><td> 2 digits numeric length </td></tr>
21
 * <tr><td>   k      </td><td> 11 digits numeric account number </td></tr>
22
 * <tr><td>   P      </td><td> 1 digit numeric internal check sum </td></tr>
23
 * </tbody></table>
24
 *
25
 * Length: 20
26
 *
27
 * #### CI format
28
 * #### ` CCpp ZZZ cc nnnnnnnnnnn `
29
 * <table><tbody>
30
 * <tr><td>   C      </td><td> ISO Country Code </td></tr>
31
 * <tr><td>   p      </td><td> 2 digits IBAN checksum </td></tr>
32
 * <tr><td>   Z      </td><td> 3 digits alphanum creditor business code </td></tr>
33
 * <tr><td>   c      </td><td> 2 digits ISO country code of the following registry or ID code’s issuer </td></tr>
34
 * <tr><td>   n      </td><td> 11 digits numeric national identification code </td></tr>
35
 * </tbody></table>
36
 *
37
 * Length: 20
38
 *
39
 * <b>All validation can be done with specification of length and regex to match format! </b>
40
 *
41
 * @package Sepa
42
 * @author Stefanius <[email protected]>
43
 * @copyright MIT License - see the LICENSE file for details
44
 */
45
class SepaCntryValidationEE extends SepaCntryValidationBase
46
{
47
    /**
48
     * Create instance of estonian validation.
49
     * @param string $strCntry  2 sign country code
50
     */
51
    public function __construct(string $strCntry)
52
    {
53
        $this->strCntry = 'EE';
54
        $this->iLenIBAN = 20;
55
        $this->strRegExIBAN = '/^([A-Z]){2}([0-9]){18}?$/';
56
        $this->iLenCI = 20;
57
        $this->strRegExCI = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){3}([A-Z]){2}([0-9]){11}?$/';
58
        $this->bAlphaNumCI = true;
59
60
        parent::__construct(strtoupper($strCntry));
61
    }
62
}