diff options
Diffstat (limited to 'MLEB/Translate/src/Synchronization/GroupSynchronizationResponse.php')
-rw-r--r-- | MLEB/Translate/src/Synchronization/GroupSynchronizationResponse.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/MLEB/Translate/src/Synchronization/GroupSynchronizationResponse.php b/MLEB/Translate/src/Synchronization/GroupSynchronizationResponse.php new file mode 100644 index 00000000..83a58ef6 --- /dev/null +++ b/MLEB/Translate/src/Synchronization/GroupSynchronizationResponse.php @@ -0,0 +1,47 @@ +<?php + +declare( strict_types = 1 ); + +namespace MediaWiki\Extensions\Translate\Synchronization; + +/** + * Class encapsulating the response returned by the GroupSynchronizationCache + * when requested for an update on a group synchronization status. + * @author Abijeet Patro + * @license GPL-2.0-or-later + * @since 2020.06 + */ +class GroupSynchronizationResponse { + /** @var array */ + private $remainingMessageKeys; + + /** @var string */ + private $groupId; + + /** @var bool */ + private $timeout; + + public function __construct( + string $groupId, array $remainingMessageKeys, bool $hasTimedOut + ) { + $this->groupId = $groupId; + $this->remainingMessageKeys = $remainingMessageKeys; + $this->timeout = $hasTimedOut; + } + + public function isDone(): bool { + return $this->remainingMessageKeys === []; + } + + public function getRemainingMessages(): array { + return $this->remainingMessageKeys; + } + + public function getGroupId(): string { + return $this->groupId; + } + + public function hasTimedOut(): bool { + return $this->timeout; + } +} |