Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
BlockPermissionCheckerFactory | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
newBlockPermissionChecker | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License along |
15 | * with this program; if not, write to the Free Software Foundation, Inc., |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | * http://www.gnu.org/copyleft/gpl.html |
18 | * |
19 | * @file |
20 | */ |
21 | |
22 | namespace MediaWiki\Block; |
23 | |
24 | use MediaWiki\Config\ServiceOptions; |
25 | use MediaWiki\Permissions\Authority; |
26 | use MediaWiki\User\UserIdentity; |
27 | |
28 | /** |
29 | * Factory class for BlockPermissionChecker |
30 | * |
31 | * @since 1.35 |
32 | */ |
33 | class BlockPermissionCheckerFactory { |
34 | |
35 | /** @var ServiceOptions */ |
36 | private $options; |
37 | |
38 | /** |
39 | * @internal only to be used by ServiceWiring |
40 | */ |
41 | public const CONSTRUCTOR_OPTIONS = BlockPermissionChecker::CONSTRUCTOR_OPTIONS; |
42 | |
43 | /** @var BlockUtils */ |
44 | private $blockUtils; |
45 | |
46 | /** |
47 | * @param ServiceOptions $options |
48 | * @param BlockUtils $blockUtils |
49 | */ |
50 | public function __construct( |
51 | ServiceOptions $options, |
52 | BlockUtils $blockUtils |
53 | ) { |
54 | $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); |
55 | $this->options = $options; |
56 | $this->blockUtils = $blockUtils; |
57 | } |
58 | |
59 | /** |
60 | * @param UserIdentity|string|null $target Target of the validated block; may be null if unknown |
61 | * @param Authority $performer Performer of the validated block |
62 | * |
63 | * @return BlockPermissionChecker |
64 | */ |
65 | public function newBlockPermissionChecker( |
66 | $target, |
67 | Authority $performer |
68 | ) { |
69 | return new BlockPermissionChecker( |
70 | $this->options, |
71 | $this->blockUtils, |
72 | $target, |
73 | $performer |
74 | ); |
75 | } |
76 | } |