MediaWiki  master
ParserFactory.php
Go to the documentation of this file.
1 <?php
31 use Psr\Log\LoggerInterface;
32 
38  private $svcOptions;
39 
42 
44  private $contLang;
45 
47  private $urlProtocols;
48 
51 
54 
56  private $nsInfo;
57 
59  private $logger;
60 
62  private $badFileLookup;
63 
66 
69 
71  private $userFactory;
72 
81  public static $inParserFactory = 0;
82 
84  private $hookContainer;
85 
87  private $tidy;
88 
90  private $wanCache;
91 
111  public function __construct(
115  string $urlProtocols,
116  SpecialPageFactory $spFactory,
119  LoggerInterface $logger,
127  ) {
129 
130  wfDebug( __CLASS__ . ": using default preprocessor" );
131 
132  $this->svcOptions = $svcOptions;
133  $this->magicWordFactory = $magicWordFactory;
134  $this->contLang = $contLang;
135  $this->urlProtocols = $urlProtocols;
136  $this->specialPageFactory = $spFactory;
137  $this->linkRendererFactory = $linkRendererFactory;
138  $this->nsInfo = $nsInfo;
139  $this->logger = $logger;
140  $this->badFileLookup = $badFileLookup;
141  $this->languageConverterFactory = $languageConverterFactory;
142  $this->hookContainer = $hookContainer;
143  $this->tidy = $tidy;
144  $this->wanCache = $wanCache;
145  $this->userOptionsLookup = $userOptionsLookup;
146  $this->userFactory = $userFactory;
147  }
148 
155  public function create() : Parser {
156  self::$inParserFactory++;
157  try {
158  return new Parser(
159  $this->svcOptions,
160  $this->magicWordFactory,
161  $this->contLang,
162  $this,
163  $this->urlProtocols,
164  $this->specialPageFactory,
165  $this->linkRendererFactory,
166  $this->nsInfo,
167  $this->logger,
168  $this->badFileLookup,
169  $this->languageConverterFactory,
170  $this->hookContainer,
171  $this->tidy,
172  $this->wanCache,
173  $this->userOptionsLookup,
174  $this->userFactory
175  );
176  } finally {
177  self::$inParserFactory--;
178  }
179  }
180 }
ParserFactory\$contLang
Language $contLang
Definition: ParserFactory.php:44
ParserFactory\create
create()
Creates a new parser.
Definition: ParserFactory.php:155
ParserFactory\$magicWordFactory
MagicWordFactory $magicWordFactory
Definition: ParserFactory.php:41
MagicWordFactory
A factory that stores information about MagicWords, and creates them on demand with caching.
Definition: MagicWordFactory.php:37
MediaWiki\BadFileLookup
Definition: BadFileLookup.php:13
MediaWiki\SpecialPage\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:61
ParserFactory\$hookContainer
HookContainer $hookContainer
Definition: ParserFactory.php:84
MediaWiki\Linker\LinkRendererFactory
Factory to create LinkRender objects.
Definition: LinkRendererFactory.php:34
ParserFactory\$badFileLookup
BadFileLookup $badFileLookup
Definition: ParserFactory.php:62
ParserFactory\$tidy
TidyDriverBase $tidy
Definition: ParserFactory.php:87
ParserFactory\$userFactory
UserFactory $userFactory
Definition: ParserFactory.php:71
MediaWiki\Languages\LanguageConverterFactory
An interface for creating language converters.
Definition: LanguageConverterFactory.php:46
ParserFactory\$logger
LoggerInterface $logger
Definition: ParserFactory.php:59
ParserFactory\$svcOptions
ServiceOptions $svcOptions
Definition: ParserFactory.php:38
ParserFactory\$urlProtocols
string $urlProtocols
Definition: ParserFactory.php:47
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:27
ParserFactory\$userOptionsLookup
UserOptionsLookup $userOptionsLookup
Definition: ParserFactory.php:68
ParserFactory\$languageConverterFactory
LanguageConverterFactory $languageConverterFactory
Definition: ParserFactory.php:65
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:915
MediaWiki\Tidy\TidyDriverBase
Base class for HTML cleanup utilities.
Definition: TidyDriverBase.php:8
ParserFactory\$specialPageFactory
SpecialPageFactory $specialPageFactory
Definition: ParserFactory.php:50
ParserFactory
Definition: ParserFactory.php:36
Parser\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: Parser.php:362
ParserFactory\$inParserFactory
static int $inParserFactory
Track calls to Parser constructor to aid in deprecation of direct Parser invocation.
Definition: ParserFactory.php:81
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:125
ParserFactory\$wanCache
WANObjectCache $wanCache
Definition: ParserFactory.php:90
Parser
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition: Parser.php:87
MediaWiki\User\UserOptionsLookup
Provides access to user options.
Definition: UserOptionsLookup.php:29
ParserFactory\$linkRendererFactory
LinkRendererFactory $linkRendererFactory
Definition: ParserFactory.php:53
ParserFactory\__construct
__construct(ServiceOptions $svcOptions, MagicWordFactory $magicWordFactory, Language $contLang, string $urlProtocols, SpecialPageFactory $spFactory, LinkRendererFactory $linkRendererFactory, NamespaceInfo $nsInfo, LoggerInterface $logger, BadFileLookup $badFileLookup, LanguageConverterFactory $languageConverterFactory, HookContainer $hookContainer, TidyDriverBase $tidy, WANObjectCache $wanCache, UserOptionsLookup $userOptionsLookup, UserFactory $userFactory)
Definition: ParserFactory.php:111
ParserFactory\$nsInfo
NamespaceInfo $nsInfo
Definition: ParserFactory.php:56
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:45
NamespaceInfo
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Definition: NamespaceInfo.php:35
MediaWiki\User\UserFactory
Creates User objects.
Definition: UserFactory.php:41
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:43
MediaWiki\Config\ServiceOptions\assertRequiredOptions
assertRequiredOptions(array $expectedKeys)
Assert that the list of options provided in this instance exactly match $expectedKeys,...
Definition: ServiceOptions.php:66