| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function __invoke( $g_recaptcha_response, $remote_ip) |
||
| 40 | { |
||
| 41 | $response = $this->recaptcha->verify($g_recaptcha_response, $remote_ip); |
||
| 42 | |||
| 43 | |||
| 44 | if ($response->isSuccess()) : |
||
| 45 | $this->logger->info( "Validation successful", [ |
||
| 46 | 'remote_ip' => $remote_ip |
||
| 47 | ]); |
||
| 48 | return true; |
||
| 49 | endif; |
||
| 50 | |||
| 51 | |||
| 52 | $errors = $response->getErrorCodes() ?: array(); |
||
| 53 | $this->logger->notice( "Failed validation", [ |
||
| 54 | 'remote_ip' => $remote_ip, |
||
| 55 | 'errors' => join(",", $errors ) |
||
| 56 | ]); |
||
| 57 | |||
| 58 | return false; |
||
| 59 | } |
||
| 60 | } |
||
| 61 |