Debian Codegraph @

includes/language/FormatterFactory.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Language;
4
5 use MediaWiki\Block\BlockErrorFormatter;
6 use MediaWiki\HookContainer\HookContainer;
7 use MediaWiki\Languages\LanguageFactory;
8 use MediaWiki\Status\StatusFormatter;
9 use MediaWiki\Title\TitleFormatter;
10 use MediaWiki\User\UserIdentityUtils;
11 use MessageCache;
12 use MessageLocalizer;
13 use Psr\Log\LoggerInterface;
14
15 /**
16 * Factory for formatters of common complex objects
17 *
18 * @since 1.42
19 */
20 class FormatterFactory {
21
22 private MessageCache $messageCache;
23 private TitleFormatter $titleFormatter;
24 private HookContainer $hookContainer;
25 private UserIdentityUtils $userIdentityUtils;
26 private LanguageFactory $languageFactory;
27 private LoggerInterface $logger;
28
29 public function __construct(
30 MessageCache $messageCache,
31 TitleFormatter $titleFormatter,
32 HookContainer $hookContainer,
33 UserIdentityUtils $userIdentityUtils,
34 LanguageFactory $languageFactory,
35 LoggerInterface $logger
36 ) {
37 $this->messageCache = $messageCache;
38 $this->titleFormatter = $titleFormatter;
39 $this->hookContainer = $hookContainer;
40 $this->userIdentityUtils = $userIdentityUtils;
41 $this->languageFactory = $languageFactory;
42 $this->logger = $logger;
43 }
44
45 public function getStatusFormatter( MessageLocalizer $messageLocalizer ): StatusFormatter {
46 return new StatusFormatter( $messageLocalizer, $this->messageCache, $this->logger );
47 }
48
49 public function getBlockErrorFormatter( LocalizationContext $context ): BlockErrorFormatter {
50 return new BlockErrorFormatter(
51 $this->titleFormatter,
52 $this->hookContainer,
53 $this->userIdentityUtils,
54 $this->languageFactory,
55 $context
56 );
57 }
58
59 }