You are here

private function XHProfController::getRunHeader in XHProf 8

Parameters

\Drupal\xhprof\XHProfLib\Report\ReportInterface $report:

array $descriptions:

Return value

array

2 calls to XHProfController::getRunHeader()
XHProfController::runAction in src/Controller/XHProfController.php
Renders the run.
XHProfController::symbolAction in src/Controller/XHProfController.php

File

src/Controller/XHProfController.php, line 240

Class

XHProfController
Displays profiling results.

Namespace

Drupal\xhprof\Controller

Code

private function getRunHeader(ReportInterface $report, $descriptions, $run_id) {
  $headers = [
    'fn',
    'ct',
    'ct_perc',
  ];
  $metrics = $report
    ->getMetrics();
  foreach ($metrics as $metric) {
    $headers[] = $metric;
    $headers[] = $metric . '_perc';
    $headers[] = 'excl_' . $metric;
    $headers[] = 'excl_' . $metric . '_perc';
  }
  $sortable = ReportConstants::getSortableColumns();
  foreach ($headers as &$header) {
    if (isset($sortable[$header])) {
      $header = [
        'data' => Link::createFromRoute($descriptions[$header], 'xhprof.run', [
          'run' => $run_id,
        ], [
          'query' => [
            'sort' => $header,
          ],
        ])
          ->toRenderable(),
      ];
    }
    else {
      $header = new FormattableMarkup($descriptions[$header], []);
    }
  }
  return $headers;
}