当前位置: 首页>>代码示例>>PHP>>正文


PHP SMWDataItem::newFromSerialization方法代码示例

本文整理汇总了PHP中SMWDataItem::newFromSerialization方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWDataItem::newFromSerialization方法的具体用法?PHP SMWDataItem::newFromSerialization怎么用?PHP SMWDataItem::newFromSerialization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMWDataItem的用法示例。


在下文中一共展示了SMWDataItem::newFromSerialization方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: newFromSerialization

 /**
  * Creates and returns a new SWLPropertyChange instance from a serialization.
  *
  * @param string|null $oldValue
  * @param string|null $newValue
  *
  * @return SWLPropertyChange
  */
 public static function newFromSerialization(SMWDIProperty $property, $oldValue, $newValue)
 {
     $diType = SMWDataValueFactory::getDataItemId($property->findPropertyTypeID());
     //var_dump($property);
     //if($diType!=7) {throw new Exception();exit;}
     return new self(is_null($oldValue) ? null : SMWDataItem::newFromSerialization($diType, $oldValue), is_null($newValue) ? null : SMWDataItem::newFromSerialization($diType, $newValue));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:SWL_PropertyChange.php

示例2: newFromSerialization

	/**
	 * Creates and returns a new SWLPropertyChange instance from a serialization.
	 *
	 * @param string|null $oldValue
	 * @param string|null $newValue
	 *
	 * @return SWLPropertyChange
	 */
	public static function newFromSerialization( SMWDIProperty $property, $oldValue, $newValue ) {
		$diType = SMWDataValueFactory::getDataItemId( $property->findPropertyTypeID() );

		return new self(
			is_null( $oldValue ) ? null : SMWDataItem::newFromSerialization( $diType, $oldValue ),
			is_null( $newValue ) ? null : SMWDataItem::newFromSerialization( $diType, $newValue )
		);
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:16,代码来源:SWL_PropertyChange.php

示例3: deserialize

 /**
  * @see ExpElement::newFromSerialization
  */
 protected static function deserialize($serialization)
 {
     $dataItem = null;
     if (!array_key_exists('dataitem', $serialization)) {
         throw new RuntimeException("The serialization format is missing a dataitem element");
     }
     // If it is null, isset will ignore it
     if (isset($serialization['dataitem'])) {
         $dataItem = DataItem::newFromSerialization($serialization['dataitem']['type'], $serialization['dataitem']['item']);
     }
     return $dataItem;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:15,代码来源:ExpElement.php

示例4: unserializeDataItem

 /**
  * @return DataItem
  */
 protected function unserializeDataItem($property, $data, $value, $semanticData)
 {
     $dataItem = null;
     $type = $this->getDataItemId($property);
     // Verify that the current property type definition and the type of the
     // property during serialization do match, throw an error value to avoid any
     // exception during unserialization caused by the DataItem object due to a
     // mismatch of type definitions
     if ($type === $value['type']) {
         $dataItem = DataItem::newFromSerialization($value['type'], $value['item']);
     } else {
         $dataItem = $property->getDiWikiPage();
         $property = new DIProperty(DIProperty::TYPE_ERROR);
         $semanticData->addError(array(new ErrorValue($type, 'type mismatch', $property->getLabel())));
     }
     // Check whether the current dataItem has a subobject reference
     if ($dataItem->getDIType() === DataItem::TYPE_WIKIPAGE && $dataItem->getSubobjectName() !== '') {
         $dataItem = $this->unserializeSubobject($data, $value['item'], new SMWContainerSemanticData($dataItem));
     }
     // Ensure that errors are collected from a subobject level as well and
     // made available at the top
     if ($dataItem instanceof DIContainer) {
         $semanticData->addError($dataItem->getSemanticData()->getErrors());
     }
     if ($property !== null && $dataItem !== null) {
         $semanticData->addPropertyObjectValue($property, $dataItem);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:31,代码来源:SemanticDataDeserializer.php

示例5: getExpectedDataItems

 /**
  * @since 2.2
  *
  * @return DataItem[]
  */
 public function getExpectedDataItems()
 {
     $dataItems = array();
     if (!isset($this->contents['queryresult']['dataitems'])) {
         return $dataItems;
     }
     foreach ($this->contents['queryresult']['dataitems'] as $dataitem) {
         $dataItems[] = DataItem::newFromSerialization(DataTypeRegistry::getInstance()->getDataItemId($dataitem['type']), $dataitem['value']);
     }
     return $dataItems;
 }
开发者ID:hangya,项目名称:SemanticMediaWiki,代码行数:16,代码来源:QueryTestCaseInterpreter.php


注:本文中的SMWDataItem::newFromSerialization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。