Skip to content

Commit

Permalink
Mappings endpoint: Handle case when no label is found
Browse files Browse the repository at this point in the history
  • Loading branch information
danmichaelo committed Oct 25, 2018
1 parent 88a5a83 commit 20e1991
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions model/ConceptMappingPropertyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,18 @@ public function asJskos()

$label = $this->getLabel();
if (isset($label)) {
$ret['to']['memberSet'][0]['prefLabel'] = [
$label->getLang() => $label->getValue(),
];
if (is_string($label)) {
list($labelLang, $labelValue) = ['-', $label];
} else {
list($labelLang, $labelValue) = [$label->getLang(), $label->getValue()];
}
if ($labelValue != $this->getUri()) {
// The `queryLabel()` method above will fallback to returning the URI
// if no label was found. We don't want that here.
$ret['to']['memberSet'][0]['prefLabel'] = [
$labelLang => $labelValue,
];
}
}

return $ret;
Expand Down

0 comments on commit 20e1991

Please sign in to comment.