From de37b20c68b3f0b337d92787f4e7590f75189128 Mon Sep 17 00:00:00 2001 From: Ricordisamoa Date: Wed, 10 Dec 2014 07:43:28 +0000 Subject: [PATCH] Xml: Simplify processing of attributes in Xml::label Comment inserted by Antoine Musso with d86a3bc2177f79. Also fixed wrong indentation. Change-Id: I054762929413f90090b446c603b60ed9544c06d1 --- includes/Xml.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/Xml.php b/includes/Xml.php index 159f711464..c07ac73bef 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -368,12 +368,10 @@ class Xml { public static function label( $label, $id, $attribs = array() ) { $a = array( 'for' => $id ); - # FIXME avoid copy pasting below: - if ( isset( $attribs['class'] ) ) { - $a['class'] = $attribs['class']; - } - if ( isset( $attribs['title'] ) ) { - $a['title'] = $attribs['title']; + foreach ( array( 'class', 'title' ) as $attr ) { + if ( isset( $attribs[$attr] ) ) { + $a[$attr] = $attribs[$attr]; + } } return self::element( 'label', $a, $label ); -- 2.20.1