SepaCntryValidationFR   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

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 french IBAN and CI
6
 *
7
 * #### Valid testvalues
8
 * <table><tbody>
9
 * <tr><td>   IBAN   </td><td> FR14 2004 1010 0505 0001 3M02 606 </td></tr>
10
 * <tr><td>   BIC    </td><td> PARBFRPP757 </td></tr>
11
 * <tr><td>   CI     </td><td> FR72 ZZZ 123456 </td></tr>
12
 * </tbody></table>
13
 *
14
 * #### IBAN format
15
 * #### ` CCpp bbbb bsss sskk kkkk kkkk kPP `
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> 5 digits numeric banking code </td></tr>
20
 * <tr><td>   s      </td><td> 5 digits numeric branch code </td></tr>
21
 * <tr><td>   k      </td><td> 11 digits alphanumeric account number </td></tr>
22
 * <tr><td>   PP     </td><td> 2 digits numeric national check code </td></tr>
23
 * </tbody></table>
24
 *
25
 * Length: 27
26
 *
27
 * #### CI format
28
 *  The SEPA Identifier for creditors located in France is called
29
 *  'Identifiant Créancier SEPA' or 'ICS'. The Creditor Identifier
30
 *  (CI) has a total length of 13 characters. The country specific
31
 *  part of CI consists of 6 alphanumeric characters, based on
32
 *  hexadecimal classification.
33
 *
34
 * #### ` CCpp ZZZ xxxxxx `
35
 * <table><tbody>
36
 * <tr><td>   C      </td><td> ISO Country Code </td></tr>
37
 * <tr><td>   p      </td><td> 2 digits IBAN checksum </td></tr>
38
 * <tr><td>   Z      </td><td> 3 digits alphanum creditor business code (CBC) </td></tr>
39
 * <tr><td>   x      </td><td> 6 digits hexadecimal national identification code </td></tr>
40
 * </tbody></table>
41
 *
42
 * Length: 13
43
 *
44
 * <b>All validation can be done with specification of length and regex to match format! </b>
45
 *
46
 * @package Sepa
47
 * @author Stefanius <[email protected]>
48
 * @copyright MIT License - see the LICENSE file for details
49
 */
50
class SepaCntryValidationFR extends SepaCntryValidationBase
51
{
52
    /**
53
     * Create instance of french validation.
54
     * @param string $strCntry  2 sign country code
55
     */
56
    public function __construct(string $strCntry)
57
    {
58
        $this->strCntry = 'FR';
59
        $this->iLenIBAN = 27;
60
        $this->strRegExIBAN = '/^([A-Z]){2}([0-9]){12}([0-9A-Z]){11}([0-9]){2}?$/';
61
        $this->bAlphaNumIBAN = true;
62
        $this->iLenCI = 13;
63
        $this->strRegExCI = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){3}([0-9A-F]){6}?$/';
64
        $this->bAlphaNumCI = true;
65
66
        parent::__construct(strtoupper($strCntry));
67
    }
68
}