/** * @param EntityId $entityId * * @return Term[] array with keys 'label' and 'description' */ private function getDisplayTerms(EntityId $entityId) { $displayTerms = array(); $displayTerms['label'] = $this->labelDescriptionLookup->getLabel($entityId); $displayTerms['description'] = $this->labelDescriptionLookup->getDescription($entityId); return $displayTerms; }
/** * @param string $prefixedEntityId * * @since 0.5 * @return string|null Null if entity couldn't be found/ no description present */ public function getDescription($prefixedEntityId) { try { $entityId = $this->entityIdParser->parse($prefixedEntityId); } catch (EntityIdParsingException $e) { return null; } try { $term = $this->labelDescriptionLookup->getDescription($entityId); } catch (StorageException $ex) { // TODO: verify this catch is still needed return null; } catch (LabelDescriptionLookupException $ex) { return null; } if ($term === null) { return null; } // XXX: This. Sucks. A lot. // Also notes about language fallbacks from getLabel apply $this->usageAccumulator->addOtherUsage($entityId); return $term->getText(); }