/** * Check chars allowed. */ protected function checkCharsAllowed() { $c = strlen($this->text); // Special case, if we have 10 digits, the last one can be X if ($c === 10) { if (array_search($this->text[9], $this->keys) === false && $this->text[9] !== 'X') { throw new BCGParseException('isbn', 'The character \'' . $this->text[9] . '\' is not allowed.'); } // Drop the last char $this->text = substr($this->text, 0, 9); } return parent::checkCharsAllowed(); }