dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Don't re-apply EXIF rotation to chained thumbnails"
[lhc/web/wiklou.git]
/
includes
/
parser
/
Preprocessor_Hash.php
diff --git
a/includes/parser/Preprocessor_Hash.php
b/includes/parser/Preprocessor_Hash.php
index
26daca1
..
b4b14dc
100644
(file)
--- a/
includes/parser/Preprocessor_Hash.php
+++ b/
includes/parser/Preprocessor_Hash.php
@@
-26,23
+26,26
@@
* * attribute nodes are children
* * "<h>" nodes that aren't at the top are replaced with <possible-h>
* @ingroup Parser
* * attribute nodes are children
* * "<h>" nodes that aren't at the top are replaced with <possible-h>
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class Preprocessor_Hash implements Preprocessor {
*/
class Preprocessor_Hash implements Preprocessor {
+ // @codingStandardsIgnoreEnd
+
/**
* @var Parser
*/
/**
* @var Parser
*/
-
var
$parser;
+
public
$parser;
const CACHE_VERSION = 1;
const CACHE_VERSION = 1;
- function __construct( $parser ) {
+
public
function __construct( $parser ) {
$this->parser = $parser;
}
/**
* @return PPFrame_Hash
*/
$this->parser = $parser;
}
/**
* @return PPFrame_Hash
*/
- function newFrame() {
+
public
function newFrame() {
return new PPFrame_Hash( $this );
}
return new PPFrame_Hash( $this );
}
@@
-50,7
+53,7
@@
class Preprocessor_Hash implements Preprocessor {
* @param array $args
* @return PPCustomFrame_Hash
*/
* @param array $args
* @return PPCustomFrame_Hash
*/
- function newCustomFrame( $args ) {
+
public
function newCustomFrame( $args ) {
return new PPCustomFrame_Hash( $this, $args );
}
return new PPCustomFrame_Hash( $this, $args );
}
@@
-58,7
+61,7
@@
class Preprocessor_Hash implements Preprocessor {
* @param array $values
* @return PPNode_Hash_Array
*/
* @param array $values
* @return PPNode_Hash_Array
*/
- function newPartNodeArray( $values ) {
+
public
function newPartNodeArray( $values ) {
$list = array();
foreach ( $values as $k => $val ) {
$list = array();
foreach ( $values as $k => $val ) {
@@
-108,7
+111,7
@@
class Preprocessor_Hash implements Preprocessor {
* @throws MWException
* @return PPNode_Hash_Tree
*/
* @throws MWException
* @return PPNode_Hash_Tree
*/
- function preprocessToObj( $text, $flags = 0 ) {
+
public
function preprocessToObj( $text, $flags = 0 ) {
wfProfileIn( __METHOD__ );
// Check cache.
wfProfileIn( __METHOD__ );
// Check cache.
@@
-758,9
+761,12
@@
class Preprocessor_Hash implements Preprocessor {
/**
* Stack class to help Preprocessor::preprocessToObj()
* @ingroup Parser
/**
* Stack class to help Preprocessor::preprocessToObj()
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPDStack_Hash extends PPDStack {
*/
class PPDStack_Hash extends PPDStack {
- function __construct() {
+ // @codingStandardsIgnoreEnd
+
+ public function __construct() {
$this->elementClass = 'PPDStackElement_Hash';
parent::__construct();
$this->rootAccum = new PPDAccum_Hash;
$this->elementClass = 'PPDStackElement_Hash';
parent::__construct();
$this->rootAccum = new PPDAccum_Hash;
@@
-769,9
+775,12
@@
class PPDStack_Hash extends PPDStack {
/**
* @ingroup Parser
/**
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPDStackElement_Hash extends PPDStackElement {
*/
class PPDStackElement_Hash extends PPDStackElement {
- function __construct( $data = array() ) {
+ // @codingStandardsIgnoreENd
+
+ public function __construct( $data = array() ) {
$this->partClass = 'PPDPart_Hash';
parent::__construct( $data );
}
$this->partClass = 'PPDPart_Hash';
parent::__construct( $data );
}
@@
-782,7
+791,7
@@
class PPDStackElement_Hash extends PPDStackElement {
* @param int|bool $openingCount
* @return PPDAccum_Hash
*/
* @param int|bool $openingCount
* @return PPDAccum_Hash
*/
- function breakSyntax( $openingCount = false ) {
+
public
function breakSyntax( $openingCount = false ) {
if ( $this->open == "\n" ) {
$accum = $this->parts[0]->out;
} else {
if ( $this->open == "\n" ) {
$accum = $this->parts[0]->out;
} else {
@@
-807,9
+816,12
@@
class PPDStackElement_Hash extends PPDStackElement {
/**
* @ingroup Parser
/**
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPDPart_Hash extends PPDPart {
*/
class PPDPart_Hash extends PPDPart {
- function __construct( $out = '' ) {
+ // @codingStandardsIgnoreEnd
+
+ public function __construct( $out = '' ) {
$accum = new PPDAccum_Hash;
if ( $out !== '' ) {
$accum->addLiteral( $out );
$accum = new PPDAccum_Hash;
if ( $out !== '' ) {
$accum->addLiteral( $out );
@@
-820,11
+832,14
@@
class PPDPart_Hash extends PPDPart {
/**
* @ingroup Parser
/**
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPDAccum_Hash {
*/
class PPDAccum_Hash {
- var $firstNode, $lastNode;
+ // @codingStandardsIgnoreEnd
- function __construct() {
+ public $firstNode, $lastNode;
+
+ public function __construct() {
$this->firstNode = $this->lastNode = false;
}
$this->firstNode = $this->lastNode = false;
}
@@
-832,7
+847,7
@@
class PPDAccum_Hash {
* Append a string literal
* @param string $s
*/
* Append a string literal
* @param string $s
*/
- function addLiteral( $s ) {
+
public
function addLiteral( $s ) {
if ( $this->lastNode === false ) {
$this->firstNode = $this->lastNode = new PPNode_Hash_Text( $s );
} elseif ( $this->lastNode instanceof PPNode_Hash_Text ) {
if ( $this->lastNode === false ) {
$this->firstNode = $this->lastNode = new PPNode_Hash_Text( $s );
} elseif ( $this->lastNode instanceof PPNode_Hash_Text ) {
@@
-847,7
+862,7
@@
class PPDAccum_Hash {
* Append a PPNode
* @param PPNode $node
*/
* Append a PPNode
* @param PPNode $node
*/
- function addNode( PPNode $node ) {
+
public
function addNode( PPNode $node ) {
if ( $this->lastNode === false ) {
$this->firstNode = $this->lastNode = $node;
} else {
if ( $this->lastNode === false ) {
$this->firstNode = $this->lastNode = $node;
} else {
@@
-861,7
+876,7
@@
class PPDAccum_Hash {
* @param string $name
* @param string $value
*/
* @param string $name
* @param string $value
*/
- function addNodeWithText( $name, $value ) {
+
public
function addNodeWithText( $name, $value ) {
$node = PPNode_Hash_Tree::newWithText( $name, $value );
$this->addNode( $node );
}
$node = PPNode_Hash_Tree::newWithText( $name, $value );
$this->addNode( $node );
}
@@
-872,7
+887,7
@@
class PPDAccum_Hash {
* subsequently be modified, especially nextSibling.
* @param PPDAccum_Hash $accum
*/
* subsequently be modified, especially nextSibling.
* @param PPDAccum_Hash $accum
*/
- function addAccum( $accum ) {
+
public
function addAccum( $accum ) {
if ( $accum->lastNode === false ) {
// nothing to add
} elseif ( $this->lastNode === false ) {
if ( $accum->lastNode === false ) {
// nothing to add
} elseif ( $this->lastNode === false ) {
@@
-888,36
+903,38
@@
class PPDAccum_Hash {
/**
* An expansion frame, used as a context to expand the result of preprocessToObj()
* @ingroup Parser
/**
* An expansion frame, used as a context to expand the result of preprocessToObj()
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPFrame_Hash implements PPFrame {
*/
class PPFrame_Hash implements PPFrame {
+ // @codingStandardsIgnoreEnd
/**
* @var Parser
*/
/**
* @var Parser
*/
-
var
$parser;
+
public
$parser;
/**
* @var Preprocessor
*/
/**
* @var Preprocessor
*/
-
var
$preprocessor;
+
public
$preprocessor;
/**
* @var Title
*/
/**
* @var Title
*/
-
var
$title;
-
var
$titleCache;
+
public
$title;
+
public
$titleCache;
/**
* Hashtable listing templates which are disallowed for expansion in this frame,
* having been encountered previously in parent frames.
*/
/**
* Hashtable listing templates which are disallowed for expansion in this frame,
* having been encountered previously in parent frames.
*/
-
var
$loopCheckHash;
+
public
$loopCheckHash;
/**
* Recursion depth of this frame, top = 0
* Note that this is NOT the same as expansion depth in expand()
*/
/**
* Recursion depth of this frame, top = 0
* Note that this is NOT the same as expansion depth in expand()
*/
-
var
$depth;
+
public
$depth;
private $volatile = false;
private $ttl = null;
private $volatile = false;
private $ttl = null;
@@
-931,7
+948,7
@@
class PPFrame_Hash implements PPFrame {
* Construct a new preprocessor frame.
* @param Preprocessor $preprocessor The parent preprocessor
*/
* Construct a new preprocessor frame.
* @param Preprocessor $preprocessor The parent preprocessor
*/
- function __construct( $preprocessor ) {
+
public
function __construct( $preprocessor ) {
$this->preprocessor = $preprocessor;
$this->parser = $preprocessor->parser;
$this->title = $this->parser->mTitle;
$this->preprocessor = $preprocessor;
$this->parser = $preprocessor->parser;
$this->title = $this->parser->mTitle;
@@
-951,7
+968,7
@@
class PPFrame_Hash implements PPFrame {
* @throws MWException
* @return PPTemplateFrame_Hash
*/
* @throws MWException
* @return PPTemplateFrame_Hash
*/
- function newChild( $args = false, $title = false, $indexOffset = 0 ) {
+
public
function newChild( $args = false, $title = false, $indexOffset = 0 ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
@@
-968,11
+985,17
@@
class PPFrame_Hash implements PPFrame {
if ( $bits['index'] !== '' ) {
// Numbered parameter
$index = $bits['index'] - $indexOffset;
if ( $bits['index'] !== '' ) {
// Numbered parameter
$index = $bits['index'] - $indexOffset;
+ if ( isset( $namedArgs[$index] ) || isset( $numberedArgs[$index] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$numberedArgs[$index] = $bits['value'];
unset( $namedArgs[$index] );
} else {
// Named parameter
$name = trim( $this->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
$numberedArgs[$index] = $bits['value'];
unset( $namedArgs[$index] );
} else {
// Named parameter
$name = trim( $this->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
+ if ( isset( $namedArgs[$name] ) || isset( $numberedArgs[$name] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$namedArgs[$name] = $bits['value'];
unset( $numberedArgs[$name] );
}
$namedArgs[$name] = $bits['value'];
unset( $numberedArgs[$name] );
}
@@
-984,11
+1007,11
@@
class PPFrame_Hash implements PPFrame {
/**
* @throws MWException
* @param string|int $key
/**
* @throws MWException
* @param string|int $key
- * @param string|PPNode
_Hash|DOMDocument
$root
+ * @param string|PPNode $root
* @param int $flags
* @return string
*/
* @param int $flags
* @return string
*/
- function cachedExpand( $key, $root, $flags = 0 ) {
+
public
function cachedExpand( $key, $root, $flags = 0 ) {
// we don't have a parent, so we don't have a cache
return $this->expand( $root, $flags );
}
// we don't have a parent, so we don't have a cache
return $this->expand( $root, $flags );
}
@@
-999,7
+1022,7
@@
class PPFrame_Hash implements PPFrame {
* @param int $flags
* @return string
*/
* @param int $flags
* @return string
*/
- function expand( $root, $flags = 0 ) {
+
public
function expand( $root, $flags = 0 ) {
static $expansionDepth = 0;
if ( is_string( $root ) ) {
return $root;
static $expansionDepth = 0;
if ( is_string( $root ) ) {
return $root;
@@
-1207,9
+1230,10
@@
class PPFrame_Hash implements PPFrame {
/**
* @param string $sep
* @param int $flags
/**
* @param string $sep
* @param int $flags
+ * @param string|PPNode $args,...
* @return string
*/
* @return string
*/
- function implodeWithFlags( $sep, $flags /*, ... */ ) {
+
public
function implodeWithFlags( $sep, $flags /*, ... */ ) {
$args = array_slice( func_get_args(), 2 );
$first = true;
$args = array_slice( func_get_args(), 2 );
$first = true;
@@
-1237,9
+1261,10
@@
class PPFrame_Hash implements PPFrame {
* Implode with no flags specified
* This previously called implodeWithFlags but has now been inlined to reduce stack depth
* @param string $sep
* Implode with no flags specified
* This previously called implodeWithFlags but has now been inlined to reduce stack depth
* @param string $sep
+ * @param string|PPNode $args,...
* @return string
*/
* @return string
*/
- function implode( $sep /*, ... */ ) {
+
public
function implode( $sep /*, ... */ ) {
$args = array_slice( func_get_args(), 1 );
$first = true;
$args = array_slice( func_get_args(), 1 );
$first = true;
@@
-1268,9
+1293,10
@@
class PPFrame_Hash implements PPFrame {
* with implode()
*
* @param string $sep
* with implode()
*
* @param string $sep
+ * @param string|PPNode $args,...
* @return PPNode_Hash_Array
*/
* @return PPNode_Hash_Array
*/
- function virtualImplode( $sep /*, ... */ ) {
+
public
function virtualImplode( $sep /*, ... */ ) {
$args = array_slice( func_get_args(), 1 );
$out = array();
$first = true;
$args = array_slice( func_get_args(), 1 );
$out = array();
$first = true;
@@
-1300,9
+1326,10
@@
class PPFrame_Hash implements PPFrame {
* @param string $start
* @param string $sep
* @param string $end
* @param string $start
* @param string $sep
* @param string $end
+ * @param string|PPNode $args,...
* @return PPNode_Hash_Array
*/
* @return PPNode_Hash_Array
*/
- function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
+
public
function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
$args = array_slice( func_get_args(), 3 );
$out = array( $start );
$first = true;
$args = array_slice( func_get_args(), 3 );
$out = array( $start );
$first = true;
@@
-1327,7
+1354,7
@@
class PPFrame_Hash implements PPFrame {
return new PPNode_Hash_Array( $out );
}
return new PPNode_Hash_Array( $out );
}
- function __toString() {
+
public
function __toString() {
return 'frame{}';
}
return 'frame{}';
}
@@
-1335,7
+1362,7
@@
class PPFrame_Hash implements PPFrame {
* @param bool $level
* @return array|bool|string
*/
* @param bool $level
* @return array|bool|string
*/
- function getPDBK( $level = false ) {
+
public
function getPDBK( $level = false ) {
if ( $level === false ) {
return $this->title->getPrefixedDBkey();
} else {
if ( $level === false ) {
return $this->title->getPrefixedDBkey();
} else {
@@
-1346,21
+1373,21
@@
class PPFrame_Hash implements PPFrame {
/**
* @return array
*/
/**
* @return array
*/
- function getArguments() {
+
public
function getArguments() {
return array();
}
/**
* @return array
*/
return array();
}
/**
* @return array
*/
- function getNumberedArguments() {
+
public
function getNumberedArguments() {
return array();
}
/**
* @return array
*/
return array();
}
/**
* @return array
*/
- function getNamedArguments() {
+
public
function getNamedArguments() {
return array();
}
return array();
}
@@
-1369,7
+1396,7
@@
class PPFrame_Hash implements PPFrame {
*
* @return bool
*/
*
* @return bool
*/
- function isEmpty() {
+
public
function isEmpty() {
return true;
}
return true;
}
@@
-1377,7
+1404,7
@@
class PPFrame_Hash implements PPFrame {
* @param string $name
* @return bool
*/
* @param string $name
* @return bool
*/
- function getArgument( $name ) {
+
public
function getArgument( $name ) {
return false;
}
return false;
}
@@
-1388,7
+1415,7
@@
class PPFrame_Hash implements PPFrame {
*
* @return bool
*/
*
* @return bool
*/
- function loopCheck( $title ) {
+
public
function loopCheck( $title ) {
return !isset( $this->loopCheckHash[$title->getPrefixedDBkey()] );
}
return !isset( $this->loopCheckHash[$title->getPrefixedDBkey()] );
}
@@
-1397,7
+1424,7
@@
class PPFrame_Hash implements PPFrame {
*
* @return bool
*/
*
* @return bool
*/
- function isTemplate() {
+
public
function isTemplate() {
return false;
}
return false;
}
@@
-1406,7
+1433,7
@@
class PPFrame_Hash implements PPFrame {
*
* @return Title
*/
*
* @return Title
*/
- function getTitle() {
+
public
function getTitle() {
return $this->title;
}
return $this->title;
}
@@
-1415,7
+1442,7
@@
class PPFrame_Hash implements PPFrame {
*
* @param bool $flag
*/
*
* @param bool $flag
*/
- function setVolatile( $flag = true ) {
+
public
function setVolatile( $flag = true ) {
$this->volatile = $flag;
}
$this->volatile = $flag;
}
@@
-1424,7
+1451,7
@@
class PPFrame_Hash implements PPFrame {
*
* @return bool
*/
*
* @return bool
*/
- function isVolatile() {
+
public
function isVolatile() {
return $this->volatile;
}
return $this->volatile;
}
@@
-1433,7
+1460,7
@@
class PPFrame_Hash implements PPFrame {
*
* @param int $ttl
*/
*
* @param int $ttl
*/
- function setTTL( $ttl ) {
+
public
function setTTL( $ttl ) {
if ( $ttl !== null && ( $this->ttl === null || $ttl < $this->ttl ) ) {
$this->ttl = $ttl;
}
if ( $ttl !== null && ( $this->ttl === null || $ttl < $this->ttl ) ) {
$this->ttl = $ttl;
}
@@
-1444,7
+1471,7
@@
class PPFrame_Hash implements PPFrame {
*
* @return int|null
*/
*
* @return int|null
*/
- function getTTL() {
+
public
function getTTL() {
return $this->ttl;
}
}
return $this->ttl;
}
}
@@
-1452,10
+1479,13
@@
class PPFrame_Hash implements PPFrame {
/**
* Expansion frame with template arguments
* @ingroup Parser
/**
* Expansion frame with template arguments
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPTemplateFrame_Hash extends PPFrame_Hash {
*/
class PPTemplateFrame_Hash extends PPFrame_Hash {
- var $numberedArgs, $namedArgs, $parent;
- var $numberedExpansionCache, $namedExpansionCache;
+ // @codingStandardsIgnoreEnd
+
+ public $numberedArgs, $namedArgs, $parent;
+ public $numberedExpansionCache, $namedExpansionCache;
/**
* @param Preprocessor $preprocessor
/**
* @param Preprocessor $preprocessor
@@
-1464,7
+1494,7
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
* @param array $namedArgs
* @param bool|Title $title
*/
* @param array $namedArgs
* @param bool|Title $title
*/
- function __construct( $preprocessor, $parent = false, $numberedArgs = array(),
+
public
function __construct( $preprocessor, $parent = false, $numberedArgs = array(),
$namedArgs = array(), $title = false
) {
parent::__construct( $preprocessor );
$namedArgs = array(), $title = false
) {
parent::__construct( $preprocessor );
@@
-1484,7
+1514,7
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
$this->numberedExpansionCache = $this->namedExpansionCache = array();
}
$this->numberedExpansionCache = $this->namedExpansionCache = array();
}
- function __toString() {
+
public
function __toString() {
$s = 'tplframe{';
$first = true;
$args = $this->numberedArgs + $this->namedArgs;
$s = 'tplframe{';
$first = true;
$args = $this->numberedArgs + $this->namedArgs;
@@
-1504,11
+1534,11
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
/**
* @throws MWException
* @param string|int $key
/**
* @throws MWException
* @param string|int $key
- * @param string|PPNode
_Hash|DOMDocument
$root
+ * @param string|PPNode $root
* @param int $flags
* @return string
*/
* @param int $flags
* @return string
*/
- function cachedExpand( $key, $root, $flags = 0 ) {
+
public
function cachedExpand( $key, $root, $flags = 0 ) {
if ( isset( $this->parent->childExpansionCache[$key] ) ) {
return $this->parent->childExpansionCache[$key];
}
if ( isset( $this->parent->childExpansionCache[$key] ) ) {
return $this->parent->childExpansionCache[$key];
}
@@
-1524,14
+1554,14
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
*
* @return bool
*/
*
* @return bool
*/
- function isEmpty() {
+
public
function isEmpty() {
return !count( $this->numberedArgs ) && !count( $this->namedArgs );
}
/**
* @return array
*/
return !count( $this->numberedArgs ) && !count( $this->namedArgs );
}
/**
* @return array
*/
- function getArguments() {
+
public
function getArguments() {
$arguments = array();
foreach ( array_merge(
array_keys( $this->numberedArgs ),
$arguments = array();
foreach ( array_merge(
array_keys( $this->numberedArgs ),
@@
-1544,7
+1574,7
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
/**
* @return array
*/
/**
* @return array
*/
- function getNumberedArguments() {
+
public
function getNumberedArguments() {
$arguments = array();
foreach ( array_keys( $this->numberedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
$arguments = array();
foreach ( array_keys( $this->numberedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
@@
-1555,7
+1585,7
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
/**
* @return array
*/
/**
* @return array
*/
- function getNamedArguments() {
+
public
function getNamedArguments() {
$arguments = array();
foreach ( array_keys( $this->namedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
$arguments = array();
foreach ( array_keys( $this->namedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
@@
-1567,7
+1597,7
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
* @param int $index
* @return array|bool
*/
* @param int $index
* @return array|bool
*/
- function getNumberedArgument( $index ) {
+
public
function getNumberedArgument( $index ) {
if ( !isset( $this->numberedArgs[$index] ) ) {
return false;
}
if ( !isset( $this->numberedArgs[$index] ) ) {
return false;
}
@@
-1585,7
+1615,7
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
* @param string $name
* @return bool
*/
* @param string $name
* @return bool
*/
- function getNamedArgument( $name ) {
+
public
function getNamedArgument( $name ) {
if ( !isset( $this->namedArgs[$name] ) ) {
return false;
}
if ( !isset( $this->namedArgs[$name] ) ) {
return false;
}
@@
-1601,7
+1631,7
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
* @param string $name
* @return array|bool
*/
* @param string $name
* @return array|bool
*/
- function getArgument( $name ) {
+
public
function getArgument( $name ) {
$text = $this->getNumberedArgument( $name );
if ( $text === false ) {
$text = $this->getNamedArgument( $name );
$text = $this->getNumberedArgument( $name );
if ( $text === false ) {
$text = $this->getNamedArgument( $name );
@@
-1614,16
+1644,16
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
*
* @return bool
*/
*
* @return bool
*/
- function isTemplate() {
+
public
function isTemplate() {
return true;
}
return true;
}
- function setVolatile( $flag = true ) {
+
public
function setVolatile( $flag = true ) {
parent::setVolatile( $flag );
$this->parent->setVolatile( $flag );
}
parent::setVolatile( $flag );
$this->parent->setVolatile( $flag );
}
- function setTTL( $ttl ) {
+
public
function setTTL( $ttl ) {
parent::setTTL( $ttl );
$this->parent->setTTL( $ttl );
}
parent::setTTL( $ttl );
$this->parent->setTTL( $ttl );
}
@@
-1632,16
+1662,19
@@
class PPTemplateFrame_Hash extends PPFrame_Hash {
/**
* Expansion frame with custom arguments
* @ingroup Parser
/**
* Expansion frame with custom arguments
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPCustomFrame_Hash extends PPFrame_Hash {
*/
class PPCustomFrame_Hash extends PPFrame_Hash {
- var $args;
+ // @codingStandardsIgnoreEnd
- function __construct( $preprocessor, $args ) {
+ public $args;
+
+ public function __construct( $preprocessor, $args ) {
parent::__construct( $preprocessor );
$this->args = $args;
}
parent::__construct( $preprocessor );
$this->args = $args;
}
- function __toString() {
+
public
function __toString() {
$s = 'cstmframe{';
$first = true;
foreach ( $this->args as $name => $value ) {
$s = 'cstmframe{';
$first = true;
foreach ( $this->args as $name => $value ) {
@@
-1660,7
+1693,7
@@
class PPCustomFrame_Hash extends PPFrame_Hash {
/**
* @return bool
*/
/**
* @return bool
*/
- function isEmpty() {
+
public
function isEmpty() {
return !count( $this->args );
}
return !count( $this->args );
}
@@
-1668,30
+1701,33
@@
class PPCustomFrame_Hash extends PPFrame_Hash {
* @param int $index
* @return bool
*/
* @param int $index
* @return bool
*/
- function getArgument( $index ) {
+
public
function getArgument( $index ) {
if ( !isset( $this->args[$index] ) ) {
return false;
}
return $this->args[$index];
}
if ( !isset( $this->args[$index] ) ) {
return false;
}
return $this->args[$index];
}
- function getArguments() {
+
public
function getArguments() {
return $this->args;
}
}
/**
* @ingroup Parser
return $this->args;
}
}
/**
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPNode_Hash_Tree implements PPNode {
*/
class PPNode_Hash_Tree implements PPNode {
- var $name, $firstChild, $lastChild, $nextSibling;
+ // @codingStandardsIgnoreEnd
+
+ public $name, $firstChild, $lastChild, $nextSibling;
- function __construct( $name ) {
+
public
function __construct( $name ) {
$this->name = $name;
$this->firstChild = $this->lastChild = $this->nextSibling = false;
}
$this->name = $name;
$this->firstChild = $this->lastChild = $this->nextSibling = false;
}
- function __toString() {
+
public
function __toString() {
$inner = '';
$attribs = '';
for ( $node = $this->firstChild; $node; $node = $node->nextSibling ) {
$inner = '';
$attribs = '';
for ( $node = $this->firstChild; $node; $node = $node->nextSibling ) {
@@
-1713,13
+1749,13
@@
class PPNode_Hash_Tree implements PPNode {
* @param string $text
* @return PPNode_Hash_Tree
*/
* @param string $text
* @return PPNode_Hash_Tree
*/
- static function newWithText( $name, $text ) {
+
public
static function newWithText( $name, $text ) {
$obj = new self( $name );
$obj->addChild( new PPNode_Hash_Text( $text ) );
return $obj;
}
$obj = new self( $name );
$obj->addChild( new PPNode_Hash_Text( $text ) );
return $obj;
}
- function addChild( $node ) {
+
public
function addChild( $node ) {
if ( $this->lastChild === false ) {
$this->firstChild = $this->lastChild = $node;
} else {
if ( $this->lastChild === false ) {
$this->firstChild = $this->lastChild = $node;
} else {
@@
-1731,7
+1767,7
@@
class PPNode_Hash_Tree implements PPNode {
/**
* @return PPNode_Hash_Array
*/
/**
* @return PPNode_Hash_Array
*/
- function getChildren() {
+
public
function getChildren() {
$children = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
$children[] = $child;
$children = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
$children[] = $child;
@@
-1739,15
+1775,15
@@
class PPNode_Hash_Tree implements PPNode {
return new PPNode_Hash_Array( $children );
}
return new PPNode_Hash_Array( $children );
}
- function getFirstChild() {
+
public
function getFirstChild() {
return $this->firstChild;
}
return $this->firstChild;
}
- function getNextSibling() {
+
public
function getNextSibling() {
return $this->nextSibling;
}
return $this->nextSibling;
}
- function getChildrenOfType( $name ) {
+
public
function getChildrenOfType( $name ) {
$children = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( isset( $child->name ) && $child->name === $name ) {
$children = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( isset( $child->name ) && $child->name === $name ) {
@@
-1760,7
+1796,7
@@
class PPNode_Hash_Tree implements PPNode {
/**
* @return bool
*/
/**
* @return bool
*/
- function getLength() {
+
public
function getLength() {
return false;
}
return false;
}
@@
-1768,14
+1804,14
@@
class PPNode_Hash_Tree implements PPNode {
* @param int $i
* @return bool
*/
* @param int $i
* @return bool
*/
- function item( $i ) {
+
public
function item( $i ) {
return false;
}
/**
* @return string
*/
return false;
}
/**
* @return string
*/
- function getName() {
+
public
function getName() {
return $this->name;
}
return $this->name;
}
@@
-1788,7
+1824,7
@@
class PPNode_Hash_Tree implements PPNode {
* @throws MWException
* @return array
*/
* @throws MWException
* @return array
*/
- function splitArg() {
+
public
function splitArg() {
$bits = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( !isset( $child->name ) ) {
$bits = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( !isset( $child->name ) ) {
@@
-1822,7
+1858,7
@@
class PPNode_Hash_Tree implements PPNode {
* @throws MWException
* @return array
*/
* @throws MWException
* @return array
*/
- function splitExt() {
+
public
function splitExt() {
$bits = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( !isset( $child->name ) ) {
$bits = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( !isset( $child->name ) ) {
@@
-1850,7
+1886,7
@@
class PPNode_Hash_Tree implements PPNode {
* @throws MWException
* @return array
*/
* @throws MWException
* @return array
*/
- function splitHeading() {
+
public
function splitHeading() {
if ( $this->name !== 'h' ) {
throw new MWException( 'Invalid h node passed to ' . __METHOD__ );
}
if ( $this->name !== 'h' ) {
throw new MWException( 'Invalid h node passed to ' . __METHOD__ );
}
@@
-1877,7
+1913,7
@@
class PPNode_Hash_Tree implements PPNode {
* @throws MWException
* @return array
*/
* @throws MWException
* @return array
*/
- function splitTemplate() {
+
public
function splitTemplate() {
$parts = array();
$bits = array( 'lineStart' => '' );
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
$parts = array();
$bits = array( 'lineStart' => '' );
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
@@
-1904,169
+1940,178
@@
class PPNode_Hash_Tree implements PPNode {
/**
* @ingroup Parser
/**
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPNode_Hash_Text implements PPNode {
*/
class PPNode_Hash_Text implements PPNode {
- var $value, $nextSibling;
+ // @codingStandardsIgnoreEnd
- function __construct( $value ) {
+ public $value, $nextSibling;
+
+ public function __construct( $value ) {
if ( is_object( $value ) ) {
throw new MWException( __CLASS__ . ' given object instead of string' );
}
$this->value = $value;
}
if ( is_object( $value ) ) {
throw new MWException( __CLASS__ . ' given object instead of string' );
}
$this->value = $value;
}
- function __toString() {
+
public
function __toString() {
return htmlspecialchars( $this->value );
}
return htmlspecialchars( $this->value );
}
- function getNextSibling() {
+
public
function getNextSibling() {
return $this->nextSibling;
}
return $this->nextSibling;
}
- function getChildren() {
+
public
function getChildren() {
return false;
}
return false;
}
- function getFirstChild() {
+
public
function getFirstChild() {
return false;
}
return false;
}
- function getChildrenOfType( $name ) {
+
public
function getChildrenOfType( $name ) {
return false;
}
return false;
}
- function getLength() {
+
public
function getLength() {
return false;
}
return false;
}
- function item( $i ) {
+
public
function item( $i ) {
return false;
}
return false;
}
- function getName() {
+
public
function getName() {
return '#text';
}
return '#text';
}
- function splitArg() {
+
public
function splitArg() {
throw new MWException( __METHOD__ . ': not supported' );
}
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitExt() {
+
public
function splitExt() {
throw new MWException( __METHOD__ . ': not supported' );
}
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitHeading() {
+
public
function splitHeading() {
throw new MWException( __METHOD__ . ': not supported' );
}
}
/**
* @ingroup Parser
throw new MWException( __METHOD__ . ': not supported' );
}
}
/**
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPNode_Hash_Array implements PPNode {
*/
class PPNode_Hash_Array implements PPNode {
- var $value, $nextSibling;
+ // @codingStandardsIgnoreEnd
+
+ public $value, $nextSibling;
- function __construct( $value ) {
+
public
function __construct( $value ) {
$this->value = $value;
}
$this->value = $value;
}
- function __toString() {
+
public
function __toString() {
return var_export( $this, true );
}
return var_export( $this, true );
}
- function getLength() {
+
public
function getLength() {
return count( $this->value );
}
return count( $this->value );
}
- function item( $i ) {
+
public
function item( $i ) {
return $this->value[$i];
}
return $this->value[$i];
}
- function getName() {
+
public
function getName() {
return '#nodelist';
}
return '#nodelist';
}
- function getNextSibling() {
+
public
function getNextSibling() {
return $this->nextSibling;
}
return $this->nextSibling;
}
- function getChildren() {
+
public
function getChildren() {
return false;
}
return false;
}
- function getFirstChild() {
+
public
function getFirstChild() {
return false;
}
return false;
}
- function getChildrenOfType( $name ) {
+
public
function getChildrenOfType( $name ) {
return false;
}
return false;
}
- function splitArg() {
+
public
function splitArg() {
throw new MWException( __METHOD__ . ': not supported' );
}
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitExt() {
+
public
function splitExt() {
throw new MWException( __METHOD__ . ': not supported' );
}
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitHeading() {
+
public
function splitHeading() {
throw new MWException( __METHOD__ . ': not supported' );
}
}
/**
* @ingroup Parser
throw new MWException( __METHOD__ . ': not supported' );
}
}
/**
* @ingroup Parser
+ * @codingStandardsIgnoreStart
*/
class PPNode_Hash_Attr implements PPNode {
*/
class PPNode_Hash_Attr implements PPNode {
- var $name, $value, $nextSibling;
+ // @codingStandardsIgnoreEnd
+
+ public $name, $value, $nextSibling;
- function __construct( $name, $value ) {
+
public
function __construct( $name, $value ) {
$this->name = $name;
$this->value = $value;
}
$this->name = $name;
$this->value = $value;
}
- function __toString() {
+
public
function __toString() {
return "<@{$this->name}>" . htmlspecialchars( $this->value ) . "</@{$this->name}>";
}
return "<@{$this->name}>" . htmlspecialchars( $this->value ) . "</@{$this->name}>";
}
- function getName() {
+
public
function getName() {
return $this->name;
}
return $this->name;
}
- function getNextSibling() {
+
public
function getNextSibling() {
return $this->nextSibling;
}
return $this->nextSibling;
}
- function getChildren() {
+
public
function getChildren() {
return false;
}
return false;
}
- function getFirstChild() {
+
public
function getFirstChild() {
return false;
}
return false;
}
- function getChildrenOfType( $name ) {
+
public
function getChildrenOfType( $name ) {
return false;
}
return false;
}
- function getLength() {
+
public
function getLength() {
return false;
}
return false;
}
- function item( $i ) {
+
public
function item( $i ) {
return false;
}
return false;
}
- function splitArg() {
+
public
function splitArg() {
throw new MWException( __METHOD__ . ': not supported' );
}
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitExt() {
+
public
function splitExt() {
throw new MWException( __METHOD__ . ': not supported' );
}
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitHeading() {
+
public
function splitHeading() {
throw new MWException( __METHOD__ . ': not supported' );
}
}
throw new MWException( __METHOD__ . ': not supported' );
}
}