code: public function encrypt($data)
      {
          if ($this->iv === null) {
              $dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode);
          } else {
              $dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode, $this->iv);
          }
  
          return bin2hex($dataEncrypted);
      }
docs: Encrypt the data string
  
  @param  string $data
  @return string