You are here

private function BenchmarkCommand::getOrderedDatas in Devel 8.2

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getOrderedDatas()
  2. 8 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getOrderedDatas()
  3. 4.x webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getOrderedDatas()

Parameters

\Drupal\webprofiler\Command\BenchmarkData[] $datas:

$string:

Return value

array

1 call to BenchmarkCommand::getOrderedDatas()
BenchmarkCommand::computePercentile in webprofiler/src/Command/BenchmarkCommand.php
Computes percentile using The Nearest Rank method.

File

webprofiler/src/Command/BenchmarkCommand.php, line 247

Class

BenchmarkCommand
Class BenchmarkCommand

Namespace

Drupal\webprofiler\Command

Code

private function getOrderedDatas(&$datas, $string) {
  usort($datas, function ($a, $b) use ($string) {
    $method = 'get' . $string;
    if ($a->{$method} > $b->{$method}) {
      return 1;
    }
    if ($a->{$method} < $b->{$method}) {
      return -1;
    }
    return 0;
  });
}