From 8e765baa8c33eacea0276e4b49c50be6c434d46d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 18 Nov 2014 20:46:41 +0000 Subject: [PATCH] profiler: Simplify code for class name mapping Follows-up 000c6529d. Handle errors first. Change-Id: I70308783a2e8b140b3c850758cce36544b32eb20 --- includes/profiler/Profiler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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() ) { -- 2.20.1