Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SectionProfileCallback
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 __destruct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * @license GPL-2.0-or-later
4 * @file
5 */
6
7namespace MediaWiki\Profiler;
8
9use Wikimedia\ScopedCallback;
10
11/**
12 * Subclass ScopedCallback to avoid call_user_func_array(), which is slow.
13 *
14 * @ingroup Profiler
15 * @internal For use by SectionProfiler
16 */
17class SectionProfileCallback extends ScopedCallback {
18
19    protected SectionProfiler $profiler;
20    protected string $section;
21
22    public function __construct( SectionProfiler $profiler, string $section ) {
23        parent::__construct( null );
24        $this->profiler = $profiler;
25        $this->section = $section;
26    }
27
28    public function __destruct() {
29        $this->profiler->profileOutInternal( $this->section );
30    }
31}
32
33/** @deprecated class alias since 1.46 */
34class_alias( SectionProfileCallback::class, 'SectionProfileCallback' );