本文整理汇总了PHP中phpDocumentor\Reflection\DocBlock\Tag::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::getName方法的具体用法?PHP Tag::getName怎么用?PHP Tag::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpDocumentor\Reflection\DocBlock\Tag
的用法示例。
在下文中一共展示了Tag::getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format
/**
* Formats the given tag to return a simple plain text version.
*
* @param Tag $tag
*
* @return string
*/
public function format(Tag $tag)
{
return '@' . $tag->getName() . ' ' . (string) $tag;
}
示例2: buildDocBlockTag
/**
* Export this tag to the given DocBlock.
*
* This method also invokes the 'reflection.docblock.tag.export' which can
* be used to augment the data. This is useful for plugins so that they
* can provide custom tags.
*
* @param \DOMElement $parent Element to augment.
* @param Tag $tag The tag to export.
* @param BaseReflector $element Element to log from.
*
* @return void
*/
public function buildDocBlockTag(\DOMElement $parent, $tag, $element)
{
if (!$tag) {
// TODO #840: Workaround; for some reason there are NULLs in the tags array.
return;
}
$child = new \DOMElement('tag');
$parent->appendChild($child);
$child->setAttribute('name', $tag->getName());
$child->setAttribute('description', htmlspecialchars($tag->getDescription(), ENT_QUOTES, 'UTF-8'));
$child->setAttribute('line', $parent->getAttribute('line'));
if (method_exists($tag, 'getTypes')) {
$typeString = '';
foreach ($tag->getTypes() as $type) {
$child->appendChild(new \DOMElement('type', $type));
$typeString .= $type . '|';
}
$child->setAttribute('type', rtrim($typeString, '|'));
}
if (method_exists($tag, 'getVariableName')) {
$child->setAttribute('variable', $tag->getVariableName());
}
// TODO: Serialize specific tag information
}
示例3: testConstructorParesInputsIntoCorrectFields
/**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\VarTag can
* understand the @var doc block.
*
* @param string $type
* @param string $content
* @param string $exDescription
*
* @covers \phpDocumentor\Reflection\DocBlock\Tag
* @dataProvider provideDataForConstuctor
*
* @return void
*/
public function testConstructorParesInputsIntoCorrectFields($type, $content, $exDescription)
{
$tag = new Tag($type, $content);
$this->assertEquals($type, $tag->getName());
$this->assertEquals($content, $tag->getContent());
$this->assertEquals($exDescription, $tag->getDescription());
}
示例4: create
/**
* Creates a new Descriptor from the given Reflector.
*
* @param Tag $data
*
* @return TagDescriptor
*/
public function create($data)
{
$descriptor = new TagDescriptor($data->getName());
$descriptor->setDescription($data->getDescription());
return $descriptor;
}
示例5: create
/**
* Creates a new instance of this class or one of the specialized sub-classes.
*
* @param string $namespace Namespace
* where this tag occurs.
* @param string[] $namespace_aliases Aliases
* used for all namespaces at the location of this tag.
* @param \SimpleXMLElement $xml Root xml
* element for this tag.
* @param \phpDocumentor\Reflection\DocBlock\Tag $tag The
* actual tag as reflected.
*
* @todo replace the switch statement with an intelligent container /
* plugin system.
*
* @return Definition
*/
public static function create($namespace, $namespace_aliases, \SimpleXMLElement $xml, \phpDocumentor\Reflection\DocBlock\Tag $tag)
{
$tag_name = $tag->getName();
// check whether the tag name is namespaced and replace alias with full
// name to get the FQCN form
if (strpos($tag_name, '\\') !== false) {
$tag_name = explode('\\', $tag_name);
if (count($tag_name) > 1 && isset($namespace_aliases[$tag_name[0]])) {
$tag_name[0] = $namespace_aliases[$tag_name[0]];
}
$tag_name = implode('\\', $tag_name);
if ($tag_name[0] != '\\') {
$tag_name = '\\' . $tag_name;
}
}
switch ($tag_name) {
case 'property-write':
case 'property-read':
case 'property':
case 'param':
$def = new Param($namespace, $namespace_aliases, $xml, $tag);
break;
case 'see':
$def = new See($namespace, $namespace_aliases, $xml, $tag);
break;
case 'method':
$def = new Method($namespace, $namespace_aliases, $xml, $tag);
break;
case 'uses':
$def = new Uses($namespace, $namespace_aliases, $xml, $tag);
break;
case 'covers':
$def = new Covers($namespace, $namespace_aliases, $xml, $tag);
break;
case 'link':
$def = new Link($namespace, $namespace_aliases, $xml, $tag);
break;
case '\\Doctrine\\ORM\\Mapping\\column':
case '\\Doctrine\\ORM\\Mapping\\ChangeTrackingPolicy':
case '\\Doctrine\\ORM\\Mapping\\DiscriminatorColumn':
case '\\Doctrine\\ORM\\Mapping\\DiscriminatorMap':
case '\\Doctrine\\ORM\\Mapping\\Entity':
case '\\Doctrine\\ORM\\Mapping\\GeneratedValue':
case '\\Doctrine\\ORM\\Mapping\\HasLifecycleCallbacks':
case '\\Doctrine\\ORM\\Mapping\\Id':
case '\\Doctrine\\ORM\\Mapping\\InheritanceType':
case '\\Doctrine\\ORM\\Mapping\\JoinColumn':
case '\\Doctrine\\ORM\\Mapping\\JoinTable':
case '\\Doctrine\\ORM\\Mapping\\ManyToOne':
case '\\Doctrine\\ORM\\Mapping\\ManyToMany':
case '\\Doctrine\\ORM\\Mapping\\MappedSuperclass':
case '\\Doctrine\\ORM\\Mapping\\OneToOne':
case '\\Doctrine\\ORM\\Mapping\\OneToMany':
case '\\Doctrine\\ORM\\Mapping\\OrderBy':
case '\\Doctrine\\ORM\\Mapping\\PostLoad':
case '\\Doctrine\\ORM\\Mapping\\PostPersist':
case '\\Doctrine\\ORM\\Mapping\\PostRemove':
case '\\Doctrine\\ORM\\Mapping\\PostUpdate':
case '\\Doctrine\\ORM\\Mapping\\PrePersist':
case '\\Doctrine\\ORM\\Mapping\\PreRemove':
case '\\Doctrine\\ORM\\Mapping\\PreUpdate':
case '\\Doctrine\\ORM\\Mapping\\SequenceGenerator':
case '\\Doctrine\\ORM\\Mapping\\Table':
case '\\Doctrine\\ORM\\Mapping\\UniqueConstraint':
case '\\Doctrine\\ORM\\Mapping\\Version':
case 'Column':
case 'ChangeTrackingPolicy':
case 'DiscriminatorColumn':
case 'DiscriminatorMap':
case 'Entity':
case 'GeneratedValue':
case 'HasLifecycleCallbacks':
case 'Id':
case 'InheritanceType':
case 'JoinColumn':
case 'JoinTable':
case 'ManyToOne':
case 'ManyToMany':
case 'MappedSuperclass':
case 'OneToOne':
case 'OneToMany':
case 'OrderBy':
case 'PostLoad':
//.........这里部分代码省略.........
示例6: createTagAnnotation
/**
* Creates (or keeps) a Tag from a phpDocumentor Tag.
* If a custom Tag class was registered, it has priority.
* @param Tag $tag
* @return Tag
*/
protected function createTagAnnotation(Tag $tag)
{
$name = $tag->getName();
// If our own map of tags doesn't have a registered class, keep the original tag.
if (isset($this->tagClassNameMap[$name])) {
$tagClassName = $this->tagClassNameMap[$name];
$annotationTag = new $tagClassName($tag->getName(), $tag->getContent(), $tag->getDocBlock(), $tag->getLocation());
} else {
$annotationTag = $tag;
}
return $annotationTag;
}