Move mCounter property from AbuseFilterViewExamine to AbuseFilterExaminePager

It is only used there. Reduce coupling.

Change-Id: I1fad101c4cd971914a031b08f10114cd7278cc66
This commit is contained in:
Matěj Suchánek 2020-10-31 15:27:20 +01:00
parent 6a081ade68
commit 3e8a4b63ab
2 changed files with 11 additions and 13 deletions

View file

@ -6,10 +6,6 @@ use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionRecord;
class AbuseFilterViewExamine extends AbuseFilterView {
/**
* @var int Line number of the row, see RecentChange::$counter
*/
public $mCounter;
/**
* @var string The user whose entries we're examinating
*/
@ -98,16 +94,13 @@ class AbuseFilterViewExamine extends AbuseFilterView {
*/
public function showResults() {
$changesList = new AbuseFilterChangesList( $this->getSkin(), $this->mTestFilter );
$output = $changesList->beginRecentChangesList();
$this->mCounter = 1;
$pager = new AbuseFilterExaminePager( $this, $changesList );
$output .= $pager->getNavigationBar() .
$pager->getBody() .
$pager->getNavigationBar();
$output .= $changesList->endRecentChangesList();
$output = $changesList->beginRecentChangesList()
. $pager->getNavigationBar()
. $pager->getBody()
. $pager->getNavigationBar()
. $changesList->endRecentChangesList();
$this->getOutput()->addHTML( $output );
}

View file

@ -9,6 +9,10 @@ class AbuseFilterExaminePager extends ReverseChronologicalPager {
* @var AbuseFilterViewExamine The associated view
*/
public $mPage;
/**
* @var int Line number of the row, see RecentChange::$counter
*/
public $rcCounter;
/**
* @param AbuseFilterViewExamine $page
@ -18,6 +22,7 @@ class AbuseFilterExaminePager extends ReverseChronologicalPager {
parent::__construct();
$this->mChangesList = $changesList;
$this->mPage = $page;
$this->rcCounter = 1;
}
/**
@ -62,7 +67,7 @@ class AbuseFilterExaminePager extends ReverseChronologicalPager {
*/
public function formatRow( $row ) {
$rc = RecentChange::newFromRow( $row );
$rc->counter = $this->mPage->mCounter++;
$rc->counter = $this->rcCounter++;
return $this->mChangesList->recentChangesLine( $rc, false );
}