X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fprofiler%2FSectionProfiler.php;h=c27ab4f3f450509d3d0a433498748859285067b5;hb=6341ee8fa626b75372a70ff0203399a29d219e5f;hp=fdfb24d8c48a2262e74ae6a82ce7ec2e7a79343b;hpb=1abc89fc7651e122ca53fe874eecb89f30b5ba35;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/profiler/SectionProfiler.php b/includes/profiler/SectionProfiler.php index fdfb24d8c4..c27ab4f3f4 100644 --- a/includes/profiler/SectionProfiler.php +++ b/includes/profiler/SectionProfiler.php @@ -66,7 +66,7 @@ class SectionProfiler { } /** - * @param ScopedCallback $section + * @param ScopedCallback &$section */ public function scopedProfileOut( ScopedCallback &$section ) { $section = null; @@ -298,7 +298,7 @@ class SectionProfiler { /* Find all items under this entry */ $level = $stack[$max][1]; $working = []; - for ( $i = $max -1; $i >= 0; $i-- ) { + for ( $i = $max - 1; $i >= 0; $i-- ) { if ( $stack[$i][1] > $level ) { $working[] = $stack[$i]; } else { @@ -439,8 +439,8 @@ class SectionProfiler { protected function calltreeCount( $stack, $start ) { $level = $stack[$start][1]; $count = 0; - for ( $i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i-- ) { - $count ++; + for ( $i = $start - 1; $i >= 0 && $stack[$i][1] > $level; $i-- ) { + $count++; } return $count; } @@ -496,29 +496,3 @@ class SectionProfiler { } } } - -/** - * Subclass ScopedCallback to avoid call_user_func_array(), which is slow - * - * This class should not be used outside of SectionProfiler - */ -class SectionProfileCallback extends ScopedCallback { - /** @var SectionProfiler */ - protected $profiler; - /** @var string */ - protected $section; - - /** - * @param SectionProfiler $profiler - * @param string $section - */ - public function __construct( SectionProfiler $profiler, $section ) { - parent::__construct( null ); - $this->profiler = $profiler; - $this->section = $section; - } - - function __destruct() { - $this->profiler->profileOutInternal( $this->section ); - } -}