phpDocumentor\Reflection\DocBlock::getTagsByName PHP Method

getTagsByName() public method

Returns an array of tags matching the given name. If no tags are found an empty array is returned.
public getTagsByName ( string $name ) : Tag[]
$name string String to search by.
return phpDocumentor\Reflection\DocBlock\Tag[]
    public function getTagsByName($name)
    {
        $result = array();
        /** @var Tag $tag */
        foreach ($this->getTags() as $tag) {
            if ($tag->getName() != $name) {
                continue;
            }
            $result[] = $tag;
        }
        return $result;
    }

Usage Example

Beispiel #1
0
 public function getMethodsDetails()
 {
     $methods = [];
     foreach ($this->reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
         $docblock = new DocBlock($method);
         $data = ['shortDescription' => $docblock->getShortDescription(), 'longDescription' => $docblock->getLongDescription(), 'argumentsList' => $this->retriveParams($docblock->getTagsByName('param')), 'argumentsDescription' => $this->retriveParamsDescription($docblock->getTagsByName('param')), 'returnValue' => $this->retriveReturnValue($docblock->getTagsByName('return')), 'visibility' => join('', [$method->isFinal() ? 'final ' : '', 'public', $method->isStatic() ? ' static' : ''])];
         if (strlen($data['shortDescription'])) {
             $methods[$method->getName()] = (object) $data;
         }
     }
     return $methods;
 }
All Usage Examples Of phpDocumentor\Reflection\DocBlock::getTagsByName