SepaCntryValidationES   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

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 spain IBAN and CI
6
 *
7
 * #### Valid testvalues
8
 * <table><tbody>
9
 * <tr><td>   IBAN   </td><td> ES91 2100 0418 4502 0005 1332 </td></tr>
10
 * <tr><td>   BIC    </td><td> NORTESMMXXX </td></tr>
11
 * <tr><td>   CI     </td><td> ES50 ZZZ M23456789 </td></tr>
12
 * </tbody></table>
13
 *
14
 * #### IBAN format
15
 * #### ` CCpp bbbb ssss KKkk kkkk kkkk `
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> bank identifier 4 digits </td></tr>
20
 * <tr><td>   s      </td><td> branch identifier 4 digits </td></tr>
21
 * <tr><td>   k      </td><td> control code 2 digits </td></tr>
22
 * <tr><td>   k      </td><td> account number 10 digits </td></tr>
23
 * </tbody></table>
24
 *
25
 * Length: 24
26
 *
27
 * #### CI format
28
 * #### ` CCpp ZZZ l nnnnnnn c
29
 * <table><tbody>
30
 * <tr><td>   C      </td><td> ISO Country Code </td></tr>
31
 * <tr><td>   p      </td><td> 2 digits CI checksum </td></tr>
32
 * <tr><td>   Z      </td><td> 3 digits creditor business code </td></tr>
33
 * <tr><td>   l      </td><td> a letter indicating the legal entity </td></tr>
34
 * <tr><td>   n      </td><td> 7 digits – indicating province / legal entity </td></tr>
35
 * <tr><td>   c      </td><td> a letter/digit check code </td></tr>
36
 * </tbody></table>
37
 *
38
 * Length: 16
39
 *
40
 * <b>All validation can be done with specification of length and regex to match format! </b>
41
 *
42
 * @package Sepa
43
 * @author Stefanius <[email protected]>
44
 * @copyright MIT License - see the LICENSE file for details
45
 */
46
class SepaCntryValidationES extends SepaCntryValidationBase
47
{
48
    /**
49
     * Create instance of german validation.
50
     * @param string $strCntry  2 sign country code
51
     */
52
    public function __construct(string $strCntry)
53
    {
54
        $this->strCntry = 'ES';
55
        $this->iLenIBAN = 24;
56
        $this->strRegExIBAN = '/^([A-Z]){2}([0-9]){22}?$/';
57
        $this->iLenCI = 16;
58
        $this->bAlphaNumCI = true;
59
        $this->strRegExCI = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){4}([0-9]){7}([0-9A-Z]){1}?$/';
60
61
        parent::__construct(strtoupper($strCntry));
62
    }
63
}