| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\DiscussionTools; |
| 4 |
|
| 5 |
use MediaWiki\Linker\LinkTarget; |
| 6 |
use MediaWiki\User\UserIdentity; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class SubscriptionItem { |
| 12 |
private UserIdentity $user; |
| 13 |
private string $itemName; |
| 14 |
private LinkTarget $linkTarget; |
| 15 |
private int $state; |
| 16 |
private ?string $createdTimestamp; |
| 17 |
private ?string $notifiedTimestamp; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public function __construct( |
| 29 |
UserIdentity $user, |
| 30 |
string $itemName, |
| 31 |
LinkTarget $linkTarget, |
| 32 |
int $state, |
| 33 |
?string $createdTimestamp, |
| 34 |
?string $notifiedTimestamp |
| 35 |
) { |
| 36 |
$this->user = $user; |
| 37 |
$this->itemName = $itemName; |
| 38 |
$this->linkTarget = $linkTarget; |
| 39 |
$this->state = $state; |
| 40 |
$this->createdTimestamp = $createdTimestamp; |
| 41 |
$this->notifiedTimestamp = $notifiedTimestamp; |
| 42 |
} |
| 43 |
|
| 44 |
public function getUserIdentity(): UserIdentity { |
| 45 |
return $this->user; |
| 46 |
} |
| 47 |
|
| 48 |
public function getItemName(): string { |
| 49 |
return $this->itemName; |
| 50 |
} |
| 51 |
|
| 52 |
public function getLinkTarget(): LinkTarget { |
| 53 |
return $this->linkTarget; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
public function getCreatedTimestamp(): ?string { |
| 60 |
return $this->createdTimestamp; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
public function getNotificationTimestamp(): ?string { |
| 67 |
return $this->notifiedTimestamp; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public function getState(): int { |
| 76 |
return $this->state; |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
public function isMuted(): bool { |
| 83 |
return $this->state === SubscriptionStore::STATE_UNSUBSCRIBED; |
| 84 |
} |
| 85 |
} |