code: public function encrypt($key, $data, $mode, $initialization_vector)
      {
          if (isset(self::$cipher_mode_map[$mode])) {
              $mode = self::$cipher_mode_map[$mode];
          } else {
              throw new InvalidArgumentException('Unknown cipher mode "'. $mode .'"');
          }
  
          $options = $this->getOpenSslEncryptionOptions();
  
          $key = $this->processKey($key);
  
          $encrypted = openssl_encrypt($data, $mode, $key, $options, $initialization_vector);
  
          if (false === $encrypted) {
              throw CryptographicFailureException::forReasonCode(
                  CryptographicFailureException::CODE_FOR_ENCRYPTION_FAILURE
              );
          }
  
          return $encrypted;
      }
docs: {@inheritDoc}