mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Added parsed inline tags.
This commit is contained in:
@@ -27,6 +27,9 @@ class LongDescription implements \Reflector
|
||||
/** @var \phpDocumentor\Reflection\DocBlock\Tags[] */
|
||||
protected $tags = array();
|
||||
|
||||
/** @var array The contents, as an array of strings and Tag objects. */
|
||||
protected $parsedContents = array();
|
||||
|
||||
/**
|
||||
* Parses the string for inline tags and if the Markdown class is included;
|
||||
* format the found text.
|
||||
@@ -35,11 +38,11 @@ class LongDescription implements \Reflector
|
||||
*/
|
||||
public function __construct($content)
|
||||
{
|
||||
if (preg_match('/\{\@(.+?)\}/u', $content, $matches)) {
|
||||
array_shift($matches);
|
||||
foreach ($matches as $tag) {
|
||||
$this->tags[] = Tag::createInstance('@' . $tag);
|
||||
}
|
||||
$this->parsedContents = preg_split('/{\@(.+?)\}/uS', $content, null, PREG_SPLIT_DELIM_CAPTURE);
|
||||
for ($i=1, $l = count($this->parsedContents); $i<$l; $i += 2) {
|
||||
$this->parsedContents[$i] = $this->tags[] = Tag::createInstance(
|
||||
'@' . $this->parsedContents[$i]
|
||||
);
|
||||
}
|
||||
|
||||
$this->contents = trim($content);
|
||||
@@ -55,6 +58,11 @@ class LongDescription implements \Reflector
|
||||
return $this->contents;
|
||||
}
|
||||
|
||||
public function getParsedContents()
|
||||
{
|
||||
return $this->parsedContents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a formatted variant of the Long Description using MarkDown.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user