Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
AbuseLoggerFactory
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
 newLogger
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\AbuseFilter;
4
5use MediaWiki\Config\ServiceOptions;
6use MediaWiki\Extension\AbuseFilter\Variables\VariableHolder;
7use MediaWiki\Extension\AbuseFilter\Variables\VariablesBlobStore;
8use MediaWiki\Extension\AbuseFilter\Variables\VariablesManager;
9use MediaWiki\Title\Title;
10use User;
11use Wikimedia\Rdbms\LBFactory;
12
13class AbuseLoggerFactory {
14    public const SERVICE_NAME = 'AbuseFilterAbuseLoggerFactory';
15
16    /** @var CentralDBManager */
17    private $centralDBManager;
18    /** @var FilterLookup */
19    private $filterLookup;
20    /** @var VariablesBlobStore */
21    private $varBlobStore;
22    /** @var VariablesManager */
23    private $varManager;
24    /** @var EditRevUpdater */
25    private $editRevUpdater;
26    /** @var LBFactory */
27    private $lbFactory;
28    /** @var ServiceOptions */
29    private $options;
30    /** @var string */
31    private $wikiID;
32    /** @var string */
33    private $requestIP;
34
35    /**
36     * @param CentralDBManager $centralDBManager
37     * @param FilterLookup $filterLookup
38     * @param VariablesBlobStore $varBlobStore
39     * @param VariablesManager $varManager
40     * @param EditRevUpdater $editRevUpdater
41     * @param LBFactory $lbFactory
42     * @param ServiceOptions $options
43     * @param string $wikiID
44     * @param string $requestIP
45     */
46    public function __construct(
47        CentralDBManager $centralDBManager,
48        FilterLookup $filterLookup,
49        VariablesBlobStore $varBlobStore,
50        VariablesManager $varManager,
51        EditRevUpdater $editRevUpdater,
52        LBFactory $lbFactory,
53        ServiceOptions $options,
54        string $wikiID,
55        string $requestIP
56    ) {
57        $this->centralDBManager = $centralDBManager;
58        $this->filterLookup = $filterLookup;
59        $this->varBlobStore = $varBlobStore;
60        $this->varManager = $varManager;
61        $this->editRevUpdater = $editRevUpdater;
62        $this->lbFactory = $lbFactory;
63        $this->options = $options;
64        $this->wikiID = $wikiID;
65        $this->requestIP = $requestIP;
66    }
67
68    /**
69     * @param Title $title
70     * @param User $user
71     * @param VariableHolder $vars
72     * @return AbuseLogger
73     */
74    public function newLogger(
75        Title $title,
76        User $user,
77        VariableHolder $vars
78    ): AbuseLogger {
79        return new AbuseLogger(
80            $this->centralDBManager,
81            $this->filterLookup,
82            $this->varBlobStore,
83            $this->varManager,
84            $this->editRevUpdater,
85            $this->lbFactory,
86            $this->options,
87            $this->wikiID,
88            $this->requestIP,
89            $title,
90            $user,
91            $vars
92        );
93    }
94}