private function addHyperlinks() { $builder = $this->urlBuilder; $id = $this->property->getId(); $this->simpleProperty->labelUrl = $builder->getApiPropertyLabelUrl($id); $this->simpleProperty->descriptionUrl = $builder->getApiPropertyDescriptionUrl($id); $this->simpleProperty->aliasesUrl = $builder->getApiPropertyAliasesUrl($id); $this->simpleProperty->wikidataUrl = $builder->getWdEntityUrl($id); $this->simpleProperty->dataUrl = $builder->getApiPropertyDataUrl($id); }
private function addIdToSerialization(Property $property, array &$serialization) { $id = $property->getId(); if ($id !== null) { $serialization['id'] = $id->getSerialization(); } }
/** * @param EntityId|Item|Property $target * * @throws UnexpectedValueException * @return EntityId|SiteLink * * @todo Fix duplicated code */ private function getEntityIdentifierFromTarget($target) { if ($target instanceof Item || $target instanceof Property) { return $target->getId(); } else { return $target; } }
protected function assertHasCorrectIdType(Property $property) { $this->assertInstanceOf('Wikibase\\DataModel\\Entity\\PropertyId', $property->getId()); }
public function listEntitiesProvider() { $property = new Property(new PropertyId('P1'), null, 'string'); $item = new Item(new ItemId('Q5')); $redirect = new EntityRedirect(new ItemId('Q55'), new ItemId('Q5')); return array('empty' => array(array(), array(), null, 100, null, EntityPerPage::NO_REDIRECTS, array()), 'some entities' => array(array($item, $property), array($redirect), null, 100, null, EntityPerPage::NO_REDIRECTS, array($property, $item)), 'entities after' => array(array($item, $property), array($redirect), null, 100, $property->getId(), EntityPerPage::NO_REDIRECTS, array($item)), 'include redirects' => array(array($item, $property), array($redirect), null, 100, null, EntityPerPage::INCLUDE_REDIRECTS, array($property, $item, $redirect)), 'only redirects' => array(array($item, $property), array($redirect), null, 100, null, EntityPerPage::ONLY_REDIRECTS, array($redirect)), 'just properties' => array(array($item, $property), array($redirect), Property::ENTITY_TYPE, 100, null, EntityPerPage::NO_REDIRECTS, array($property)), 'limit' => array(array($item, $property), array($redirect), Property::ENTITY_TYPE, 1, null, EntityPerPage::NO_REDIRECTS, array($property)), 'no matches' => array(array($property), array($redirect), Item::ENTITY_TYPE, 100, null, EntityPerPage::NO_REDIRECTS, array())); }
private function addIdLinks() { $this->simpleProperty->ids['wikidata'] = $this->property->getId()->getSerialization(); }