Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
HookRunner
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onMobileFrontendBeforeDOM
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onMobileFrontendContentProvider
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onMobileFrontendFeaturesRegistration
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onRequestContextCreateSkinMobile
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onSpecialMobileEditWatchlist__images
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
4
5namespace MobileFrontend\Hooks;
6
7use MediaWiki\Context\IContextSource;
8use MediaWiki\HookContainer\HookContainer;
9use MediaWiki\Output\OutputPage;
10use MobileContext;
11use MobileFormatter;
12use MobileFrontend\ContentProviders\IContentProvider;
13use MobileFrontend\Features\FeaturesManager;
14use Skin;
15
16/**
17 * This is a hook runner class, see docs/Hooks.md in core.
18 * @internal
19 */
20class HookRunner implements
21    MobileFrontendBeforeDOMHook,
22    MobileFrontendContentProviderHook,
23    MobileFrontendFeaturesRegistrationHook,
24    RequestContextCreateSkinMobileHook,
25    SpecialMobileEditWatchlistImagesHook
26{
27    private HookContainer $hookContainer;
28
29    public function __construct( HookContainer $hookContainer ) {
30        $this->hookContainer = $hookContainer;
31    }
32
33    /**
34     * @inheritDoc
35     */
36    public function onMobileFrontendBeforeDOM( MobileContext $mobileContext, MobileFormatter $formatter ) {
37        return $this->hookContainer->run(
38            'MobileFrontendBeforeDOM',
39            [ $mobileContext, $formatter ]
40        );
41    }
42
43    /**
44     * @inheritDoc
45     */
46    public function onMobileFrontendContentProvider( IContentProvider &$provider, OutputPage $out ) {
47        return $this->hookContainer->run(
48            'MobileFrontendContentProvider',
49            [ &$provider, $out ]
50        );
51    }
52
53    /**
54     * @inheritDoc
55     */
56    public function onMobileFrontendFeaturesRegistration( FeaturesManager $featuresManager ) {
57        return $this->hookContainer->run(
58            'MobileFrontendFeaturesRegistration',
59            [ $featuresManager ]
60        );
61    }
62
63    /**
64     * @inheritDoc
65     */
66    public function onRequestContextCreateSkinMobile( MobileContext $mobileContext, Skin $skin ) {
67        return $this->hookContainer->run(
68            'RequestContextCreateSkinMobile',
69            [ $mobileContext, $skin ]
70        );
71    }
72
73    /**
74     * @inheritDoc
75     */
76    public function onSpecialMobileEditWatchlist__images( IContextSource $context, array &$watchlist, array &$images ) {
77        return $this->hookContainer->run(
78            'SpecialMobileEditWatchlist::images',
79            [ $context, &$watchlist, &$images ]
80        );
81    }
82}