Minor documentation additions

Change-Id: I876de41b2c81d93df34ee2a8222aff6dc8176aae
This commit is contained in:
Reedy 2012-07-23 20:55:59 +01:00
parent 8d2534bc77
commit fdd7c091bd
3 changed files with 24 additions and 12 deletions

View file

@ -5,6 +5,10 @@ if ( !defined( 'MEDIAWIKI' ) ) {
}
class ConvertError extends MWException {
/**
* @param $msg string
*/
public function __construct( $msg /*...*/ ) {
$args = func_get_args();
array_shift( $args );
@ -203,7 +207,8 @@ class ConvertParser {
/**
* Find the unit at the end of the string and load $this->sourceUnit with an appropriate
* ConvertUnit, or throw an exception if the unit is unrecognised.
* @param $string
* @param $string string
* @throws ConvertError
*/
protected function deduceSourceUnit( $string ){
# Get the unit from the end of the string
@ -407,7 +412,8 @@ class ConvertDimension {
/**
* Constructor
* @param $var ConvertDimension|Int a dimension constant or existing unit
* @param $var2 ConvertDimension|Int optionally another dimension constant for a compound unit $var/$var2
* @param $var2 ConvertDimension|Int|null optionally another dimension constant for a compound unit $var/$var2
* @throws ConvertError
*/
public function __construct( $var, $var2 = null ){
static $legalDimensionsFlip;
@ -707,6 +713,7 @@ class ConvertUnit {
/**
* Parse a raw unit string, and populate member variables
* @param $rawUnit String
* @throws ConvertError
*/
protected function parseUnit( $rawUnit ){
@ -721,7 +728,7 @@ class ConvertUnit {
array_map( 'trim', $parts );
if( count( $parts ) == 1 ){
# Single unit
foreach( self::$units as $dimension => $units ){
foreach( self::$units as $units ){
foreach( $units as $unit => $data ){
if( $rawUnit == $unit
|| ( !$data[2] && preg_match( "/^({$data[1]})$/u", $parts[0] ) )
@ -770,7 +777,7 @@ class ConvertUnit {
/**
* Get the mathematical factor which will convert a measurement in this unit into a
* measurement in the SI base unit for the dimension
* @return double
* @return number double
*/
public function getConversion(){
return $this->conversion * $this->getPrefixConversion();
@ -778,7 +785,7 @@ class ConvertUnit {
/**
* Get the conversion factor associated with the prefix(es) in the unit
* @return double
* @return number double
*/
public function getPrefixConversion(){
if( !$this->prefix ){

View file

@ -47,6 +47,10 @@ define( 'EXPR_POW', 35 );
define( 'EXPR_PI', 36 );
class ExprError extends MWException {
/**
* @param $msg string
* @param $parameter string
*/
public function __construct( $msg, $parameter = '' ) {
$this->message = '<strong class="error">' . wfMsgForContent( "pfunc_expr_$msg", htmlspecialchars( $parameter ) ) . '</strong>';
}
@ -158,6 +162,7 @@ class ExprParser {
* http://montcs.bloomu.edu/~bobmon/Information/RPN/infix2rpn.shtml
* It's essentially the same as Dijkstra's shunting yard algorithm.
* @param $expr string
* @throws ExprError
* @return string
*/
function doExpression( $expr ) {

View file

@ -372,7 +372,7 @@ class ExtParserFunctions {
* since their existence can be checked without
* accessing the database.
*/
return SpecialPage::exists( $title->getDBkey() ) ? $then : $else;
return SpecialPageFactory::exists( $title->getDBkey() ) ? $then : $else;
} elseif ( $title->isExternal() ) {
/* Can't check the existence of pages on other sites,
* so just return $else. Makes a sort of sense, since
@ -524,7 +524,7 @@ class ExtParserFunctions {
* Obtain a specified number of slash-separated parts of a title,
* e.g. {{#titleparts:Hello/World|1}} => "Hello"
*
* @param $parser Parent parser
* @param $parser Parser Parent parser
* @param $title string Title to split
* @param $parts int Number of parts to keep
* @param $offset int Offset starting at 1
@ -626,7 +626,7 @@ class ExtParserFunctions {
* Note: If the needle is not found, empty string is returned.
* @param $parser Parser
* @param $inStr string
* @param $inNeedle int
* @param $inNeedle int|string
* @param $inOffset int
* @return int|string
*/
@ -660,7 +660,7 @@ class ExtParserFunctions {
* Note: If the needle is not found, -1 is returned.
* @param $parser Parser
* @param $inStr string
* @param $inNeedle int
* @param $inNeedle int|string
* @return int|string
*/
public static function runRPos ( $parser, $inStr = '', $inNeedle = '' ) {