r87465 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87464‎ | r87465 | r87466 >
Date:22:53, 4 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
use of self instead of ClassName in static method/property calls
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -34,14 +34,14 @@
3535 *
3636 * @return SMWQuery
3737 */
38 - static public function createQuery( $querystring, array $params, $context = SMWQueryProcessor::INLINE_QUERY, $format = '', $extraprintouts = array() ) {
 38+ static public function createQuery( $querystring, array $params, $context = self::INLINE_QUERY, $format = '', $extraprintouts = array() ) {
3939 global $smwgQDefaultNamespaces, $smwgQFeatures, $smwgQConceptFeatures;
4040 if ( $format == '' ) {
41 - $format = SMWQueryProcessor::getResultFormat( $params );
 41+ $format = self::getResultFormat( $params );
4242 }
4343
4444 // parse query:
45 - $queryfeatures = ( $context == SMWQueryProcessor::CONCEPT_DESC ) ? $smwgQConceptFeatures : $smwgQFeatures;
 45+ $queryfeatures = ( $context == self::CONCEPT_DESC ) ? $smwgQConceptFeatures : $smwgQFeatures;
4646 $qp = new SMWQueryParser( $queryfeatures );
4747 $qp->setDefaultNamespaces( $smwgQDefaultNamespaces );
4848 $desc = $qp->getQueryDescription( $querystring );
@@ -51,7 +51,7 @@
5252 } elseif ( $format == 'debug' ) {
5353 $querymode = SMWQuery::MODE_DEBUG;
5454 } else {
55 - $printer = SMWQueryProcessor::getResultPrinter( $format, $context );
 55+ $printer = self::getResultPrinter( $format, $context );
5656 $querymode = $printer->getQueryMode( $context );
5757 }
5858
@@ -62,7 +62,7 @@
6363 $desc->prependPrintRequest( new SMWPrintRequest( SMWPrintRequest::PRINT_THIS, $mainlabel ) );
6464 }
6565
66 - $query = new SMWQuery( $desc, ( $context != SMWQueryProcessor::SPECIAL_PAGE ), ( $context == SMWQueryProcessor::CONCEPT_DESC ) );
 66+ $query = new SMWQuery( $desc, ( $context != self::SPECIAL_PAGE ), ( $context == self::CONCEPT_DESC ) );
6767 $query->setQueryString( $querystring );
6868 $query->setExtraPrintouts( $extraprintouts );
6969 $query->addErrors( $qp->getErrors() ); // keep parsing errors for later output
@@ -250,9 +250,9 @@
251251 * obtain actual parameters, printout requests, and the query string for
252252 * further processing.
253253 */
254 - static public function getResultFromFunctionParams( array $rawparams, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $showmode = false ) {
255 - SMWQueryProcessor::processFunctionParams( $rawparams, $querystring, $params, $printouts, $showmode );
256 - return SMWQueryProcessor::getResultFromQueryString( $querystring, $params, $printouts, SMW_OUTPUT_WIKI, $context );
 254+ static public function getResultFromFunctionParams( array $rawparams, $outputmode, $context = self::INLINE_QUERY, $showmode = false ) {
 255+ self::processFunctionParams( $rawparams, $querystring, $params, $printouts, $showmode );
 256+ return self::getResultFromQueryString( $querystring, $params, $printouts, SMW_OUTPUT_WIKI, $context );
257257 }
258258
259259 /**
@@ -263,19 +263,19 @@
264264 * certain general settings. Finally, $extraprintouts supplies additional
265265 * printout requests for the query results.
266266 */
267 - static public function getResultFromQueryString( $querystring, array $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY ) {
 267+ static public function getResultFromQueryString( $querystring, array $params, $extraprintouts, $outputmode, $context = self::INLINE_QUERY ) {
268268 wfProfileIn( 'SMWQueryProcessor::getResultFromQueryString (SMW)' );
269269
270 - $format = SMWQueryProcessor::getResultFormat( $params );
271 - $query = SMWQueryProcessor::createQuery( $querystring, $params, $context, $format, $extraprintouts );
272 - $result = SMWQueryProcessor::getResultFromQuery( $query, $params, $extraprintouts, $outputmode, $context, $format );
 270+ $format = self::getResultFormat( $params );
 271+ $query = self::createQuery( $querystring, $params, $context, $format, $extraprintouts );
 272+ $result = self::getResultFromQuery( $query, $params, $extraprintouts, $outputmode, $context, $format );
273273
274274 wfProfileOut( 'SMWQueryProcessor::getResultFromQueryString (SMW)' );
275275
276276 return $result;
277277 }
278278
279 - static public function getResultFromQuery( SMWQuery $query, array $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $format = '' ) {
 279+ static public function getResultFromQuery( SMWQuery $query, array $params, $extraprintouts, $outputmode, $context = self::INLINE_QUERY, $format = '' ) {
280280 wfProfileIn( 'SMWQueryProcessor::getResultFromQuery (SMW)' );
281281
282282 // Query routing allows extensions to provide alternative stores as data sources
@@ -296,10 +296,10 @@
297297 wfProfileIn( 'SMWQueryProcessor::getResultFromQuery-printout (SMW)' );
298298
299299 if ( $format == '' ) {
300 - $format = SMWQueryProcessor::getResultFormat( $params );
 300+ $format = self::getResultFormat( $params );
301301 }
302302
303 - $printer = SMWQueryProcessor::getResultPrinter( $format, $context, $res );
 303+ $printer = self::getResultPrinter( $format, $context, $res );
304304 $result = $printer->getResult( $res, $params, $outputmode );
305305
306306 wfProfileOut( 'SMWQueryProcessor::getResultFromQuery-printout (SMW)' );
@@ -379,7 +379,7 @@
380380 *
381381 * @return SMWResultPrinter
382382 */
383 - static public function getResultPrinter( $format, $context = SMWQueryProcessor::SPECIAL_PAGE ) {
 383+ static public function getResultPrinter( $format, $context = self::SPECIAL_PAGE ) {
384384 global $smwgResultFormats;
385385
386386 self::resolveFormatAliases( $format );
@@ -387,7 +387,7 @@
388388 // TODO: this seems to contain the same logic as found in getResultFormat - a single function for this might be better.
389389 $formatClass = array_key_exists( $format, $smwgResultFormats ) ? $smwgResultFormats[$format] : 'SMWAutoResultPrinter';
390390
391 - return new $formatClass( $format, ( $context != SMWQueryProcessor::SPECIAL_PAGE ) );
 391+ return new $formatClass( $format, ( $context != self::SPECIAL_PAGE ) );
392392 }
393393
394394 }
\ No newline at end of file

Status & tagging log