本文整理汇总了PHP中Tag::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::getName方法的具体用法?PHP Tag::getName怎么用?PHP Tag::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::getName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTags
/**
* @param array $tags
*/
public function setTags(array $tags)
{
foreach ($tags as $tag) {
$tag = new Tag($tag);
$this->tags[$tag->getName()] = $tag;
}
}
示例2: __toString
public function __toString()
{
if (isset($this->pointer)) {
$tag_name = Tag::getName($this->tag);
return isset($this->symbol_table) ? "[" . $tag_name . ", " . $this->symbol_table->get($this->pointer) . "]" : "[" . $tag_name . ", " . $this->pointer . "]";
}
return "[" . $this->tag . "]";
}
示例3: renderTagHead
public function renderTagHead(Tag $tag)
{
$res = '## [' . $tag->getName() . ']';
if ($tag->getDate()) {
$res .= ' - ' . $tag->getDate();
}
return $res . "\n";
}
示例4: __construct
public function __construct(AbstractObject $parent, $summary = '', Tag $tag = null)
{
parent::__construct($parent);
$this->summary = $summary;
$this->operationid = uniqid('', true);
//@todo getSwagger()->title -> Do some complex construction?
if ($tag) {
$this->tags[] = $tag->getName();
}
}
示例5: shouldBeTogether
/**
* Should the given tags be kept together, or kept apart?
*
* @param Tag $first
* @param Tag $second
*
* @return bool
*/
public static function shouldBeTogether(Tag $first, Tag $second)
{
$firstName = $first->getName();
$secondName = $second->getName();
if ($firstName === $secondName) {
return true;
}
foreach (self::$groups as $group) {
if (in_array($firstName, $group, true) && in_array($secondName, $group, true)) {
return true;
}
}
return false;
}
示例6: testCreate
public function testCreate()
{
$tag = new Tag('a');
$this->assertSame("a", $tag->getName());
$this->assertSame("<a></a>", $tag->render());
$tag->href = "TEST";
$this->assertSame('<a href="TEST"></a>', $tag->render());
$img = new Tag('img');
$this->assertSame('<img>', $img->render());
$tag->addChild($img);
$this->assertSame('<a href="TEST"><img></a>', $tag->render());
$img->src = "http://github.com/";
$this->assertSame('<a href="TEST"><img src="http://github.com/"></a>', $tag->render());
$tag->addText('Click me');
$this->assertSame('<a href="TEST"><img src="http://github.com/">Click me</a>', $tag->render());
$tag->addText('<some text>');
$this->assertSame('<a href="TEST"><img src="http://github.com/">Click me<some text></a>', $tag->render());
// getText - text at wrong index
$this->assertSame(NULL, $tag->getText());
// getText - text at index 0
$tag->setText('<some text>');
$this->assertSame('<some text>', $tag->getText());
}
示例7: addTag
/**
* Adds tag.
* @param Tag $tag
* @param boolean $prependNotes default is append
* @return Tag the added tag
*/
public function addTag(Tag $tag, $prependNotes = false)
{
return $this->findTag($tag->getName())->setDate($tag->getDate())->addNotes($tag->getNotes(), $prependNotes);
}
示例8: addTag
/**
* Helper function to add a tag to a tree.
*
* @param Tag $tag - the Tag to add
* @param TreeNode $parent - the current parent node
* @return TreeNode - the new parent node
* @author Karthik Viswanathan
*/
private function addTag($tag, $parent)
{
if ($tag->isClosing()) {
// if there is some discrepency on what the tag closes,
// just move up the tree until a similar opening tag is found
// if no similar opening tag can be found, assume that
// the parent tag is still unclosed
$findParent = $parent;
while ($findParent != null && $findParent->getValue()->getName() != $tag->getName()) {
$findParent = $findParent->getParent();
if ($findParent->getValue() != 'root') {
break;
}
}
if ($findParent != null) {
return $findParent->getParent();
}
return $parent;
}
$node = $this->appendToTree($tag, $parent);
$tag->setNode($node);
$this->populateTagArray($tag);
// self closed means the parent is still unclosed
if ($tag->isSelfClosed()) {
return $parent;
}
return $node;
}
示例9: assignTagToCve
public function assignTagToCve(Cve &$cve, Tag &$tag)
{
if ($cve == null || $cve->getId() == -1 || $tag == null) {
Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
throw new Exception("Cve object is not valid or Cve.id is not set");
}
# Check if the tag name is valid
if ($tag->getName() == "") {
$tag->setName(Constants::$NA);
}
$tagId = $this->getTagIdByName($tag->getName());
if ($tagId == -1) {
$this->getPakiti()->getDao("Tag")->create($tag);
} else {
$tag->setId($tagId);
}
Utils::log(LOG_DEBUG, "Assinging the tag to the cve [cveId=" . $cve->getId() . ",tag=" . $tag->getName() . "]", __FILE__, __LINE__);
# Check if the already assigned
$isAssigned = $this->getPakiti()->getManager("DbManager")->queryToSingleValue("select 1 from CveTag where\n \t \t\tcveId=" . $this->getPakiti()->getManager("DbManager")->escape($cve->getId()) . " and\n \t \t\ttagId=" . $this->getPakiti()->getManager("DbManager")->escape($tag->getId()));
if ($isAssigned != null) {
throw new Exception($cve->getName() . " is already associated with " . $tag->getName() . " tag!");
} else {
# Association between cve and cveTag doesn't exist, so create it
$this->getPakiti()->getManager("DbManager")->query("\n \t\tinsert into CveTag set\n \t\t\tcveId=" . $this->getPakiti()->getManager("DbManager")->escape($cve->getId()) . ",\n \t \t\ttagId=" . $this->getPakiti()->getManager("DbManager")->escape($tag->getId()) . ",\n \t \t\t`reason`='" . $this->getPakiti()->getManager("DbManager")->escape($tag->getReason()) . "'");
}
}
示例10: update
public function update(Tag &$tag)
{
$this->db->query("update Tag set\n \tname='" . $this->db->escape($tag->getName()) . "',\n \tdescription='" . $this->db->escape($tag->getName()) . "',\n \tenabled=" . $this->db->escape($tag->getEnabled()) . "\n where id=" . $tag->getId());
}
示例11: set
public function set(Tag $tag)
{
$this->setName($tag->getName());
$this->setDate($tag->getDate());
$this->setNotes($tag->getNotes());
}