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;
        }
    }