Skip to content

Commit

Permalink
Use other iban library
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtlambda committed Mar 8, 2016
1 parent a7886fd commit a38d9c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"require": {
"php": ">=5.4",
"egulias/email-validator": "~1.2",
"jschaedl/iban": "~1.1",
"rmccue/requests": "~1.6"
"rmccue/requests": "~1.6",
"globalcitizen/php-iban": "^2.5"
},
"require-dev": {
"phpunit/phpunit": "4.5.*",
Expand Down
5 changes: 1 addition & 4 deletions src/fieldwork/validators/IbanFieldValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@ class IbanFieldValidator extends RegexFieldValidator
const PATT_BBAN = "/^([A-Z]{2}[0-9]{2} [A-Z0-9]{4} [0-9]{4} [0-9]{4}( [0-9]{4})?( [0-9]{2})?|[0-9]{1,10})$/";
const ERROR = "Not a valid IBAN";

private $validator;

public function __construct ($convertBban = false, $errorMsg = self::ERROR)
{
parent::__construct(
self::PATT, $errorMsg, $convertBban ? self::PATT_BBAN : self::PATT
);
$this->validator = new IBANValidator();
}

public function isValid ($value)
{
$sanitized = preg_replace('/\s/', '', $value);
return $this->validator->validate($sanitized);
return verify_iban($sanitized, true);
}
}

0 comments on commit a38d9c1

Please sign in to comment.