SepaCntryValidationIT   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 9
dl 0
loc 17
rs 10
c 1
b 0
f 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
1
<?php
2
namespace SKien\Sepa\CntryValidation;
3
4
/**
5
 * Validation class for italian IBAN and CI.
6
 *
7
 * #### Valid testvalues
8
 * <table><tbody>
9
 * <tr><td>   IBAN   </td><td> IT60 X054 2811 1010 0000 0123 456 </td></tr>
10
 * <tr><td>   BIC    </td><td> ??? </td></tr>
11
 * <tr><td>   CI     </td><td> ??? </td></tr>
12
 * </tbody></table>
13
 *
14
 * #### IBAN format
15
 * #### ` CCpp Kbbb bbss sssk kkkk kkkk kkk `
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>   K      </td><td> 1 digit code for the country code </td></tr>
20
 * <tr><td>   b      </td><td> 5 characters from the bank's SWIFT / BIC </td></tr>
21
 * <tr><td>   s      </td><td> 5-digit code for the branch of the bank </td></tr>
22
 * <tr><td>   k      </td><td> 12-digit code for the account number </td></tr>
23
 * </tbody></table>
24
 *
25
 * Length: 27
26
 *
27
 * #### CI format
28
 * #### ` CCpp ZZZ nnnnnnnnnnnnnnnn `
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>   n      </td><td> 16 digits alphanumeric national identification code </td></tr>
34
 * </tbody></table>
35
 *
36
 * Length: 23
37
 *
38
 * <b> All validation can be done with specification of length and regex to match format! </b>
39
 *
40
 * @package Sepa
41
 * @author Stefanius <[email protected]>
42
 * @copyright MIT License - see the LICENSE file for details
43
 */
44
class SepaCntryValidationIT extends SepaCntryValidationBase
45
{
46
    /**
47
     * Create instance of italian validation.
48
     * @param string $strCntry  2 sign country code
49
     */
50
    public function __construct(string $strCntry)
51
    {
52
        $this->strCntry = 'IT';
53
        $this->iLenIBAN = 27;
54
        $this->strRegExIBAN = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){6}([0-9]){17}?$/';
55
        $this->bAlphaNumIBAN = true;
56
        $this->iLenCI = 23;
57
        $this->strRegExCI = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){19}?$/';
58
        $this->bAlphaNumCI = true;
59
60
        parent::__construct(strtoupper($strCntry));
61
    }
62
}