public function TestEncryptionMethod::encrypt in Encrypt 8.3
Encrypt text.
Parameters
string $text: The text to be encrypted.
string $key: The key to encrypt the text with.
Return value
string The encrypted text
Throws
\Drupal\encrypt\Exception\EncryptException Thrown when encryption fails.
Overrides EncryptionMethodInterface::encrypt
File
- tests/
modules/ encrypt_test/ src/ Plugin/ EncryptionMethod/ TestEncryptionMethod.php, line 31
Class
- TestEncryptionMethod
- TestEncryptionMethod testing class.
Namespace
Drupal\encrypt_test\Plugin\EncryptionMethodCode
public function encrypt($text, $key, $options = []) {
return str_rot13($key . $text);
}