mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TextExtracts
synced 2024-11-27 17:40:16 +00:00
Fix all PHPCS excludes
Change-Id: I79b32c6438ec5b73909fe08c48e55eab8b411452
This commit is contained in:
parent
520ac63cee
commit
392183ccdc
|
@ -1,10 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset>
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
|
||||
</rule>
|
||||
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
|
||||
<file>.</file>
|
||||
<arg name="extensions" value="php" />
|
||||
<arg name="encoding" value="UTF-8" />
|
||||
|
|
|
@ -28,7 +28,11 @@ class ApiQueryExtracts extends ApiQueryBase {
|
|||
|
||||
private const PREFIX = 'ex';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $params;
|
||||
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
|
@ -167,6 +171,12 @@ class ApiQueryExtracts extends ApiQueryBase {
|
|||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WANObjectCache $cache
|
||||
* @param WikiPage $page
|
||||
* @param bool $introOnly
|
||||
* @return string
|
||||
*/
|
||||
private function cacheKey( WANObjectCache $cache, WikiPage $page, $introOnly ) {
|
||||
return $cache->makeKey( 'textextracts', self::CACHE_VERSION,
|
||||
$page->getId(), $page->getTouched(),
|
||||
|
@ -176,6 +186,11 @@ class ApiQueryExtracts extends ApiQueryBase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WikiPage $page
|
||||
* @param bool $introOnly
|
||||
* @return string
|
||||
*/
|
||||
private function getFromCache( WikiPage $page, $introOnly ) {
|
||||
$cache = $this->cache;
|
||||
// @TODO: replace with getWithSetCallback()
|
||||
|
@ -183,6 +198,10 @@ class ApiQueryExtracts extends ApiQueryBase {
|
|||
return $cache->get( $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WikiPage $page
|
||||
* @param string $text
|
||||
*/
|
||||
private function setCache( WikiPage $page, $text ) {
|
||||
$cache = $this->cache;
|
||||
// @TODO: replace with getWithSetCallback()
|
||||
|
@ -190,6 +209,11 @@ class ApiQueryExtracts extends ApiQueryBase {
|
|||
$cache->set( $key, $text, $this->getConfig()->get( 'ParserCacheExpireTime' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @param bool $plainText
|
||||
* @return string
|
||||
*/
|
||||
private function getFirstSection( $text, $plainText ) {
|
||||
if ( $plainText ) {
|
||||
$regexp = '/^(.*?)(?=' . ExtractFormatter::SECTION_MARKER_START . ')/s';
|
||||
|
@ -318,6 +342,10 @@ class ApiQueryExtracts extends ApiQueryBase {
|
|||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
private function doSections( $text ) {
|
||||
$pattern = '/' .
|
||||
ExtractFormatter::SECTION_MARKER_START . '(\d)' .
|
||||
|
|
Loading…
Reference in a new issue