CodeExplorer _detectFormat example
public function isValid($value) { if (!
is_string($value) && !
is_int($value)) { $this->
_error(self::INVALID
);
return false;
} $value =
(string) $value;
$this->
_setValue($value);
switch ($this->
_detectFormat()) { case self::ISBN10:
// sum
$isbn10 =
str_replace($this->_separator, '',
$value);
$sum = 0;
for ($i = 0;
$i < 9;
$i++
) { $sum += (10 -
$i) *
$isbn10{$i};
} // checksum
$checksum = 11 -
($sum % 11
);
if ($checksum == 11
) {