Fix CodeSniffer errors and warnings (you guessed it, on API classes)

Change-Id: I56f9632975d53bdfe33ff9412e1a4ba010bdb2aa
This commit is contained in:
Siebrand Mazeland 2013-11-14 15:18:38 +01:00 committed by Chad
parent e96c27a732
commit 770f2a2d41
8 changed files with 56 additions and 23 deletions

View file

@ -164,7 +164,8 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
return array(
'limit' => 'How many images to return',
'continue' => 'When more results are available, use this to continue',
'images' => 'Only list these images. Useful for checking whether a certain page has a certain Image.',
'images' => 'Only list these images. Useful for checking whether a ' .
'certain page has a certain Image.',
'dir' => 'The direction in which to list',
);
}
@ -184,8 +185,10 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
public function getExamples() {
return array(
'api.php?action=query&prop=images&titles=Main%20Page' => 'Get a list of images used in the [[Main Page]]',
'api.php?action=query&generator=images&titles=Main%20Page&prop=info' => 'Get information about all images used in the [[Main Page]]',
'api.php?action=query&prop=images&titles=Main%20Page'
=> 'Get a list of images used in the [[Main Page]]',
'api.php?action=query&generator=images&titles=Main%20Page&prop=info'
=> 'Get information about all images used in the [[Main Page]]',
);
}

View file

@ -42,7 +42,8 @@ class ApiQueryInfo extends ApiQueryBase {
private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
$pageLatest, $pageLength;
private $protections, $watched, $watchers, $notificationtimestamps, $talkids, $subjectids, $displaytitles;
private $protections, $watched, $watchers, $notificationtimestamps,
$talkids, $subjectids, $displaytitles;
private $showZeroWatchers = false;
private $tokenFunctions;
@ -349,7 +350,8 @@ class ApiQueryInfo extends ApiQueryBase {
*/
private function extractPageInfo( $pageid, $title ) {
$pageInfo = array();
$titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects
// $title->exists() needs pageid, which is not set for all title objects
$titleExists = $pageid > 0;
$ns = $title->getNamespace();
$dbkey = $title->getDBkey();
@ -411,7 +413,8 @@ class ApiQueryInfo extends ApiQueryBase {
if ( $this->fld_notificationtimestamp ) {
$pageInfo['notificationtimestamp'] = '';
if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) {
$pageInfo['notificationtimestamp'] = wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
$pageInfo['notificationtimestamp'] =
wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
}
}
@ -698,7 +701,8 @@ class ApiQueryInfo extends ApiQueryBase {
$this->watched[$row->wl_namespace][$row->wl_title] = true;
}
if ( $this->fld_notificationtimestamp ) {
$this->notificationtimestamps[$row->wl_namespace][$row->wl_title] = $row->wl_notificationtimestamp;
$this->notificationtimestamps[$row->wl_namespace][$row->wl_title] =
$row->wl_notificationtimestamp;
}
}
}

View file

@ -112,9 +112,13 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
$result = $this->getResult();
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// Continue string preserved in case the redirect query doesn't pass the limit
$this->setContinueEnumParameter( 'continue', "{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}" );
// We've reached the one extra which shows that there are
// additional pages to be had. Stop here... Continue string
// preserved in case the redirect query doesn't pass the limit.
$this->setContinueEnumParameter(
'continue',
"{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}"
);
break;
}
@ -140,7 +144,10 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
$fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $entry );
if ( !$fit ) {
$this->setContinueEnumParameter( 'continue', "{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}" );
$this->setContinueEnumParameter(
'continue',
"{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}"
);
break;
}
}

View file

