You are here

public function MarkdownBenchmarkAverages::getBenchmarks in Markdown 3.0.x

Retrieves the currently set benchmarks.

Parameters

string $type: The type of benchmark to retrieve, can be one of:

  • parsed
  • rendered
  • total (default)

Return value

\Drupal\markdown\MarkdownBenchmark[]

2 calls to MarkdownBenchmarkAverages::getBenchmarks()
MarkdownBenchmarkAverages::getAverage in src/MarkdownBenchmarkAverages.php
Retrieves the averaged time from all benchmarks of a certain type.
MarkdownBenchmarkAverages::getLastBenchmark in src/MarkdownBenchmarkAverages.php
Retrieves the last benchmark of a certain type.

File

src/MarkdownBenchmarkAverages.php, line 241

Class

MarkdownBenchmarkAverages
Class MarkdownBenchmarkAverages.

Namespace

Drupal\markdown

Code

public function getBenchmarks($type = NULL) {
  if ($type === NULL) {
    return array_values($this->benchmarks);
  }
  return array_values(array_filter($this->benchmarks, function ($benchmark) use ($type) {

    /** @type \Drupal\markdown\MarkdownBenchmark $benchmark */
    return $benchmark
      ->getType() === $type;
  }));
}