summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/src/PageTranslation/PageMoveOperation.php')
-rw-r--r--MLEB/Translate/src/PageTranslation/PageMoveOperation.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/MLEB/Translate/src/PageTranslation/PageMoveOperation.php b/MLEB/Translate/src/PageTranslation/PageMoveOperation.php
new file mode 100644
index 00000000..2cfbb5ea
--- /dev/null
+++ b/MLEB/Translate/src/PageTranslation/PageMoveOperation.php
@@ -0,0 +1,61 @@
+<?php
+declare( strict_types = 1 );
+
+namespace MediaWiki\Extension\Translate\PageTranslation;
+
+use Title;
+
+/**
+ * Represents a single page being moved including the talk page.
+ * @author Abijeet Patro
+ * @license GPL-2.0-or-later
+ * @since 2021.09
+ */
+class PageMoveOperation {
+ /** @var Title */
+ private $old;
+ /** @var Title|null */
+ private $new;
+ /** @var Title|null */
+ private $oldTalkpage;
+ /** @var Title|null */
+ private $newTalkpage;
+ /** @var InvalidPageTitleRename|null */
+ private $invalidPageTitleRename;
+
+ public function __construct( Title $old, ?Title $new, ?InvalidPageTitleRename $e = null ) {
+ $this->old = $old;
+ $this->new = $new;
+ $this->invalidPageTitleRename = $e;
+ }
+
+ public function getOldTitle(): Title {
+ return $this->old;
+ }
+
+ public function getNewTitle(): ?Title {
+ return $this->new;
+ }
+
+ public function getOldTalkpage(): ?Title {
+ return $this->oldTalkpage;
+ }
+
+ public function getNewTalkpage(): ?Title {
+ return $this->newTalkpage;
+ }
+
+ public function hasTalkpage(): bool {
+ return $this->oldTalkpage !== null;
+ }
+
+ public function getRenameErrorCode(): int {
+ return $this->invalidPageTitleRename ?
+ $this->invalidPageTitleRename->getCode() : PageTitleRenamer::NO_ERROR;
+ }
+
+ public function setTalkpage( Title $oldTalkpage, ?Title $newTalkpage ): void {
+ $this->oldTalkpage = $oldTalkpage;
+ $this->newTalkpage = $newTalkpage;
+ }
+}