getName() public method

Gets the name of this tag.
public getName ( ) : string
return string The name of this tag.
コード例 #1
0
 /**
  * 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
0
ファイル: Xml.php プロジェクト: michaelyin1/Modern-Toolkit
 /**
  * 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
0
ファイル: TagTest.php プロジェクト: scrobot/Lumen
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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':
         case 'PostPersist':
         case 'PostRemove':
         case 'PostUpdate':
         case 'PrePersist':
         case 'PreRemove':
         case 'PreUpdate':
         case 'SequenceGenerator':
         case 'Table':
         case 'UniqueConstraint':
         case 'Version':
             $def = new Doctrine($namespace, $namespace_aliases, $xml, $tag);
             break;
         default:
             $def = new self($namespace, $namespace_aliases, $xml, $tag);
             break;
     }
     $def->configure();
     return $def;
 }
コード例 #6
0
ファイル: TagReader.php プロジェクト: bvarent/doc-block-tags
 /**
  * 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;
 }