You are here

public function ParsedMarkdown::getSize in Markdown 8.2

Retrieves the file size of the parsed HTML.

Parameters

bool $formatted: Flag indicating whether to retrieve the formatted, human-readable, file size.

int $decimals: The number of decimal points to use if $formatted is TRUE.

Return value

int|string The raw file size in bytes or the formatted human-readable file size.

Overrides ParsedMarkdownInterface::getSize

1 call to ParsedMarkdown::getSize()
ParsedMarkdown::count in src/Render/ParsedMarkdown.php

File

src/Render/ParsedMarkdown.php, line 151

Class

ParsedMarkdown
The end result of parsing markdown into HTML.

Namespace

Drupal\markdown\Render

Code

public function getSize($formatted = FALSE, $decimals = 2) {
  if ($this->size === NULL) {
    $this->size = Unicode::strlen($this
      ->getHtml());
  }
  return $formatted ? number_format($this->size, $decimals) : $this->size;
}