private static function createOTP(array $parsed_url)
{
switch ($parsed_url['host']) {
case 'totp':
return new TOTP(self::getLabel($parsed_url['path']), $parsed_url['query']['secret']);
case 'hotp':
return new HOTP(self::getLabel($parsed_url['path']), $parsed_url['query']['secret']);
default:
throw new \InvalidArgumentException(sprintf('Unsupported "%s" OTP type', $parsed_url['host']));
}
}