public function HCaptcha::getResponseErrors in hCaptcha 8
1 call to HCaptcha::getResponseErrors()
- HCaptcha::validate in src/
HCaptcha/ HCaptcha.php
File
- src/
HCaptcha/ HCaptcha.php, line 85
Class
Namespace
Drupal\hcaptcha\HCaptchaCode
public function getResponseErrors() {
// Error code reference, https://hcaptcha.com/docs#server
$errors = array();
if (isset($this->validated->{'error-codes'}) && is_array($this->validated->{'error-codes'})) {
$error_codes = $this
->getErrorCodes();
foreach ($this->validated->{'error-codes'} as $code) {
if (!isset($error_codes[$code])) {
$code = 'unknown-error';
}
$errors[] = $error_codes[$code];
}
}
return $errors;
}