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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isValid() 0 8 1
A getInnerCaptcha() 0 4 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