GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c7f4e3...a41792 )
by Mario
18:09
created

ReCaptcha::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Netgen\InformationCollection\API\Value\Captcha;
4
5
use Netgen\InformationCollection\API\Service\CaptchaValue;
6
use ReCaptcha\ReCaptcha as BaseReCaptcha;
7
use Symfony\Component\HttpFoundation\Request;
8
9
class ReCaptcha implements CaptchaValue
10
{
11
    /**
12
     * @var \ReCaptcha\ReCaptcha
13
     */
14
    protected $reCaptcha;
15
16
    /**
17
     * ReCaptcha constructor.
18
     *
19
     * @param \ReCaptcha\ReCaptcha $reCaptcha
20
     */
21
    public function __construct(BaseReCaptcha $reCaptcha)
22
    {
23
        $this->reCaptcha = $reCaptcha;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function isValid(Request $request): bool
30
    {
31
        $response = $this->reCaptcha->verify(
32
            $request->request->get('g-recaptcha-response'), $request->getClientIp()
33
        );
34
35
        return $response->isSuccess();
36
    }
37
38
    /**
39
     * Returns aggregated captcha implementation
40
     *
41
     * @return \ReCaptcha\ReCaptcha
42
     */
43
    public function getInnerCaptcha(): \ReCaptcha\ReCaptcha
44
    {
45
        return $this->reCaptcha;
46
    }
47
}
48