CaptchaTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 2
c 2
b 0
f 2
lcom 0
cbo 3
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A captchaCheck() 0 14 2
1
<?php namespace jlourenco\support\Traits;
2
3
use Input;
4
use ReCaptcha\ReCaptcha;
5
6
trait CaptchaTrait
7
{
8
9
    public function captchaCheck()
10
    {
11
        $response = Input::get('g-recaptcha-response');
12
        $remoteip = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_SANITIZE_STRING); //$_SERVER['REMOTE_ADDR'];
13
        $secret   = config('jlourenco.support.RE_CAP_SECRET');
14
15
        $recaptcha = new ReCaptcha($secret);
16
        $resp = $recaptcha->verify($response, $remoteip);
17
18
        if ($resp->isSuccess())
19
            return true;
20
        else
21
            return false;
22
    }
23
24
}