src/Biblys/Isbn/Isbn.php
private function removeProductCode($code)
    {
        $first3 = substr($code, 0, 3);

        // For ISBN-10, product code is always 978
        if (strlen($code) == 9) {
            $this->setProduct(978);
        }

        // ISBN-13: check that product code is 978 or 979
        elseif ($first3 == 978 || $first3 == 979) {
            $this->setProduct($first3);
            $code = substr($code, 3);
        }

        // Product code is Invalid
        else {
            $this->setValid(false);
            $this->addError(self::ERROR_INVALID_PRODUCT_CODE);
        }

        return $code;
    }
private function removeProductCode($code)
    {
        $first3 = substr($code, 0, 3);

        // For ISBN-10, product code is always 978
        if (strlen($code) == 9) {
            $this->setProduct(978);
        }

        // ISBN-13: check that product code is 978 or 979
        elseif ($first3 == 978 || $first3 == 979) {
            $this->setProduct($first3);
            $code = substr($code, 3);
        }

        // Product code is Invalid
        else {
            $this->setValid(false);
            $this->addError(self::ERROR_INVALID_PRODUCT_CODE);
        }

        return $code;
    }
private function removeProductCode ( $ code ) { $ first3 = substr ( $ code , 0 , 3 ) ; // For ISBN-10, product code is always 978 if ( strlen ( $ code ) == 9 ) { $ this -> setProduct ( 978 ) ; } // ISBN-13: check that product code is 978 or 979 elseif ( $ first3 == 978 || $ first3 == 979 ) { $ this -> setProduct ( $ first3 ) ; $ code = substr ( $ code , 3 ) ; } // Product code is Invalid else { $ this -> setValid ( false ) ; $ this -> addError ( self :: ERROR_INVALID_PRODUCT_CODE ) ; } return $ code ; }
Remove first three characters if 978 or 979 and save Product Code
Remove first three characters if 978 or 979 and save Product Code