private function detectFormat()
    {
        if (preg_match('/^[[:alpha:]]{2}$/', $this->value)) {
            $this->format = 'alpha2';
        } elseif (preg_match('/^[[:alpha:]]{3}$/', $this->value)) {
            $this->format = 'alpha3';
        } elseif (preg_match('/^[[:digit:]]{3}$/', $this->value)) {
            $this->format = 'numeric';
        } else {
            throw new Exception("The country code is not formatted correctly {$this->value}");
        }
    }