SepaCntryValidationGB::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 11
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 great britain IBAN and CI
6
 *
7
 * #### Valid testvalues
8
 * <table><tbody>
9
 * <tr><td>   IBAN   </td><td> GB29 NWBK 6016 1331 9268 19 </td></tr>
10
 * <tr><td>   BIC    </td><td> BKENGB54XXX </td></tr>
11
 * <tr><td>   CI     </td><td> GB26 ZZZ SDD BKEN 000000012345678901234 </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> 4 digits alpha banking code </td></tr>
20
 * <tr><td>   s      </td><td> 6 digits numeric branch code </td></tr>
21
 * <tr><td>   k      </td><td> 8 digits numeric account number </td></tr>
22
 * </tbody></table>
23
 *
24
 * Length: 22
25
 *
26
 * #### CI format
27
 *  The UK has chosen to develop a Creditor Identifier specifically for
28
 *  the SDD Schemes, based on the format set out in the SDD Scheme Rulebooks
29
 *  and Implementation Guides. Called the UK SEPA CI it is structured as follows:
30
 *
31
 * #### ` CCpp ZZZ sssbbbbuuuuuuccccccccccccccc `
32
 * <table><tbody>
33
 * <tr><td>   C      </td><td> ISO Country Code </td></tr>
34
 * <tr><td>   p      </td><td> 2 digits IBAN checksum </td></tr>
35
 * <tr><td>   Z      </td><td> digits alphanum creditor business code (CBC) </td></tr>
36
 * <tr><td>   s      </td><td> 3 digits alpha scheme code i.e. SDD </td></tr>
37
 * <tr><td>   b      </td><td> 4 digits alpha participant code i.e. the first four characters of the issuing Creditor Bank’s BIC </td></tr>
38
 * <tr><td>   u      </td><td> 6 digits numeric bacs service user number (SUN) if one exists or six zeros in the absence of a bacs SUN </td></tr>
39
 * <tr><td>   c      </td><td> 15 digits alphanum determined by the issuing Creditor Bank </td></tr>
40
 * </tbody></table>
41
 *
42
 * Length: 35
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 SepaCntryValidationGB extends SepaCntryValidationBase
51
{
52
    /**
53
     * Create instance of validation for great britain.
54
     * @param string $strCntry  2 sign country code
55
     */
56
    public function __construct(string $strCntry)
57
    {
58
        $this->strCntry = 'GB';
59
        $this->iLenIBAN = 22;
60
        $this->strRegExIBAN = '/^([A-Z]){2}([0-9]){2}([A-Z]){4}([0-9]){14}?$/';
61
        $this->bAlphaNumIBAN = true;
62
        $this->iLenCI = 35;
63
        $this->strRegExCI = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){3}([A-Z]){7}([0-9]){6}([0-9A-Z]){15}?$/';
64
        $this->bAlphaNumCI = true;
65
66
        parent::__construct(strtoupper($strCntry));
67
    }
68
}