Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
MWAuthorityProxy | |
0.00% |
0 / 7 |
|
0.00% |
0 / 6 |
56 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
hasRight | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isSitewideBlocked | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
isNamed | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getLocalUserID | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare( strict_types=1 ); |
4 | |
5 | namespace MediaWiki\Extension\CampaignEvents\MWEntity; |
6 | |
7 | use MediaWiki\Permissions\Authority; |
8 | |
9 | class MWAuthorityProxy implements ICampaignsAuthority { |
10 | private Authority $authority; |
11 | |
12 | /** |
13 | * @param Authority $authority |
14 | */ |
15 | public function __construct( Authority $authority ) { |
16 | $this->authority = $authority; |
17 | } |
18 | |
19 | /** |
20 | * @inheritDoc |
21 | */ |
22 | public function hasRight( string $right ): bool { |
23 | return $this->authority->isAllowed( $right ); |
24 | } |
25 | |
26 | /** |
27 | * @inheritDoc |
28 | */ |
29 | public function isSitewideBlocked(): bool { |
30 | $block = $this->authority->getBlock(); |
31 | return $block && $block->isSitewide(); |
32 | } |
33 | |
34 | /** |
35 | * @inheritDoc |
36 | */ |
37 | public function isNamed(): bool { |
38 | return $this->authority->isNamed(); |
39 | } |
40 | |
41 | /** |
42 | * @inheritDoc |
43 | */ |
44 | public function getName(): string { |
45 | return $this->authority->getUser()->getName(); |
46 | } |
47 | |
48 | /** |
49 | * @return int |
50 | */ |
51 | public function getLocalUserID(): int { |
52 | return $this->authority->getUser()->getId(); |
53 | } |
54 | } |