本文整理匯總了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;
}