* @param $args array
* @return PPCustomFrame_HipHop
*/
- function newCustomFrame( array $args ) {
+ function newCustomFrame( $args ) {
return new PPCustomFrame_HipHop( $this, $args );
}
* @throws MWException
* @return PPNode_HipHop_Tree
*/
- function preprocessToObj( string $text, int $flags = 0 ) {
+ function preprocessToObj( $text, $flags = 0 ) {
wfProfileIn( __METHOD__ );
// Check cache.
if ( $cacheable ) {
wfProfileIn( __METHOD__.'-cacheable' );
- $cacheKey = strval( wfMemcKey( 'preprocess-hash', md5($text), $flags ) );
+ $cacheKey = strval( wfMemcKey( 'preprocess-hash', md5( $text ), $flags ) );
$cacheValue = strval( $wgMemc->get( $cacheKey ) );
if ( $cacheValue !== '' ) {
$version = substr( $cacheValue, 0, 8 );
if ( $stack->top ) {
$part = $stack->getTop()->getCurrentPart();
- if ( ! (isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) {
+ if ( !(isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) {
$part->visualEnd = $wsStart;
}
// Else comments abutting, no change in visual end
}
// <includeonly> and <noinclude> just become <ignore> tags
if ( in_array( $lowerName, $ignoredElements ) ) {
- $accum->addNodeWithText( 'ignore', strval( substr( $text, $tagStartPos, $i - $tagStartPos ) ) );
+ $accum->addNodeWithText( 'ignore', strval( substr( $text, $tagStartPos, $i - $tagStartPos ) ) );
continue;
}
}
}
- if ($matchingCount <= 0) {
+ if ( $matchingCount <= 0 ) {
# No matching element found in callback array
# Output a literal closing brace and continue
$accum->addLiteral( str_repeat( $curChar, $count ) );
$accum = $stack->getAccum();
# Re-add the old stack element if it still has unmatched opening characters remaining
- if ($matchingCount < $piece->count) {
+ if ( $matchingCount < $piece->count ) {
$piece->parts = array( new PPDPart_HipHop );
$piece->count -= $matchingCount;
# do we still qualify for any callback with remaining count?
$rootNode->lastChild = $stack->rootAccum->lastNode;
// Cache
- if ($cacheable) {
+ if ( $cacheable ) {
$cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode );
$wgMemc->set( $cacheKey, $cacheValue, 86400 );
wfProfileOut( __METHOD__.'-cache-miss' );
* @return PPDAccum_HipHop
*/
function getAccum() {
- return PPDAccum_HipHop::cast( $this->parts[count($this->parts) - 1]->out );
+ return PPDAccum_HipHop::cast( $this->parts[count( $this->parts ) - 1]->out );
}
/**
* @return PPDPart_HipHop
*/
function getCurrentPart() {
- return PPDPart_HipHop::cast( $this->parts[count($this->parts) - 1] );
+ return PPDPart_HipHop::cast( $this->parts[count( $this->parts ) - 1] );
}
/**
*
* @param $args PPNode_HipHop_Array|array|bool
* @param $title Title|bool
+ * @param $indexOffset A number subtracted from the index attributes of the arguments
*
* @throws MWException
* @return PPTemplateFrame_HipHop
*/
- function newChild( $args = false, $title = false ) {
+ function newChild( $args = false, $title = false, $indexOffset = 0 ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
}
# Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result
# Not in RECOVER_COMMENTS mode (extractSections) though
- elseif ( $this->parser->ot['wiki'] && ! ( $flags & PPFrame::RECOVER_COMMENTS ) ) {
+ elseif ( $this->parser->ot['wiki'] && !( $flags & PPFrame::RECOVER_COMMENTS ) ) {
$out .= $this->parser->insertStripItem( $contextNode->firstChild->value );
}
# Recover the literal comment in RECOVER_COMMENTS and pre+no-remove
*/
function getNumberedArguments() {
$arguments = array();
- foreach ( array_keys($this->numberedArgs) as $key ) {
- $arguments[$key] = $this->getArgument($key);
+ foreach ( array_keys( $this->numberedArgs ) as $key ) {
+ $arguments[$key] = $this->getArgument( $key );
}
return $arguments;
}
*/
function getNamedArguments() {
$arguments = array();
- foreach ( array_keys($this->namedArgs) as $key ) {
- $arguments[$key] = $this->getArgument($key);
+ foreach ( array_keys( $this->namedArgs ) as $key ) {
+ $arguments[$key] = $this->getArgument( $key );
}
return $arguments;
}
/**
* Split a <template> or <tplarg> node
*
+ * @throws MWException
* @return array
*/
function splitTemplate() {