added a swift/bic validation method.
This commit is contained in:
parent
a7ba2df17a
commit
430efe8978
11
Validate.php
11
Validate.php
|
@ -147,4 +147,15 @@ class Validate
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A static method to validate SWIFT/BIC codes.
|
||||||
|
* @param string $swift swift/bic code
|
||||||
|
* @return bool swift/bic valid?
|
||||||
|
*/
|
||||||
|
static function swift(string $swift) : bool
|
||||||
|
{
|
||||||
|
$swift = trim($swift); // sanitize swift/bic
|
||||||
|
return mb_ereg_match("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue