本文整理汇总了PHP中core_kernel_classes_Resource::setLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::setLabel方法的具体用法?PHP core_kernel_classes_Resource::setLabel怎么用?PHP core_kernel_classes_Resource::setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_kernel_classes_Resource
的用法示例。
在下文中一共展示了core_kernel_classes_Resource::setLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPrefixToLabel
/**
* @param \core_kernel_classes_Resource $delivery
*/
private function addPrefixToLabel(\core_kernel_classes_Resource $delivery)
{
$label = $delivery->getLabel();
$label .= " - old";
//todo: use an option instead of hardcoded value
$delivery->setLabel($label);
}
示例2: storeDelivery
/**
* @param string deliveryIdentifier (uri recommended)
*/
public function storeDelivery(core_kernel_classes_Resource $deliveryResult, $deliveryIdentifier)
{
$propResultOfDelivery = new core_kernel_classes_Property(PROPERTY_RESULT_OF_DELIVERY);
$deliveryResult->editPropertyValues($propResultOfDelivery, $deliveryIdentifier);
try {
//if the delviery information is provided, update to a more meaningful delvieryResult Label
$delivery = new core_kernel_classes_Resource($deliveryIdentifier);
$deliveryLabel = $delivery->getLabel();
$deliveryResult->setLabel(str_replace("-" . $deliveryLabel, "", $deliveryResult->getLabel()) . "-" . $deliveryLabel);
} catch (Exception $e) {
//the test taker to be referrd in the delivery Result does not exist (or the label is not stated)
}
}
示例3: createInstance
/**
* (non-PHPdoc)
* @see core_kernel_persistence_ClassInterface::createInstance()
*/
public function createInstance(core_kernel_classes_Class $resource, $label = '', $comment = '', $uri = '')
{
$returnValue = null;
$subject = '';
if ($uri == '') {
$subject = common_Utils::getNewUri();
} else {
if ($uri[0] == '#') {
//$uri should start with # and be well formed
$modelUri = common_ext_NamespaceManager::singleton()->getLocalNamespace()->getUri();
$subject = rtrim($modelUri, '#') . $uri;
} else {
$subject = $uri;
}
}
$returnValue = new core_kernel_classes_Resource($subject, __METHOD__);
if (!$returnValue->hasType($resource)) {
$returnValue->setType($resource);
} else {
common_Logger::e('already had type ' . $resource);
}
if (!empty($label)) {
$returnValue->setLabel($label);
}
if (!empty($comment)) {
$returnValue->setComment($comment);
}
return $returnValue;
}