protected function EncryptService::validate in Encrypt 8.3
Determines whether the input is valid for encryption / decryption.
Parameters
string $text: The text to encrypt / decrypt.
\Drupal\encrypt\EncryptionProfileInterface $encryption_profile: The encryption profile to validate.
Return value
bool Whether the encryption profile validated correctly.
Throws
\Drupal\encrypt\Exception\EncryptException Error with validation failures.
2 calls to EncryptService::validate()
- EncryptService::decrypt in src/
EncryptService.php - Main decrypt function.
- EncryptService::encrypt in src/
EncryptService.php - Main encrypt function.
File
- src/
EncryptService.php, line 111
Class
- EncryptService
- Class EncryptService.
Namespace
Drupal\encryptCode
protected function validate($text, EncryptionProfileInterface $encryption_profile) {
$errors = $encryption_profile
->validate($text);
if (!empty($errors)) {
// Throw an exception with the errors from the encryption method.
throw new EncryptException(implode('; ', $errors));
}
return TRUE;
}