Lines 100.00% 5 / 5
Methods 100.00% 1 / 1
Classes 100.00% 1 / 1
Covered by tests of size
Name Lines Methods CRAP
 getInstance 100.00% 5 / 5 100.00% 1 / 1 2
24class Captcha
25{
26    private static ?CaptchaInterface $captcha = null;
27
28    private static Configuration $configuration;
29
30    public static function getInstance(Configuration $configuration): BuiltinCaptcha|GoogleRecaptcha
31    {
32        self::$configuration = $configuration;
33        self::$captcha = new BuiltinCaptcha(self::$configuration);
34
35        if (self::$configuration->get('security.enableGoogleReCaptchaV2')) {
36            self::$captcha = new GoogleRecaptcha(self::$configuration);
37        }
38
39        return self::$captcha;
40    }
41}