/** * @inheritdoc * * Checks the CaptchaControl object in order to know if validation is needed * or not. * Performs a hit in the captcha control cache component. */ public function validateAttribute($model, $attribute) { $captchaControl = new CaptchaControl(['model' => $model]); if ($captchaControl->hasReachedRequestNumber()) { parent::validateAttribute($model, $attribute); } $captchaControl->hit(); }