private function validateIsbn10(): bool
    {
        $value = \str_replace(['-', ' '], '', $this->value);
        if (!\preg_match($this->patterns['isbn10-basic'], $value)) {
            $this->setError(self::VALIDATOR_ERROR_ISBN_INCORRECT_FORMAT);
            return false;
        }

        $sum = 0;
        for ($i = 0; $i < 9; $i++) {
            $sum += (10 - $i) * $value{$i};
        }

        $checksum = 11 - ($sum % 11);
        if ($checksum == 11) {
            $checksum = '0';
        } elseif ($checksum == 10) {
            $checksum = 'X';
        }
        $isValid = \substr($value, -1) == $checksum ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_ISBN_INVALID_NUMBER);
        }
        return $isValid;
    }
private function validateIsbn10(): bool
    {
        $value = \str_replace(['-', ' '], '', $this->value);
        if (!\preg_match($this->patterns['isbn10-basic'], $value)) {
            $this->setError(self::VALIDATOR_ERROR_ISBN_INCORRECT_FORMAT);
            return false;
        }

        $sum = 0;
        for ($i = 0; $i < 9; $i++) {
            $sum += (10 - $i) * $value{$i};
        }

        $checksum = 11 - ($sum % 11);
        if ($checksum == 11) {
            $checksum = '0';
        } elseif ($checksum == 10) {
            $checksum = 'X';
        }
        $isValid = \substr($value, -1) == $checksum ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_ISBN_INVALID_NUMBER);
        }
        return $isValid;
    }
private function validateIsbn10 ( ) : bool { $ value = \ str_replace ( [ '-' , ' ' ] , '' , $ this -> value ) ; if ( ! \ preg_match ( $ this -> patterns [ 'isbn10-basic' ] , $ value ) ) { $ this -> setError ( self :: VALIDATOR_ERROR_ISBN_INCORRECT_FORMAT ) ; return false ; } $ sum = 0 ; for ( $ i = 0 ; $ i < 9 ; $ i ++ ) { $ sum += ( 10 - $ i ) * $ value { $ i } ; } $ checksum = 11 - ( $ sum % 11 ) ; if ( $ checksum == 11 ) { $ checksum = '0' ; } elseif ( $ checksum == 10 ) { $ checksum = 'X' ; } $ isValid = \ substr ( $ value , - 1 ) == $ checksum ? true : false ; if ( ! $ isValid ) { $ this -> setError ( self :: VALIDATOR_ERROR_ISBN_INVALID_NUMBER ) ; } return $ isValid ; }
Validates ISBN-10 number

@return bool
Validates ISBN - 10 number