From b22511e3412e0a847dd102fcef07cea63d253d46 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 5 Oct 2021 22:26:24 +0200 Subject: [PATCH] Branch: add assertBranch helper method --- library/Director/Db/Branch/Branch.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/Director/Db/Branch/Branch.php b/library/Director/Db/Branch/Branch.php index 0c3cefbb..49ec8074 100644 --- a/library/Director/Db/Branch/Branch.php +++ b/library/Director/Db/Branch/Branch.php @@ -124,6 +124,13 @@ class Branch return $this->branchUuid !== null; } + public function assertBranch() + { + if ($this->isMain()) { + throw new RuntimeException('Branch expected, but working in main branch'); + } + } + /** * @return bool */