Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
CentralUser
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getCentralID
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 equals
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare( strict_types=1 );
4
5namespace MediaWiki\Extension\CampaignEvents\MWEntity;
6
7/**
8 * This class represents a global user account, which could potentially be local depending on
9 * what CentralIdLookup is used. This has no matching MW class, but it's similar to UserIdentity
10 * with the addition of the central ID.
11 * Note that this class only stored the ID because that's the only piece of information provided by
12 * CentralIdLookup. Anything else (e.g., the name) would require a second query to be retrieved, which
13 * is unnecessarily expensive.
14 */
15class CentralUser {
16    private int $centralID;
17
18    /**
19     * @param int $centralID
20     */
21    public function __construct( int $centralID ) {
22        $this->centralID = $centralID;
23    }
24
25    /**
26     * @return int
27     */
28    public function getCentralID(): int {
29        return $this->centralID;
30    }
31
32    /**
33     * @param CentralUser $other
34     * @return bool
35     */
36    public function equals( self $other ): bool {
37        return $this->centralID === $other->centralID;
38    }
39}