protected function MarstonEncryption::applyFudgeFactor in Ubercart 8.4
Returns an adjustment value based on the contents of $fudgefactor.
2 calls to MarstonEncryption::applyFudgeFactor()
- MarstonEncryption::decrypt in uc_store/
src/ MarstonEncryption.php - Decrypts cyphertext.
- MarstonEncryption::encrypt in uc_store/
src/ MarstonEncryption.php - Encrypts plaintext.
File
- uc_store/
src/ MarstonEncryption.php, line 182
Class
- MarstonEncryption
- Deprecated. Handles encryption of credit-card information.
Namespace
Drupal\uc_storeCode
protected function applyFudgeFactor(&$fudgefactor) {
static $alerted = FALSE;
if (!is_array($fudgefactor)) {
$fudge = 0;
if (!$alerted) {
// Throw an error that makes sense so this stops getting reported.
$this->errors[] = t('No encryption key was found.');
\Drupal::messenger()
->addError(t('Ubercart cannot find a necessary encryption key. Refer to the store admin <a href=":url">dashboard</a> to isolate which one.', [
':url' => Url::fromRoute('uc_store.admin')
->toString(),
]));
$alerted = TRUE;
}
}
else {
$fudge = array_shift($fudgefactor);
}
$fudge = $fudge + $this->adj;
$fudgefactor[] = $fudge;
if (!empty($this->mod)) {
if ($fudge % $this->mod == 0) {
$fudge = $fudge * -1;
}
}
return $fudge;
}