Captcha   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 14
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
1
<?php
2
3
namespace Torralbodavid\SimpleRecaptchaV3\Services;
4
5
class Captcha
6
{
7
    protected const SERVICE_URL = 'https://www.google.com/recaptcha/api/siteverify';
8
    protected $secret;
9
    protected $response;
10
11
    public function __invoke($recaptcha_response)
12
    {
13
        $this->secret = config('simple-recaptcha-v3.secret_key');
14
        $this->response = $recaptcha_response;
15
16
        $recaptcha = file_get_contents(self::SERVICE_URL.'?secret='.$this->secret.'&response='.$this->response);
17
18
        return json_decode($recaptcha);
19
    }
20
}
21