From 770f2a2d410ccfa70fc121fa0cf524cbfcb4bf43 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 14 Nov 2013 15:18:38 +0100 Subject: [PATCH] Fix CodeSniffer errors and warnings (you guessed it, on API classes) Change-Id: I56f9632975d53bdfe33ff9412e1a4ba010bdb2aa --- includes/api/ApiQueryImages.php | 9 ++++++--- includes/api/ApiQueryInfo.php | 12 ++++++++---- includes/api/ApiQueryLangBacklinks.php | 15 +++++++++++---- includes/api/ApiQueryLangLinks.php | 3 ++- includes/api/ApiQueryLinks.php | 12 ++++++++---- includes/api/ApiQueryLogEvents.php | 22 +++++++++++++++++----- includes/api/ApiQueryPagePropNames.php | 3 ++- includes/api/ApiQueryPageProps.php | 3 ++- 8 files changed, 56 insertions(+), 23 deletions(-) diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index 7ec69b7257..a32fb9ed66 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -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]]', ); } diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 7890a40715..3a1c21a1a9 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -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; } } } diff --git a/includes/api/ApiQueryLangBacklinks.php b/includes/api/ApiQueryLangBacklinks.php index 652fa1122f..e6280c853a 100644 --- a/includes/api/ApiQueryLangBacklinks.php +++ b/includes/api/ApiQueryLangBacklinks.php @@ -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; } } diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index 926a1b6c55..a20b8553d7 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -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]]', ); } diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index c3a130b40f..3157a7bb16 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -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", ); } diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index d17727960b..0d2f47568e 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -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 ) { diff --git a/includes/api/ApiQueryPagePropNames.php b/includes/api/ApiQueryPagePropNames.php index 08c883d8eb..5438175bd6 100644 --- a/includes/api/ApiQueryPagePropNames.php +++ b/includes/api/ApiQueryPagePropNames.php @@ -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; } diff --git a/includes/api/ApiQueryPageProps.php b/includes/api/ApiQueryPageProps.php index 91a8090a04..e51c7ab07e 100644 --- a/includes/api/ApiQueryPageProps.php +++ b/includes/api/ApiQueryPageProps.php @@ -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', ); } -- 2.20.1