| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace ByTIC\GoogleRecaptcha\Forms; |
||||||
| 4 | |||||||
| 5 | use ByTIC\GoogleRecaptcha\Utility\GoogleRecaptcha; |
||||||
| 6 | |||||||
| 7 | /** |
||||||
| 8 | * Trait FomHasRecaptchaTrait |
||||||
| 9 | * @package ByTIC\GoogleRecaptcha\Forms |
||||||
| 10 | */ |
||||||
| 11 | trait FomHasRecaptchaTrait |
||||||
| 12 | { |
||||||
| 13 | protected function initRecaptcha() |
||||||
| 14 | { |
||||||
| 15 | $this->addHidden('recaptchaResponse', 'recaptchaResponse', false); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 16 | $this->getElement('recaptchaResponse')->setId('recaptchaResponse'); |
||||||
|
0 ignored issues
–
show
It seems like
getElement() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 17 | } |
||||||
| 18 | |||||||
| 19 | protected function processValidationRecaptcha() |
||||||
| 20 | { |
||||||
| 21 | $resp = GoogleRecaptcha::getManager()->verify($_POST['recaptchaResponse']); |
||||||
| 22 | if (!$resp->isSuccess()) { |
||||||
| 23 | $errors = $resp->getErrorCodes(); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 24 | $this->addError("Eroare validare email. Va rugam sa mai incercati!"); |
||||||
|
0 ignored issues
–
show
It seems like
addError() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 25 | } |
||||||
| 26 | } |
||||||
| 27 | } |