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 CaptchaHelper
25{
26    private static ?CaptchaHelperInterface $captchaHelper = null;
27
28    private static Configuration $configuration;
29
30    public static function getInstance(Configuration $configuration): CaptchaHelperInterface
31    {
32        self::$configuration = $configuration;
33        self::$captchaHelper = new BuiltinCaptchaAbstractHelper(self::$configuration);
34
35        if (self::$configuration->get('security.enableGoogleReCaptchaV2')) {
36            self::$captchaHelper = new GoogleRecaptchaAbstractHelper(self::$configuration);
37        }
38
39        return self::$captchaHelper;
40    }
41}