Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
| LastEditInfo | |
100.00% |
8 / 8 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| setUserIdentity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUserIdentity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUserName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUserID | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTimestamp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setTimestamp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\AbuseFilter\Filter; |
| 4 | |
| 5 | use MediaWiki\User\UserIdentity; |
| 6 | |
| 7 | /** |
| 8 | * (Mutable) value object that holds information about the last edit to a filter. |
| 9 | */ |
| 10 | class LastEditInfo { |
| 11 | /** @var UserIdentity */ |
| 12 | private $userIdentity; |
| 13 | |
| 14 | /** @var string */ |
| 15 | private $timestamp; |
| 16 | |
| 17 | /** |
| 18 | * @param UserIdentity $identity |
| 19 | * @param string $timestamp |
| 20 | */ |
| 21 | public function __construct( UserIdentity $identity, string $timestamp ) { |
| 22 | $this->userIdentity = $identity; |
| 23 | $this->timestamp = $timestamp; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Set the UserIdentity |
| 28 | * |
| 29 | * @param UserIdentity $identity |
| 30 | */ |
| 31 | public function setUserIdentity( UserIdentity $identity ): void { |
| 32 | $this->userIdentity = $identity; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Get the UserIdentity object |
| 37 | * |
| 38 | * @return UserIdentity |
| 39 | */ |
| 40 | public function getUserIdentity(): UserIdentity { |
| 41 | return $this->userIdentity; |
| 42 | } |
| 43 | |
| 44 | public function getUserName(): string { |
| 45 | return $this->userIdentity->getName(); |
| 46 | } |
| 47 | |
| 48 | public function getUserID(): int { |
| 49 | return $this->userIdentity->getId(); |
| 50 | } |
| 51 | |
| 52 | public function getTimestamp(): string { |
| 53 | return $this->timestamp; |
| 54 | } |
| 55 | |
| 56 | public function setTimestamp( string $timestamp ): void { |
| 57 | $this->timestamp = $timestamp; |
| 58 | } |
| 59 | } |