You are here

public function MarkdownParserBenchmarkTrait::benchmark in Markdown 3.0.x

Return value

\Drupal\markdown\MarkdownBenchmark[]

See also

\Drupal\markdown\Plugin\Markdown\MarkdownParserBenchmarkInterface::benchmark()

File

src/Traits/MarkdownParserBenchmarkTrait.php, line 26

Class

MarkdownParserBenchmarkTrait

Namespace

Drupal\markdown\Traits

Code

public function benchmark($markdown, $format = NULL) {

  // Start.
  $parsed = $this
    ->benchmarkParse($markdown);
  $rendered = $this
    ->benchmarkRender($markdown, $format);
  $total = MarkdownBenchmark::create('total', $parsed
    ->getStart(), $rendered
    ->getEnd(), $rendered
    ->getResult());

  // Stop
  static::$benchmark = FALSE;

  // Return parsed, rendered, total.
  return [
    $parsed,
    $rendered,
    $total,
  ];
}