OTPHP\Factory::createOTP PHP Method

createOTP() private static method

private static createOTP ( array $parsed_url ) : OTPHP\HOTPInterface | OTPHP\TOTPInterface
$parsed_url array
return OTPHP\HOTPInterface | OTPHP\TOTPInterface
    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']));
        }
    }