@ -182,7 +182,8 @@ class ApiQueryLangLinks extends ApiQueryBase {
public function getExamples() {
return array(
'api.php?action=query&prop=langlinks&titles=Main%20Page&redirects=' => 'Get interlanguage links from the [[Main Page]]',
'api.php?action=query&prop=langlinks&titles=Main%20Page&redirects='
=> 'Get interlanguage links from the [[Main Page]]',
);
}

View file

@ -43,7 +43,8 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
$this->prefix = 'pl';
$this->description = 'link';
$this->titlesParam = 'titles';
$this->titlesParamDescription = 'Only list links to these titles. Useful for checking whether a certain page links to a certain title.';
$this->titlesParamDescription = 'Only list links to these titles. Useful ' .
'for checking whether a certain page links to a certain title.';
$this->helpUrl = 'https://www.mediawiki.org/wiki/API:Properties#links_.2F_pl';
break;
case self::TEMPLATES:
@ -51,7 +52,8 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
$this->prefix = 'tl';
$this->description = 'template';
$this->titlesParam = 'templates';
$this->titlesParamDescription = 'Only list these templates. Useful for checking whether a certain page uses a certain template.';
$this->titlesParamDescription = 'Only list these templates. Useful ' .
'for checking whether a certain page uses a certain template.';
$this->helpUrl = 'https://www.mediawiki.org/wiki/API:Properties#templates_.2F_tl';
break;
default:
@ -241,8 +243,10 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
return array(
"api.php?action=query&prop={$name}&titles=Main%20Page" => "Get {$desc}s from the [[Main Page]]",
"api.php?action=query&generator={$name}&titles=Main%20Page&prop=info" => "Get information about the {$desc} pages in the [[Main Page]]",
"api.php?action=query&prop={$name}&titles=Main%20Page&{$this->prefix}namespace=2|10" => "Get {$desc}s from the Main Page in the User and Template namespaces",
"api.php?action=query&generator={$name}&titles=Main%20Page&prop=info"
=> "Get information about the {$desc} pages in the [[Main Page]]",
"api.php?action=query&prop={$name}&titles=Main%20Page&{$this->prefix}namespace=2|10"
=> "Get {$desc}s from the Main Page in the User and Template namespaces",
);
}

View file

@ -84,7 +84,10 @@ class ApiQueryLogEvents extends ApiQueryBase {
$this->addFieldsIf( array( 'log_id', 'page_id' ), $this->fld_ids );
$this->addFieldsIf( array( 'log_user', 'log_user_text', 'user_name' ), $this->fld_user );
$this->addFieldsIf( 'log_user', $this->fld_userid );
$this->addFieldsIf( array( 'log_namespace', 'log_title' ), $this->fld_title || $this->fld_parsedcomment );
$this->addFieldsIf(
array( 'log_namespace', 'log_title' ),
$this->fld_title || $this->fld_parsedcomment
);
$this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment );
$this->addFieldsIf( 'log_params', $this->fld_details );
@ -96,7 +99,8 @@ class ApiQueryLogEvents extends ApiQueryBase {
if ( !is_null( $params['tag'] ) ) {
$this->addTables( 'change_tag' );
$this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'log_id=ct_log_id' ) ) ) );
$this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN',
array( 'log_id=ct_log_id' ) ) ) );
$this->addWhereFld( 'ct_tag', $params['tag'] );
$index['change_tag'] = 'change_tag_tag_id';
}
@ -110,7 +114,12 @@ class ApiQueryLogEvents extends ApiQueryBase {
$index['logging'] = 'type_time';
}
$this->addTimestampWhereRange( 'log_timestamp', $params['dir'], $params['start'], $params['end'] );
$this->addTimestampWhereRange(
'log_timestamp',
$params['dir'],
$params['start'],
$params['end']
);
$limit = $params['limit'];
$this->addOption( 'LIMIT', $limit + 1 );
@ -169,7 +178,8 @@ class ApiQueryLogEvents extends ApiQueryBase {
$result = $this->getResult();
foreach ( $res as $row ) {
if ( ++$count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// We've reached the one extra which shows that there are
// additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->log_timestamp ) );
break;
}
@ -197,7 +207,9 @@ class ApiQueryLogEvents extends ApiQueryBase {
* @param $legacy bool
* @return array
*/
public static function addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy = false ) {
public static function addLogParams( $result, &$vals, $params, $type,
$action, $ts, $legacy = false
) {
switch ( $type ) {
case 'move':
if ( $legacy ) {

View file

@ -63,7 +63,8 @@ class ApiQueryPagePropNames extends ApiQueryBase {
$count = 0;
foreach ( $this->select( __METHOD__ ) as $row ) {
if ( ++$count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// We've reached the one extra which shows that there are
// additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'continue', $row->pp_propname );
break;
}

View file

@ -135,7 +135,8 @@ class ApiQueryPageProps extends ApiQueryBase {
public function getParamDescription() {
return array(
'continue' => 'When more results are available, use this to continue',
'prop' => 'Only list these props. Useful for checking whether a certain page uses a certain page prop',
'prop' => 'Only list these props. Useful for checking whether a ' .
'certain page uses a certain page prop',
);
}