You are here

public function ParsedMarkdown::getSize in Markdown 3.0.x

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/ParsedMarkdown.php

File

src/ParsedMarkdown.php, line 171

Class

ParsedMarkdown

Namespace

Drupal\markdown

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;
}