本文整理汇总了PHP中Attribute::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Attribute::setName方法的具体用法?PHP Attribute::setName怎么用?PHP Attribute::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attribute
的用法示例。
在下文中一共展示了Attribute::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGroupsToArray
public function testGroupsToArray()
{
$array = array('BMI' => array('groups' => array('group1', 'group2')));
$attr = new Attribute();
$attr->setName('BMI');
$attr->addGroup('group1');
$attr->addGroup('group2');
$this->assertEquals($array, $attr->toArray());
}
示例2: parseAttributes
protected function parseAttributes()
{
$attributes = array();
foreach ($this->XPath->evaluate('//dd:DataDescription/Dictionary[@default="true"]/Field') as $f) {
$attribute = new Attribute();
foreach ($f->childNodes as $n) {
if ($n->nodeName == "Name") {
$attribute->setName($n->nodeValue);
}
if ($n->nodeName == "Category") {
$attribute->addCategory($n->nodeValue);
}
if ($n->nodeName == "Interval") {
$closure = $n->getAttribute('closure');
$interval = substr($closure, 0, 4) === 'open' ? '(' : '<';
$interval .= $n->getAttribute('leftMargin') . ';' . $n->getAttribute('rightMargin');
$interval .= substr($closure, -4, 4) === 'Open' ? ')' : '>';
$attribute->addInterval($interval);
}
}
array_push($attributes, $attribute);
}
return $attributes;
}
示例3: create
/**
* Creates SK ITC Bundle DTD Attribute List
*
* @param string $source
* SK ITC Bundle DTD Attribute List Source
* @return \SK\ITCBundle\ORM\DTD\AttributeList
*/
public static function create($source, Document $document)
{
$entity = null;
$sourceAttributes = explode(" ", $source);
$instance = new self($source);
$entity = array_shift($sourceAttributes);
$j = 0;
for ($i = 0; $i < count($sourceAttributes); $i++) {
$sourceAttribute = $sourceAttributes[$i];
if (preg_match("/%/", $sourceAttribute) && $j == 0) {
$j = $j + 2;
$attribute = new Attribute("");
$instance->setAttribute($attribute);
} else {
$column = $j % 3;
switch ($column) {
case 0:
$attributeName = $sourceAttribute;
++$j;
break;
case 1:
$attributeEntity = $sourceAttribute;
++$j;
break;
case 2:
$attributeDefaultValue = $sourceAttribute;
$attribute = new Attribute("");
$attribute->setDocument($document);
$attribute->setName($attributeName);
$attribute->setEntity($document->getEntity($attributeEntity));
$attribute->setDefaultValue($attributeDefaultValue);
$instance->setAttribute($attribute);
$j = 0;
break;
}
}
}
return $instance;
}