public function setIdentityVersion($version = null)
{
$this->identityVersion = $version ?: 2;
switch ($this->identityVersion) {
case 2:
$this->authRequestBuilder = new RequestBuilderV2();
break;
case 3:
$this->authRequestBuilder = new RequestBuilderV3();
break;
default:
throw new NotSupportedException("Unsupported api version: {$this->identityVersion}");
}
return $this;
}