From: Timo Tijhof Date: Tue, 18 Nov 2014 20:46:41 +0000 (+0000) Subject: profiler: Simplify code for class name mapping X-Git-Tag: 1.31.0-rc.0~13258^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=8e765baa8c33eacea0276e4b49c50be6c434d46d;p=lhc%2Fweb%2Fwiklou.git profiler: Simplify code for class name mapping Follows-up 000c6529d. Handle errors first. Change-Id: I70308783a2e8b140b3c850758cce36544b32eb20 --- diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 0df3468aa6..f2bdc849ac 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -157,11 +157,11 @@ abstract class Profiler { } foreach ( $output as $outType ) { - if ( isset( self::$outputTypes[$outType] ) ) { - $class = self::$outputTypes[$outType]; - } else { + if ( !isset( self::$outputTypes[$outType] ) ) { throw new MWException( "'$outType' is an invalid output type" ); } + $class = self::$outputTypes[$outType]; + /** @var ProfilerOutput $profileOut */ $profileOut = new $class( $this, $this->params ); if ( $profileOut->canUse() ) {