| Conditions | 11 |
| Paths | 90 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 12 | public static function isEnabled(): bool |
||
| 13 | { |
||
| 14 | $provider = config('captcha.provider', 'recaptcha'); |
||
| 15 | |||
| 16 | // Enforce that both providers cannot be enabled at the same time |
||
| 17 | $recaptchaEnabled = config('captcha.recaptcha.enabled') === true |
||
| 18 | && ! empty(config('captcha.recaptcha.sitekey')) |
||
| 19 | && ! empty(config('captcha.recaptcha.secret')); |
||
| 20 | |||
| 21 | $turnstileEnabled = config('captcha.turnstile.enabled') === true |
||
| 22 | && ! empty(config('captcha.turnstile.sitekey')) |
||
| 23 | && ! empty(config('captcha.turnstile.secret')); |
||
| 24 | |||
| 25 | // If both are configured as enabled, log a warning and use the configured provider |
||
| 26 | if ($recaptchaEnabled && $turnstileEnabled) { |
||
| 27 | \Log::warning('Both reCAPTCHA and Turnstile are enabled. Only one can be active at a time. Using provider: '.$provider); |
||
| 28 | } |
||
| 29 | |||
| 30 | if ($provider === 'turnstile') { |
||
| 31 | return $turnstileEnabled; |
||
| 32 | } |
||
| 33 | |||
| 34 | // Default to reCAPTCHA |
||
| 35 | return $recaptchaEnabled || config('captcha.enabled') === true |
||
| 36 | && ! empty(config('captcha.sitekey')) |
||
| 37 | && ! empty(config('captcha.secret')); |
||
| 38 | } |
||
| 130 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths