You are here

public function ParsedMarkdown::serialize in Markdown 8.2

File

src/Render/ParsedMarkdown.php, line 185

Class

ParsedMarkdown
The end result of parsing markdown into HTML.

Namespace

Drupal\markdown\Render

Code

public function serialize() {
  $data['object'] = serialize(get_object_vars($this));

  // Determine if PHP has gzip capabilities.
  $data['gzip'] = extension_loaded('zlib');

  // Compress and encode the markdown and html output.
  if ($data['gzip']) {

    /* @noinspection PhpComposerExtensionStubsInspection */
    $data['object'] = base64_encode(gzencode($data['object'], 9));
  }
  return serialize($data);
}