From: Reedy Date: Sat, 4 Aug 2012 23:47:23 +0000 (+0100) Subject: Add a MagicWordArray::getNames() function X-Git-Tag: 1.31.0-rc.0~22797^2 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=ecea5fe7b0dea6b13a4feb3a24b1c4b83c48f0cb;p=lhc%2Fweb%2Fwiklou.git Add a MagicWordArray::getNames() function Minor documentation fixes too Change-Id: Iabf858c30d45073cb82da398d6f9e6f5bb310b34 --- diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 997034cf46..42791f57a5 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -299,6 +299,7 @@ class MagicWord { * Initialises this object with an ID * * @param $id + * @throws MWException */ function load( $id ) { global $wgContLang; @@ -645,6 +646,9 @@ class MagicWordArray { var $baseRegex, $regex; var $matches; + /** + * @param $names array + */ function __construct( $names = array() ) { $this->names = $names; } @@ -772,6 +776,14 @@ class MagicWordArray { return $newRegex; } + /** + * @since 1.20 + * @return array + */ + public function getNames() { + return $this->names; + } + /** * Parse a match array from preg_match * Returns array(magic word ID, parameter value) @@ -779,6 +791,7 @@ class MagicWordArray { * * @param $m array * + * @throws MWException * @return array */ function parseMatch( $m ) { @@ -815,7 +828,7 @@ class MagicWordArray { $regexes = $this->getVariableStartToEndRegex(); foreach ( $regexes as $regex ) { if ( $regex !== '' ) { - $m = false; + $m = array(); if ( preg_match( $regex, $text, $m ) ) { return $this->parseMatch( $m ); }