added a swift/bic validation method.

This commit is contained in:
Marcel Naeve 2016-05-13 15:44:27 +02:00
parent a7ba2df17a
commit 430efe8978
1 changed files with 11 additions and 0 deletions

View File

@ -147,4 +147,15 @@ class Validate
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);
}
}