Elgg\Profiler::handlePageOutput PHP Метод

handlePageOutput() публичный статический Метод

Append a SCRIPT element to the page output
public static handlePageOutput ( string $hook, string $type, string $html, array $params ) : string
$hook string "output"
$type string "page"
$html string Full page HTML
$params array Hook params
Результат string
    public static function handlePageOutput($hook, $type, $html, $params)
    {
        $profiler = new self();
        $min_percentage = elgg_get_config('profiling_minimum_percentage');
        if ($min_percentage !== null) {
            $profiler->minimum_percentage = $min_percentage;
        }
        $tree = $profiler->buildTree(_elgg_services()->timer);
        $tree = $profiler->formatTree($tree);
        $data['tree'] = $tree;
        $data['total'] = $tree['duration'] . " seconds";
        $list = [];
        $profiler->flattenTree($list, $tree);
        $root = elgg_get_config('path');
        $list = array_map(function ($period) use($root) {
            $period['name'] = str_replace("Closure {$root}", "Closure ", $period['name']);
            return "{$period['percentage']}% ({$period['duration']}) {$period['name']}";
        }, $list);
        $data['list'] = $list;
        $html .= "<script>console.log(" . json_encode($data) . ");</script>";
        return $html;
    }