OXID eShop CE  4.9.11
 All Classes Files Functions Variables Pages
oxsepavalidator.php
Go to the documentation of this file.
1 <?php
2 
8 {
9 
13  protected $_aIBANCodeLengths = array(
14  'AL' => 28,
15  'AD' => 24,
16  'AT' => 20,
17  'AZ' => 28,
18  'BH' => 22,
19  'BE' => 16,
20  'BA' => 20,
21  'BR' => 29,
22  'BG' => 22,
23  'CR' => 21,
24  'HR' => 21,
25  'CY' => 28,
26  'CZ' => 24,
27  'DK' => 18, // Same DENMARK
28  'FO' => 18, // Same DENMARK
29  'GL' => 18, // Same DENMARK
30  'DO' => 28,
31  'EE' => 20,
32  'FI' => 18,
33  'FR' => 27,
34  'GE' => 22,
35  'DE' => 22,
36  'GI' => 23,
37  'GR' => 27,
38  'GT' => 28,
39  'HU' => 28,
40  'IS' => 26,
41  'IE' => 22,
42  'IL' => 23,
43  'IT' => 27,
44  'KZ' => 20,
45  'KW' => 30,
46  'LV' => 21,
47  'LB' => 28,
48  'LI' => 21,
49  'LT' => 20,
50  'LU' => 20,
51  'MK' => 19,
52  'MT' => 31,
53  'MR' => 27,
54  'MU' => 30,
55  'MD' => 24,
56  'MC' => 27,
57  'ME' => 22,
58  'NL' => 18,
59  'NO' => 15,
60  'PK' => 24,
61  'PS' => 29,
62  'PL' => 28,
63  'PT' => 25,
64  'RO' => 24,
65  'SM' => 27,
66  'SA' => 24,
67  'RS' => 22,
68  'SK' => 24,
69  'SI' => 19,
70  'ES' => 24,
71  'SE' => 24,
72  'CH' => 21,
73  'TN' => 24,
74  'TR' => 26,
75  'AE' => 23,
76  'GB' => 22,
77  'VG' => 24
78  );
79 
87  public function isValidBIC($sBIC)
88  {
89  $oBICValidator = oxNew('oxSepaBICValidator');
90 
91  return $oBICValidator->isValid($sBIC);
92  }
93 
101  public function isValidIBAN($sIBAN)
102  {
103  $oIBANValidator = oxNew('oxSepaIBANValidator');
104  $oIBANValidator->setCodeLengths($this->getIBANCodeLengths());
105 
106  return $oIBANValidator->isValid($sIBAN);
107  }
108 
118  public function isValidIBANRegistry($aIBANRegistry = null)
119  {
120  $oIBANValidator = oxNew('oxSepaIBANValidator');
121 
122  if (is_null($aIBANRegistry)) {
123  $aIBANRegistry = $this->getIBANCodeLengths();
124  }
125 
126  return $oIBANValidator->isCodeLengthsValid($aIBANRegistry);
127  }
128 
129 
139  public function setIBANRegistry($aIBANRegistry)
140  {
141  if ($this->isValidIBANRegistry($aIBANRegistry)) {
142  $this->_aIBANCodeLengths = $aIBANRegistry;
143 
144  return true;
145  } else {
146  return false;
147  }
148  }
149 
157  public function getIBANRegistry()
158  {
160  }
161 
167  public function getIBANCodeLengths()
168  {
170  }
171 }