1 | <?php |
||
17 | class SkinTemplateOutputModifier { |
||
18 | |||
19 | /** |
||
20 | * @var HtmlBreadcrumbLinksBuilder |
||
21 | */ |
||
22 | private $htmlBreadcrumbLinksBuilder; |
||
23 | |||
24 | /** |
||
25 | * @var NnamespaceExaminer |
||
26 | */ |
||
27 | private $namespaceExaminer; |
||
28 | |||
29 | /** |
||
30 | * @since 1.0 |
||
31 | * |
||
32 | * @param HtmlBreadcrumbLinksBuilder $htmlBreadcrumbLinksBuilder |
||
33 | * @param NamespaceExaminer $namespaceExaminer |
||
34 | */ |
||
35 | 5 | public function __construct( HtmlBreadcrumbLinksBuilder $htmlBreadcrumbLinksBuilder, NamespaceExaminer $namespaceExaminer ) { |
|
39 | |||
40 | /** |
||
41 | * @since 1.5 |
||
42 | * |
||
43 | * @param OutputPage $output |
||
44 | * @param &$template |
||
45 | */ |
||
46 | 4 | public function modify( OutputPage $output, &$template ) { |
|
47 | |||
48 | 4 | if ( !$this->canModifyOutput( $output ) ) { |
|
49 | 3 | return; |
|
50 | } |
||
51 | |||
52 | 1 | $title = $output->getTitle(); |
|
53 | 1 | $this->htmlBreadcrumbLinksBuilder->buildBreadcrumbs( $title ); |
|
54 | |||
55 | 1 | $this->htmlBreadcrumbLinksBuilder->isRTL( |
|
56 | 1 | $title->getPageLanguage()->isRTL() |
|
57 | 1 | ); |
|
58 | |||
59 | 1 | if ( !isset( $template->data['subtitle'] ) ) { |
|
60 | $template->data['subtitle'] = ''; |
||
61 | } |
||
62 | |||
63 | // We always assume `subtitle` is available! |
||
64 | // https://github.com/wikimedia/mediawiki/blob/23ea2e4c2966f381eb7fd69b66a8d738bb24cc60/includes/skins/SkinTemplate.php#L292-L296 |
||
65 | 1 | $template->data['subtitle'] .= $this->htmlBreadcrumbLinksBuilder->getHtml(); |
|
66 | 1 | } |
|
67 | |||
68 | 4 | private function canModifyOutput( OutputPage $output ) { |
|
69 | |||
70 | 4 | if ( !$this->isEnabled( $output->getTitle() ) ) { |
|
71 | 3 | return false; |
|
72 | } |
||
73 | |||
74 | 1 | if ( isset( $output->smwmagicwords ) && in_array( 'SBL_NOBREADCRUMBLINKS', $output->smwmagicwords ) ) { |
|
75 | return false; |
||
76 | } |
||
77 | |||
78 | 1 | return true; |
|
79 | } |
||
80 | |||
81 | 4 | private function isEnabled( Title $title ) { |
|
84 | |||
85 | } |
||
86 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..