public function setVersion($version)
    {
        if ($version == self::VERSION_3 || $version == self::VERSION_3_1_1) {
            $this->version = $version;
        } else {
            throw new Exception('Invalid version');
        }
    }