X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryPrefixSearch.php;h=d04796c91d3cbea39a91f2541a34966cc733771f;hb=4ce349cdbfe51da968c96ca2c72ae465538510cc;hp=1dac74026211c21ac21e130e9162e77395467790;hpb=ca2c2c0f4fdd633779ce1d48d09645275b0e5827;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryPrefixSearch.php b/includes/api/ApiQueryPrefixSearch.php index 1dac740262..d04796c91d 100644 --- a/includes/api/ApiQueryPrefixSearch.php +++ b/includes/api/ApiQueryPrefixSearch.php @@ -63,7 +63,7 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase { } $resultPageSet->populateFromTitles( $titles ); foreach ( $titles as $index => $title ) { - $resultPageSet->setGeneratorData( $title, array( 'index' => $index + $offset + 1 ) ); + $resultPageSet->setGeneratorData( $title, [ 'index' => $index + $offset + 1 ] ); } } else { $result = $this->getResult(); @@ -73,23 +73,23 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase { $this->setContinueEnumParameter( 'offset', $offset + $params['limit'] ); break; } - $vals = array( + $vals = [ 'ns' => intval( $title->getNamespace() ), 'title' => $title->getPrefixedText(), - ); + ]; if ( $title->isSpecialPage() ) { $vals['special'] = true; } else { - $vals['pageid'] = intval( $title->getArticleId() ); + $vals['pageid'] = intval( $title->getArticleID() ); } - $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals ); + $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals ); if ( !$fit ) { $this->setContinueEnumParameter( 'offset', $offset + $count - 1 ); break; } } $result->addIndexedTagName( - array( 'query', $this->getModuleName() ), $this->getModulePrefix() + [ 'query', $this->getModuleName() ], $this->getModulePrefix() ); } } @@ -99,36 +99,36 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase { } public function getAllowedParams() { - return array( - 'search' => array( + return [ + 'search' => [ ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true, - ), - 'namespace' => array( + ], + 'namespace' => [ ApiBase::PARAM_DFLT => NS_MAIN, ApiBase::PARAM_TYPE => 'namespace', ApiBase::PARAM_ISMULTI => true, - ), - 'limit' => array( + ], + 'limit' => [ ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, // Non-standard value for compatibility with action=opensearch ApiBase::PARAM_MAX => 100, ApiBase::PARAM_MAX2 => 200, - ), - 'offset' => array( + ], + 'offset' => [ ApiBase::PARAM_DFLT => 0, ApiBase::PARAM_TYPE => 'integer', - ), - ); + ], + ]; } protected function getExamplesMessages() { - return array( + return [ 'action=query&list=prefixsearch&pssearch=meaning' => 'apihelp-query+prefixsearch-example-simple', - ); + ]; } public function getHelpUrls() {