private function getSerialized(Property $property) { $serialization = array('type' => $property->getType(), 'datatype' => $property->getDataTypeId()); $this->addIdToSerialization($property, $serialization); $this->addTermsToSerialization($property, $serialization); $this->addStatementListToSerialization($property, $serialization); return $serialization; }
/** * @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'); } }