<commit_before><?php

namespace fieldwork\validators;

use IBAN\Validation\IBANValidator;

class IbanFieldValidator extends RegexFieldValidator
{

    const PATT       = "/^[A-Z]{2}[0-9]{2} [A-Z0-9]{4} [0-9]{4} [0-9]{4}( [0-9]{4})?( [0-9]{2})?$/";
    const PATT_LOCAL = "/^([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 ()
    {
        parent::__construct(
            self::PATT, self::ERROR, self::PATT_LOCAL
        );
        $this->validator = new IBANValidator();
    }

    public function isValid ($value)
    {
        return $this->validator->validate($value);
    }

}<commit_msg>Fixed the IbanFieldValidator when the openIban service is not connected<commit_after><?php

namespace fieldwork\validators;

use IBAN\Validation\IBANValidator;

class IbanFieldValidator extends RegexFieldValidator
{

    const PATT       = "/^[A-Z]{2}[0-9]{2} [A-Z0-9]{4} [0-9]{4} [0-9]{4}( [0-9]{4})?( [0-9]{2})?$/";
    const PATT_LOCAL = "/^([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 ()
    {
        parent::__construct(
            self::PATT, self::ERROR, self::PATT_LOCAL
        );
        $this->validator = new IBANValidator();
    }

    public function isValid ($value)
    {
        $sanitized = preg_replace('/\s/', '', $value);
        return $this->validator->validate($sanitized);
    }
}
{'fraction_non_alphanumeric': 0.2172544080604534, 'fraction_numerical': 0.05415617128463476, 'mean_word_length': 2.9234567901234567, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6712303', 'n_tokens_mistral': 621, 'n_tokens_neox': 611, 'n_words': 110}