Issues (21)

src/Forms/FomHasRecaptchaTrait.php (4 issues)

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
It seems like addHidden() 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 ignore-call  annotation

15
        $this->/** @scrutinizer ignore-call */ 
16
               addHidden('recaptchaResponse', 'recaptchaResponse', false);
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 ignore-call  annotation

16
        $this->/** @scrutinizer ignore-call */ 
17
               getElement('recaptchaResponse')->setId('recaptchaResponse');
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
The assignment to $errors is dead and can be removed.
Loading history...
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 ignore-call  annotation

24
            $this->/** @scrutinizer ignore-call */ 
25
                   addError("Eroare validare email. Va rugam sa mai incercati!");
Loading history...
25
        }
26
    }
27
}