src/Biblys/Isbn/Isbn.php
public function format($format = 'EAN')
    {
        if (!$this->isValid()) {
            throw new \Exception('Cannot format invalid ISBN: '.$this->getErrors());
        }

        $this->calculateChecksum($format);

        $A = $this->getProduct();
        $B = $this->getCountry();
        $C = $this->getPublisher();
        $D = $this->getPublication();
        $E = $this->getChecksum();

        if ($format == 'ISBN-10') {
            return $B.'-'.$C.'-'.$D.'-'.$E;
        } elseif ($format == 'ISBN-13' || $format == 'ISBN') {
            return $A.'-'.$B.'-'.$C.'-'.$D.'-'.$E;
        } else {
            return $A.$B.$C.$D.$E;
        }
    }
public function format($format = 'EAN')
    {
        if (!$this->isValid()) {
            throw new \Exception('Cannot format invalid ISBN: '.$this->getErrors());
        }

        $this->calculateChecksum($format);

        $A = $this->getProduct();
        $B = $this->getCountry();
        $C = $this->getPublisher();
        $D = $this->getPublication();
        $E = $this->getChecksum();

        if ($format == 'ISBN-10') {
            return $B.'-'.$C.'-'.$D.'-'.$E;
        } elseif ($format == 'ISBN-13' || $format == 'ISBN') {
            return $A.'-'.$B.'-'.$C.'-'.$D.'-'.$E;
        } else {
            return $A.$B.$C.$D.$E;
        }
    }
public function format ( $ format = 'EAN' ) { if ( ! $ this -> isValid ( ) ) { throw new \ Exception ( 'Cannot format invalid ISBN: ' . $ this -> getErrors ( ) ) ; } $ this -> calculateChecksum ( $ format ) ; $ A = $ this -> getProduct ( ) ; $ B = $ this -> getCountry ( ) ; $ C = $ this -> getPublisher ( ) ; $ D = $ this -> getPublication ( ) ; $ E = $ this -> getChecksum ( ) ; if ( $ format == 'ISBN-10' ) { return $ B . '-' . $ C . '-' . $ D . '-' . $ E ; } elseif ( $ format == 'ISBN-13' || $ format == 'ISBN' ) { return $ A . '-' . $ B . '-' . $ C . '-' . $ D . '-' . $ E ; } else { return $ A . $ B . $ C . $ D . $ E ; } }
Format an ISBN according to specified format
@param string $format (ISBN-10, ISBN-13, EAN)
Format an ISBN according to specified format