MediaWiki REL1_35
ParserFactory.php
Go to the documentation of this file.
1<?php
28use Psr\Log\LoggerInterface;
29
35 private $svcOptions;
36
39
41 private $contLang;
42
45
48
51
53 private $nsInfo;
54
56 private $logger;
57
60
63
72 public static $inParserFactory = 0;
73
76
91 public function __construct(
92 ServiceOptions $svcOptions,
93 MagicWordFactory $magicWordFactory,
94 Language $contLang,
95 string $urlProtocols,
96 SpecialPageFactory $spFactory,
97 LinkRendererFactory $linkRendererFactory,
98 NamespaceInfo $nsInfo,
99 LoggerInterface $logger,
100 BadFileLookup $badFileLookup,
101 LanguageConverterFactory $languageConverterFactory,
102 HookContainer $hookContainer
103 ) {
104 $svcOptions->assertRequiredOptions( Parser::CONSTRUCTOR_OPTIONS );
105
106 wfDebug( __CLASS__ . ": using default preprocessor" );
107
108 $this->svcOptions = $svcOptions;
109 $this->magicWordFactory = $magicWordFactory;
110 $this->contLang = $contLang;
111 $this->urlProtocols = $urlProtocols;
112 $this->specialPageFactory = $spFactory;
113 $this->linkRendererFactory = $linkRendererFactory;
114 $this->nsInfo = $nsInfo;
115 $this->logger = $logger;
116 $this->badFileLookup = $badFileLookup;
117 $this->languageConverterFactory = $languageConverterFactory;
118 $this->hookContainer = $hookContainer;
119 }
120
127 public function create() : Parser {
128 self::$inParserFactory++;
129 try {
130 return new Parser(
131 $this->svcOptions,
132 $this->magicWordFactory,
133 $this->contLang,
134 $this,
135 $this->urlProtocols,
136 $this->specialPageFactory,
137 $this->linkRendererFactory,
138 $this->nsInfo,
139 $this->logger,
140 $this->badFileLookup,
141 $this->languageConverterFactory,
142 $this->hookContainer
143 );
144 } finally {
145 self::$inParserFactory--;
146 }
147 }
148}
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition Language.php:41
A factory that stores information about MagicWords, and creates them on demand with caching.
A class for passing options to services.
assertRequiredOptions(array $expectedKeys)
Assert that the list of options provided in this instance exactly match $expectedKeys,...
An interface for creating language converters.
Factory to create LinkRender objects.
Factory for handling the special page list and generating SpecialPage objects.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Language $contLang
SpecialPageFactory $specialPageFactory
LoggerInterface $logger
HookContainer $hookContainer
__construct(ServiceOptions $svcOptions, MagicWordFactory $magicWordFactory, Language $contLang, string $urlProtocols, SpecialPageFactory $spFactory, LinkRendererFactory $linkRendererFactory, NamespaceInfo $nsInfo, LoggerInterface $logger, BadFileLookup $badFileLookup, LanguageConverterFactory $languageConverterFactory, HookContainer $hookContainer)
LanguageConverterFactory $languageConverterFactory
LinkRendererFactory $linkRendererFactory
MagicWordFactory $magicWordFactory
ServiceOptions $svcOptions
BadFileLookup $badFileLookup
NamespaceInfo $nsInfo
static int $inParserFactory
Track calls to Parser constructor to aid in deprecation of direct Parser invocation.
create()
Creates a new parser.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition Parser.php:85