Merge "Fix Block::newLoad for IPv6 range blocks"
[lhc/web/wiklou.git] / includes / linker / LinkRendererFactory.php
index 3a30772..eeb28b5 100644 (file)
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @license GPL-2.0+
  * @author Kunal Mehta <legoktm@member.fsf.org>
  */
 namespace MediaWiki\Linker;
 
+use LinkCache;
+use NamespaceInfo;
 use TitleFormatter;
 use User;
 
@@ -35,18 +36,34 @@ class LinkRendererFactory {
         */
        private $titleFormatter;
 
+       /**
+        * @var LinkCache
+        */
+       private $linkCache;
+
+       /**
+        * @var NamespaceInfo
+        */
+       private $nsInfo;
+
        /**
         * @param TitleFormatter $titleFormatter
+        * @param LinkCache $linkCache
+        * @param NamespaceInfo $nsInfo
         */
-       public function __construct( TitleFormatter $titleFormatter ) {
+       public function __construct(
+               TitleFormatter $titleFormatter, LinkCache $linkCache, NamespaceInfo $nsInfo
+       ) {
                $this->titleFormatter = $titleFormatter;
+               $this->linkCache = $linkCache;
+               $this->nsInfo = $nsInfo;
        }
 
        /**
         * @return LinkRenderer
         */
        public function create() {
-               return new LinkRenderer( $this->titleFormatter );
+               return new LinkRenderer( $this->titleFormatter, $this->linkCache, $this->nsInfo );
        }
 
        /**
@@ -67,10 +84,6 @@ class LinkRendererFactory {
        public function createFromLegacyOptions( array $options ) {
                $linkRenderer = $this->create();
 
-               if ( in_array( 'noclasses', $options, true ) ) {
-                       $linkRenderer->setNoClasses( true );
-               }
-
                if ( in_array( 'forcearticlepath', $options, true ) ) {
                        $linkRenderer->setForceArticlePath( true );
                }