3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
21 use MediaWiki\Linker\LinkRendererFactory
;
22 use MediaWiki\MediaWikiServices
;
23 use MediaWiki\Special\SpecialPageFactory
;
32 /** @var MagicWordFactory */
33 private $magicWordFactory;
39 private $urlProtocols;
41 /** @var SpecialPageFactory */
42 private $specialPageFactory;
47 /** @var LinkRendererFactory */
48 private $linkRendererFactory;
50 /** @var NamespaceInfo */
54 * @param array $parserConf See $wgParserConf documentation
55 * @param MagicWordFactory $magicWordFactory
56 * @param Language $contLang Content language
57 * @param string $urlProtocols As returned from wfUrlProtocols()
58 * @param SpecialPageFactory $spFactory
59 * @param Config $siteConfig
60 * @param LinkRendererFactory $linkRendererFactory
61 * @param NamespaceInfo|null $nsInfo
64 public function __construct(
65 array $parserConf, MagicWordFactory
$magicWordFactory, Language
$contLang, $urlProtocols,
66 SpecialPageFactory
$spFactory, Config
$siteConfig,
67 LinkRendererFactory
$linkRendererFactory, NamespaceInfo
$nsInfo = null
70 wfDeprecated( __METHOD__
. ' with no NamespaceInfo argument', '1.34' );
71 $nsInfo = MediaWikiServices
::getInstance()->getNamespaceInfo();
73 $this->parserConf
= $parserConf;
74 $this->magicWordFactory
= $magicWordFactory;
75 $this->contLang
= $contLang;
76 $this->urlProtocols
= $urlProtocols;
77 $this->specialPageFactory
= $spFactory;
78 $this->siteConfig
= $siteConfig;
79 $this->linkRendererFactory
= $linkRendererFactory;
80 $this->nsInfo
= $nsInfo;
87 public function create() : Parser
{
88 return new Parser( $this->parserConf
, $this->magicWordFactory
, $this->contLang
, $this,
89 $this->urlProtocols
, $this->specialPageFactory
, $this->siteConfig
,
90 $this->linkRendererFactory
, $this->nsInfo
);