Parser.php in XHProf 8
File
src/XHProfLib/Parser/Parser.php
View source
<?php
namespace Drupal\xhprof\XHProfLib\Parser;
use Drupal\xhprof\XHProfLib\Run;
class Parser extends BaseParser {
public function __construct(Run $run, $sort, $symbol) {
parent::__construct($run, $sort, $symbol);
$this->diff_mode = FALSE;
}
public function parse() {
if (!empty($this->symbol)) {
$symbols = $this
->trimRun($this->run
->getSymbols(), $this->symbol);
}
else {
$symbols = $this->run
->getSymbols();
}
$data = $this
->computeFlatInfo($symbols);
if ($this->sort === 'fn') {
\krsort($data);
}
else {
$metric = $this->sort;
\uasort($data, function ($a, $b) use ($metric) {
return $b[$metric] <=> $a[$metric];
});
}
return $data;
}
}