Skip to content

Commit

Permalink
chore: remove unnecessary parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
shpran committed Aug 14, 2024
1 parent 539eb5f commit d92b93f
Showing 1 changed file with 2 additions and 41 deletions.
43 changes: 2 additions & 41 deletions actions/class.RestQtiTests.php
Original file line number Diff line number Diff line change
@@ -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));
}

/**

0 comments on commit d92b93f

Please sign in to comment.