本文整理汇总了PHP中Wikibase\DataModel\Entity\Item::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getType方法的具体用法?PHP Item::getType怎么用?PHP Item::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikibase\DataModel\Entity\Item
的用法示例。
在下文中一共展示了Item::getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSerialized
private function getSerialized(Item $item)
{
$serialization = array('type' => $item->getType());
$this->addIdToSerialization($item, $serialization);
$this->addTermsToSerialization($item, $serialization);
$this->addStatementListToSerialization($item, $serialization);
$this->addSiteLinksToSerialization($item, $serialization);
return $serialization;
}
示例2: applyConstraintChecks
/**
* Throws an exception if it would not be possible to save the updated items
* @throws ChangeOpException
*/
private function applyConstraintChecks(Item $item, ItemId $fromId)
{
$constraintValidator = new CompositeEntityValidator($this->constraintProvider->getUpdateValidators($item->getType()));
$result = $constraintValidator->validateEntity($item);
$errors = $result->getErrors();
$errors = $this->removeConflictsWithEntity($errors, $fromId);
if (!empty($errors)) {
$result = Result::newError($errors);
throw new ChangeOpValidationException($result);
}
}
示例3: getContentFromEntity
/**
* @param Item|Property $entity
*
* @throws RuntimeException
* @return ItemContent|PropertyContent
* @todo this could be factored into a different class?
*/
private function getContentFromEntity($entity)
{
switch ($entity->getType()) {
case Item::ENTITY_TYPE:
return new ItemContent($entity);
case Property::ENTITY_TYPE:
return new PropertyContent($entity);
default:
throw new RuntimeException('I cant get a content for this type of entity');
}
}