MediaWiki  master
ParserFactory.php
Go to the documentation of this file.
1 <?php
35 use Psr\Log\LoggerInterface;
36 
42  private $svcOptions;
43 
46 
48  private $contLang;
49 
51  private $urlUtils;
52 
55 
58 
60  private $nsInfo;
61 
63  private $logger;
64 
66  private $badFileLookup;
67 
70 
73 
75  private $userFactory;
76 
78  private $titleFormatter;
79 
82 
85 
88 
90  private $userNameUtils;
91 
100  public static $inParserFactory = 0;
101 
103  private $hookContainer;
104 
106  private $tidy;
107 
109  private $wanCache;
110 
135  public function __construct(
140  SpecialPageFactory $spFactory,
143  LoggerInterface $logger,
156  ) {
158 
159  wfDebug( __CLASS__ . ": using default preprocessor" );
160 
161  $this->svcOptions = $svcOptions;
162  $this->magicWordFactory = $magicWordFactory;
163  $this->contLang = $contLang;
164  $this->urlUtils = $urlUtils;
165  $this->specialPageFactory = $spFactory;
166  $this->linkRendererFactory = $linkRendererFactory;
167  $this->nsInfo = $nsInfo;
168  $this->logger = $logger;
169  $this->badFileLookup = $badFileLookup;
170  $this->languageConverterFactory = $languageConverterFactory;
171  $this->hookContainer = $hookContainer;
172  $this->tidy = $tidy;
173  $this->wanCache = $wanCache;
174  $this->userOptionsLookup = $userOptionsLookup;
175  $this->userFactory = $userFactory;
176  $this->titleFormatter = $titleFormatter;
177  $this->httpRequestFactory = $httpRequestFactory;
178  $this->trackingCategories = $trackingCategories;
179  $this->signatureValidatorFactory = $signatureValidatorFactory;
180  $this->userNameUtils = $userNameUtils;
181  }
182 
189  public function create(): Parser {
190  self::$inParserFactory++;
191  try {
192  return new Parser(
193  $this->svcOptions,
194  $this->magicWordFactory,
195  $this->contLang,
196  $this,
197  $this->urlUtils,
198  $this->specialPageFactory,
199  $this->linkRendererFactory,
200  $this->nsInfo,
201  $this->logger,
202  $this->badFileLookup,
203  $this->languageConverterFactory,
204  $this->hookContainer,
205  $this->tidy,
206  $this->wanCache,
207  $this->userOptionsLookup,
208  $this->userFactory,
209  $this->titleFormatter,
210  $this->httpRequestFactory,
211  $this->trackingCategories,
212  $this->signatureValidatorFactory,
213  $this->userNameUtils
214  );
215  } finally {
216  self::$inParserFactory--;
217  }
218  }
219 }
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:45
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,...
Factory creating MWHttpRequest objects.
An interface for creating language converters.
Factory to create LinkRender objects.
Factory for handling the special page list and generating SpecialPage objects.
Base class for HTML cleanup utilities.
Creates User objects.
Definition: UserFactory.php:38
UserNameUtils service.
Provides access to user options.
A service to expand, parse, and otherwise manipulate URLs.
Definition: UrlUtils.php:17
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Language $contLang
SpecialPageFactory $specialPageFactory
LoggerInterface $logger
UserFactory $userFactory
HookContainer $hookContainer
TidyDriverBase $tidy
WANObjectCache $wanCache
UrlUtils $urlUtils
LanguageConverterFactory $languageConverterFactory
TitleFormatter $titleFormatter
UserOptionsLookup $userOptionsLookup
LinkRendererFactory $linkRendererFactory
TrackingCategories $trackingCategories
MagicWordFactory $magicWordFactory
ServiceOptions $svcOptions
BadFileLookup $badFileLookup
NamespaceInfo $nsInfo
static int $inParserFactory
Track calls to Parser constructor to aid in deprecation of direct Parser invocation.
SignatureValidatorFactory $signatureValidatorFactory
__construct(ServiceOptions $svcOptions, MagicWordFactory $magicWordFactory, Language $contLang, UrlUtils $urlUtils, SpecialPageFactory $spFactory, LinkRendererFactory $linkRendererFactory, NamespaceInfo $nsInfo, LoggerInterface $logger, BadFileLookup $badFileLookup, LanguageConverterFactory $languageConverterFactory, HookContainer $hookContainer, TidyDriverBase $tidy, WANObjectCache $wanCache, UserOptionsLookup $userOptionsLookup, UserFactory $userFactory, TitleFormatter $titleFormatter, HttpRequestFactory $httpRequestFactory, TrackingCategories $trackingCategories, SignatureValidatorFactory $signatureValidatorFactory, UserNameUtils $userNameUtils)
HttpRequestFactory $httpRequestFactory
create()
Creates a new parser.
UserNameUtils $userNameUtils
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition: Parser.php:95
const CONSTRUCTOR_OPTIONS
Definition: Parser.php:407
This class performs some operations related to tracking categories, such as creating a list of all su...
Multi-datacenter aware caching interface.
A title formatter service for MediaWiki.