本文整理汇总了PHP中core_kernel_classes_Class::setPropertiesValues方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Class::setPropertiesValues方法的具体用法?PHP core_kernel_classes_Class::setPropertiesValues怎么用?PHP core_kernel_classes_Class::setPropertiesValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_kernel_classes_Class
的用法示例。
在下文中一共展示了core_kernel_classes_Class::setPropertiesValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createInstance
/**
* Short description of method createInstance
*
* @access public
* @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
* @param Class clazz
* @param string label
* @param string comment
* @param string uri
* @return core_kernel_classes_Resource
*/
public static function createInstance(core_kernel_classes_Class $clazz, $label = '', $comment = '', $uri = '')
{
$returnValue = null;
$newUri = !empty($uri) ? self::checkProvidedUri($uri) : common_Utils::getNewUri();
$newResource = new core_kernel_classes_Class($newUri);
$propertiesValues = array(RDF_TYPE => $clazz->getUri());
if (!empty($label)) {
$propertiesValues[RDFS_LABEL] = $label;
}
if (!empty($comment)) {
$propertiesValues[RDFS_COMMENT] = $comment;
}
$check = $newResource->setPropertiesValues($propertiesValues);
if ($check) {
$returnValue = $newResource;
} else {
$msg = "Failed to create an instance of class '" . $clazz->getUri() . "'.";
throw new common_Exception($msg);
common_Logger::e($msg);
}
return $returnValue;
}
示例2: createSubClass
/**
* (non-PHPdoc)
* @see core_kernel_persistence_ClassInterface::createSubClass()
*/
public function createSubClass(core_kernel_classes_Class $resource, $label = '', $comment = '', $uri = '')
{
if (!empty($uri)) {
common_Logger::w('Use of parameter uri in ' . __METHOD__ . ' is deprecated');
}
$uri = empty($uri) ? common_Utils::getNewUri() : $uri;
$returnValue = new core_kernel_classes_Class($uri, __METHOD__);
$properties = array(RDFS_SUBCLASSOF => $resource);
if (!empty($label)) {
$properties[RDFS_LABEL] = $label;
}
if (!empty($comment)) {
$properties[RDFS_COMMENT] = $comment;
}
$returnValue->setPropertiesValues($properties);
return $returnValue;
}