/**
* @deprecated since 1.25
*/
-abstract class CdbReader extends \Cdb\Reader {}
+abstract class CdbReader extends \Cdb\Reader {
+}
/**
* @deprecated since 1.25
*/
-abstract class CdbWriter extends \Cdb\Writer {}
+abstract class CdbWriter extends \Cdb\Writer {
+}
/**
* @deprecated since 1.25
*/
-class CdbException extends \Cdb\Exception {}
+class CdbException extends \Cdb\Exception {
+}
return $this->pullFront( $key, $srchres );
}
$redirectTargetsToRedirect = $this->redirectTargetsToRedirect( $srchres );
- if ( isset( $redirectTargetsToRedirect[ $target ] ) ) {
+ if ( isset( $redirectTargetsToRedirect[$target] ) ) {
// The exact match and something in the results list are both redirects
// to the same thing! In this case we'll pull the returned match to the
// top following the same logic above. Again, it might not be a perfect
// choice but it'll do.
- return $this->pullFront( $redirectTargetsToRedirect[ $target ], $srchres );
+ return $this->pullFront( $redirectTargetsToRedirect[$target], $srchres );
}
} else {
$redirectTargetsToRedirect = $this->redirectTargetsToRedirect( $srchres );
- if ( isset( $redirectTargetsToRedirect[ $string ] ) ) {
+ if ( isset( $redirectTargetsToRedirect[$string] ) ) {
// The exact match is the target of a redirect already in the results list so remove
// the redirect from the results list and push the exact match to the front
- array_splice( $srchres, $redirectTargetsToRedirect[ $string ], 1 );
+ array_splice( $srchres, $redirectTargetsToRedirect[$string], 1 );
array_unshift( $srchres, $string );
return $srchres;
}
if ( !$target ) {
continue;
}
- $result[ $target ] = $key;
+ $result[$target] = $key;
}
return $result;
}
public function __toString() {
$status = $this->isOK() ? "OK" : "Error";
if ( count( $this->errors ) ) {
- $errorcount = "collected " . ( count($this->errors) ) . " error(s) on the way";
+ $errorcount = "collected " . ( count( $this->errors ) ) . " error(s) on the way";
} else {
$errorcount = "no errors detected";
}
$errorcount,
$valstr
);
- if ( count ($this->errors ) > 0 ) {
+ if ( count( $this->errors ) > 0 ) {
$hdr = sprintf( "+-%'-4s-+-%'-25s-+-%'-40s-+\n", "", "", "" );
$i = 1;
$out .= "\n";
$out .= $hdr;
- foreach( $this->getStatusArray() as $stat ) {
+ foreach ( $this->getStatusArray() as $stat ) {
$out .= sprintf( "| %4d | %-25.25s | %-40.40s |\n",
$i,
$stat[0],
- implode(" ", array_slice( $stat, 1 ) )
+ implode( " ", array_slice( $stat, 1 ) )
);
$i += 1;
}
}
public function getCustomPrinter() {
- switch( $this->getFormat() ) {
+ switch ( $this->getFormat() ) {
case 'json':
return $this->getMain()->createPrinterByName( 'json' . $this->fm );
$hasInterwikiResults = false;
$totalhits = null;
if ( $interwiki && $resultPageSet === null && $matches->hasInterwikiResults() ) {
- foreach( $matches->getInterwikiResults() as $matches ) {
+ foreach ( $matches->getInterwikiResults() as $matches ) {
$matches = $matches->getInterwikiResults();
$hasInterwikiResults = true;
use Cdb\Exception as CdbException;
use Cdb\Reader as CdbReader;
use Cdb\Writer as CdbWriter;
+
/**
* Class for caching the contents of localisation files, Messages*.php
* and *.i18n.php.
if ( $queryProf != '' ) {
$queryStartTime = microtime( true );
$queryProfile = new ScopedCallback(
- function() use ( $queryStartTime, $queryProf, $isMaster ) {
+ function () use ( $queryStartTime, $queryProf, $isMaster ) {
$trxProfiler = Profiler::instance()->getTransactionProfiler();
$trxProfiler->recordQueryCompletion( $queryProf, $queryStartTime, $isMaster );
}
* @param array $args
*/
private function forEachLBCallMethod( $methodName, array $args = array() ) {
- $this->forEachLB( function( LoadBalancer $loadBalancer, $methodName, array $args ) {
+ $this->forEachLB( function ( LoadBalancer $loadBalancer, $methodName, array $args ) {
call_user_func_array( array( $loadBalancer, $methodName ), $args );
}, array( $methodName, $args ) );
}
wfDebugLog( 'FSFileBackend', __METHOD__ . ": cannot create directory $dir" );
$status->fatal( 'directorycreateerror', $params['dir'] ); // fails on races
} elseif ( !is_writable( $dir ) ) {
- wfDebugLog( 'FSFileBackend', __METHOD__ . ": directory $dir is read-only" );
+ wfDebugLog( 'FSFileBackend', __METHOD__ . ": directory $dir is read-only" );
$status->fatal( 'directoryreadonlyerror', $params['dir'] );
} elseif ( !is_readable( $dir ) ) {
- wfDebugLog( 'FSFileBackend', __METHOD__ . ": directory $dir is not readable" );
+ wfDebugLog( 'FSFileBackend', __METHOD__ . ": directory $dir is not readable" );
$status->fatal( 'directorynotreadableerror', $params['dir'] );
}
$this->untrapWarnings();
$out = $wgProfiler['output'];
if ( $out === 'db' ) {
$profileToDb = true;
- } elseif( is_array( $out ) && in_array( 'db', $out ) ) {
+ } elseif ( is_array( $out ) && in_array( 'db', $out ) ) {
$profileToDb = true;
}
}
</div>
<?php
$message = wfMessage( 'config-sidebar' )->plain();
- foreach( explode( '----', $message ) as $section ) {
+ foreach ( explode( '----', $message ) as $section ) {
echo '<div class="portal"><div class="body">';
echo $this->parent->parse( $section, true );
echo '</div></div>';
$src_image = call_user_func( $loader, $params['srcPath'] );
- $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ? $this->getRotation( $image ) : 0;
+ $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ? $this->getRotation( $image ) : 0;
list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation );
$dst_image = imagecreatetruecolor( $width, $height );
if ( $wgTidyInternal ) {
if ( wfIsHHVM() ) {
if ( $stderr ) {
- throw new MWException( __METHOD__.": error text return from HHVM tidy is not supported" );
+ throw new MWException( __METHOD__ . ": error text return from HHVM tidy is not supported" );
}
return self::hhvmClean( $text, $retval );
} else {
// Add on template profiling data
$dataByFunc = $this->mProfiler->getFunctionStats();
- uasort( $dataByFunc, function( $a, $b ) {
+ uasort( $dataByFunc, function ( $a, $b ) {
return $a['real'] < $b['real']; // descending order
} );
$profileReport = "Transclusion expansion time report (%,ms,calls,template)\n";
foreach ( array_slice( $dataByFunc, 0, 10 ) as $item ) {
$profileReport .= sprintf( "%6.2f%% %8.3f %6d - %s\n",
$item['%real'], $item['real'], $item['calls'],
- htmlspecialchars($item['name'] ) );
+ htmlspecialchars( $item['name'] ) );
}
$text .= "\n<!-- \n$profileReport-->\n";
$this->profileIn( $section );
$that = $this;
- return new ScopedCallback( function() use ( $that, $section ) {
+ return new ScopedCallback( function () use ( $that, $section ) {
$that->profileOut( $section );
} );
}
}
public function scopedProfileIn( $section ) {
- return new ScopedCallback( function() {
+ return new ScopedCallback( function () {
// no-op
} );
}
if ( $exists ) {
xhprof_frame_begin( $section );
- return new ScopedCallback( function() {
+ return new ScopedCallback( function () {
xhprof_frame_end();
} );
}
- return new ScopedCallback( function() {
+ return new ScopedCallback( function () {
// no-op
} );
}
$this->profileInInternal( $section );
$that = $this;
- return new ScopedCallback( function() use ( $that, $section ) {
+ return new ScopedCallback( function () use ( $that, $section ) {
$that->profileOutInternal( $section );
} );
}
// Initialize per-host profiling from config, back-compat if available
if ( isset( $this->params['perHost'] ) ) {
$this->perHost = $this->params['perHost'];
- } elseif( $wgProfilePerHost ) {
+ } elseif ( $wgProfilePerHost ) {
$this->perHost = $wgProfilePerHost;
}
}
// Filter out really tiny entries
$min = $this->thresholdMs;
- $stats = array_filter( $stats, function( $a ) use ( $min ) {
+ $stats = array_filter( $stats, function ( $a ) use ( $min ) {
return $a['real'] > $min;
} );
// Sort descending by time elapsed
- usort( $stats, function( $a, $b ) {
+ usort( $stats, function ( $a, $b ) {
return $a['real'] < $b['real'];
} );
// Initialize port, host, and format from config, back-compat if available
if ( isset( $this->params['udpport'] ) ) {
$this->port = $this->params['udpport'];
- } elseif( $wgUDPProfilerPort ) {
+ } elseif ( $wgUDPProfilerPort ) {
$this->port = $wgUDPProfilerPort;
}
if ( isset( $this->params['udphost'] ) ) {
$this->host = $this->params['udphost'];
- } elseif( $wgUDPProfilerHost ) {
+ } elseif ( $wgUDPProfilerHost ) {
$this->host = $wgUDPProfilerHost;
}
if ( isset( $this->params['udpformat'] ) ) {
$this->format = $this->params['udpformat'];
- } elseif( $wgUDPProfilerFormatString ) {
+ } elseif ( $wgUDPProfilerFormatString ) {
$this->format = $wgUDPProfilerFormatString;
}
}
$sites = new SiteList();
// @todo lazy initialize the site objects in the site list (e.g. only when needed to access)
- foreach( $data['sites'] as $siteArray ) {
+ foreach ( $data['sites'] as $siteArray ) {
$sites[] = $this->newSiteFromArray( $siteArray );
}
$site->setExtraData( $data['data'] );
$site->setExtraConfig( $data['config'] );
- foreach( $data['identifiers'] as $identifier ) {
+ foreach ( $data['identifiers'] as $identifier ) {
$site->addLocalId( $identifier['type'], $identifier['key'] );
}
$siteIdentifiers = $this->buildLocalIdentifiers( $site );
$identifiersArray = array();
- foreach( $siteIdentifiers as $identifier ) {
+ foreach ( $siteIdentifiers as $identifier ) {
$identifiersArray[] = $identifier;
}
if ( is_string( $token ) ) {
return;
}
- switch( $token[0] ) {
+ switch ( $token[0] ) {
case T_NAMESPACE:
case T_CLASS:
case T_INTERFACE:
* @param array
*/
protected function tryEndExpect( $token ) {
- switch( $this->startToken[0] ) {
+ switch ( $this->startToken[0] ) {
case T_NAMESPACE:
if ( $token === ';' || $token === '{' ) {
$this->namespace = $this->implodeTokens() . '\\';
$this->thisPage .= $data;
}
}
- elseif ( $this->lastName == "model" ) {
+ elseif ( $this->lastName == "model" ) {
$this->thisRevModel .= $data;
}
- elseif ( $this->lastName == "format" ) {
+ elseif ( $this->lastName == "format" ) {
$this->thisRevFormat .= $data;
}
$this->insertPage( 'Example Foo/Bar' );
$this->insertPage( 'Example/Baz' );
$this->insertPage( 'Redirect test', '#REDIRECT [[Redirect Test]]' );
- $this->insertPage( 'Redirect Test');
- $this->insertPage( 'Redirect Test Worse Result');
+ $this->insertPage( 'Redirect Test' );
+ $this->insertPage( 'Redirect Test Worse Result' );
$this->insertPage( 'Redirect test2', '#REDIRECT [[Redirect Test2]]' );
$this->insertPage( 'Redirect TEST2', '#REDIRECT [[Redirect Test2]]' );
- $this->insertPage( 'Redirect Test2');
- $this->insertPage( 'Redirect Test2 Worse Result');
+ $this->insertPage( 'Redirect Test2' );
+ $this->insertPage( 'Redirect Test2 Worse Result' );
$this->insertPage( 'Talk:Sandbox' );
$this->insertPage( 'Talk:Example' );
array_shift( $case['results'] );
// And sometimes we expect a different last result
$expected = isset( $case['offsetresult'] ) ?
- array_merge( $case['results'], $case['offsetresult'] ):
+ array_merge( $case['results'], $case['offsetresult'] ) :
$case['results'];
$this->assertEquals(
$out = $wgProfiler['output'];
if ( $out === 'db' ) {
$profileToDb = true;
- } elseif( is_array( $out ) && in_array( 'db', $out ) ) {
+ } elseif ( is_array( $out ) && in_array( 'db', $out ) ) {
$profileToDb = true;
}
}
'multiValue' => array( array( 'first', 'second', 'third', '_type' => 'ol' ), 'first' ),
'noType' => array( array( 'first', 'second', 'third' ), 'first' ),
'typeFirst' => array( array( '_type' => 'ol', 'first', 'second', 'third' ), 'first' ),
- 'multilang' => array(
- array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
- array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
- ),
- 'multilang-multivalue' => array(
- array( 'en' => array( 'first', 'second' ), 'de' => array( 'Erste', 'Zweite' ), '_type' => 'lang' ),
- array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
- ),
+ 'multilang' => array(
+ array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
+ array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
+ ),
+ 'multilang-multivalue' => array(
+ array( 'en' => array( 'first', 'second' ), 'de' => array( 'Erste', 'Zweite' ), '_type' => 'lang' ),
+ array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
+ ),
);
}
}
return strtoupper( $text );
}
-}
\ No newline at end of file
+}