From d92b93f6f4fffbfe84d581f1dfc81336bed7affc Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Thu, 15 Aug 2024 02:54:42 +0300 Subject: [PATCH] chore: remove unnecessary parameter --- actions/class.RestQtiTests.php | 43 ++-------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/actions/class.RestQtiTests.php b/actions/class.RestQtiTests.php index 45d1d7921..d3482a70c 100644 --- a/actions/class.RestQtiTests.php +++ b/actions/class.RestQtiTests.php @@ -138,18 +138,7 @@ public function import() protected function getItemClassUri(): ?string { - $itemClassUri = $this->getPostParameter(self::ITEM_CLASS_URI); - $subclassLabel = $this->getSubclassLabel(); - - if ($subclassLabel) { - foreach ($this->getClass($itemClassUri)->getSubClasses() as $subclass) { - if ($subclass->getLabel() === $subclassLabel) { - $itemClassUri = $subclass->getUri(); - } - } - } - - return $itemClassUri; + return $this->getPostParameter(self::ITEM_CLASS_URI); } /** @@ -321,23 +310,6 @@ private function getUploadedPackageData() return $fileData; } - /** - * @return string|null - * @throws common_exception_RestApi - */ - private function getSubclassLabel(): ?string - { - $subclassLabel = $this->getPostParameter(self::SUBCLASS_LABEL); - - if ($subclassLabel !== null && !is_string($subclassLabel)) { - throw new common_exception_RestApi( - sprintf('%s parameter should be string', self::SUBCLASS_LABEL) - ); - } - - return $subclassLabel; - } - /** * @return string|null * @throws common_exception_RestApi @@ -379,18 +351,7 @@ private function getPackageLabel(): ?string */ private function getTestClass(): core_kernel_classes_Class { - $testClass = $this->getClassFromRequest(new core_kernel_classes_Class(TaoOntology::CLASS_URI_TEST)); - $subclassLabel = $this->getSubclassLabel(); - - if ($subclassLabel) { - foreach ($testClass->getSubClasses() as $subClass) { - if ($subClass->getLabel() === $subclassLabel) { - $testClass = $subClass; - } - } - } - - return $testClass; + return $this->getClassFromRequest(new core_kernel_classes_Class(TaoOntology::CLASS_URI_TEST)); } /**