X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialCategories.php;h=84d1f7c7fd2e74af73441783f1bef79a239dbcdd;hp=d7d338ccf9e4d3bcd635baac3420267257a33e10;hb=7ececd89751310a7d46310b10ca80d5a0aa77528;hpb=a0803c9bc551631c8a35bf2d99705a724cb62039 diff --git a/includes/specials/SpecialCategories.php b/includes/specials/SpecialCategories.php index d7d338ccf9..84d1f7c7fd 100644 --- a/includes/specials/SpecialCategories.php +++ b/includes/specials/SpecialCategories.php @@ -26,11 +26,6 @@ */ class SpecialCategories extends SpecialPage { - /** - * @var PageLinkRenderer - */ - protected $linkRenderer = null; - public function __construct() { parent::__construct( 'Categories' ); @@ -39,42 +34,18 @@ class SpecialCategories extends SpecialPage { // using the initServices() method. } - /** - * Initialize or override the PageLinkRenderer SpecialCategories collaborates with. - * Useful mainly for testing. - * - * @todo the pager should also be injected, and de-coupled from the rendering logic. - * - * @param PageLinkRenderer $linkRenderer - */ - public function setPageLinkRenderer( - PageLinkRenderer $linkRenderer - ) { - $this->linkRenderer = $linkRenderer; - } - - /** - * Initialize any services we'll need (unless it has already been provided via a setter). - * This allows for dependency injection even though we don't control object creation. - */ - private function initServices() { - if ( !$this->linkRenderer ) { - $lang = $this->getContext()->getLanguage(); - $titleFormatter = new MediaWikiTitleCodec( $lang, GenderCache::singleton() ); - $this->linkRenderer = new MediaWikiPageLinkRenderer( $titleFormatter ); - } - } - public function execute( $par ) { - $this->initServices(); - $this->setHeaders(); $this->outputHeader(); $this->getOutput()->allowClickjacking(); $from = $this->getRequest()->getText( 'from', $par ); - $cap = new CategoryPager( $this->getContext(), $from, $this->linkRenderer ); + $cap = new CategoryPager( + $this->getContext(), + $from, + $this->getLinkRenderer() + ); $cap->doQuery(); $this->getOutput()->addHTML(