Issues (61)

app/Validators/ReCaptcha.php (3 issues)

Severity
1
<?php
2
3
namespace Gameap\Validators;
4
5
use GuzzleHttp\Client;
6
7
class ReCaptcha
8
{
9
    public function validate($attribute, $value, $parameters, $validator)
0 ignored issues
show
The parameter $attribute is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

9
    public function validate(/** @scrutinizer ignore-unused */ $attribute, $value, $parameters, $validator)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $parameters is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

9
    public function validate($attribute, $value, /** @scrutinizer ignore-unused */ $parameters, $validator)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $validator is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

9
    public function validate($attribute, $value, $parameters, /** @scrutinizer ignore-unused */ $validator)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
10
    {
11
        $client = new Client();
12
13
        $response = $client->post(
14
            'https://www.google.com/recaptcha/api/siteverify',
15
            ['form_params' =>
16
                [
17
                    'secret'   => env('GOOGLE_RECAPTCHA_SECRET'),
18
                    'response' => $value,
19
                ],
20
            ]
21
        );
22
23
        $body = json_decode((string)$response->getBody());
24
        return $body->success;
25
    }
26
}
27