Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php namespace jlourenco\support\Traits; |
||
9 | public function captchaCheck() |
||
|
|||
10 | { |
||
11 | $response = Input::get('g-recaptcha-response'); |
||
12 | $remoteip = $_SERVER['REMOTE_ADDR']; |
||
13 | $secret = env('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 | } |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: