mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Removed LongDescription::getTags() and made parsing to occur only the first time it's requested.
This commit is contained in:
@@ -24,11 +24,8 @@ class LongDescription implements \Reflector
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
protected $contents = '';
|
protected $contents = '';
|
||||||
|
|
||||||
/** @var \phpDocumentor\Reflection\DocBlock\Tags[] */
|
|
||||||
protected $tags = array();
|
|
||||||
|
|
||||||
/** @var array The contents, as an array of strings and Tag objects. */
|
/** @var array The contents, as an array of strings and Tag objects. */
|
||||||
protected $parsedContents = array();
|
protected $parsedContents = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the string for inline tags and if the Markdown class is included;
|
* Parses the string for inline tags and if the Markdown class is included;
|
||||||
@@ -38,16 +35,7 @@ class LongDescription implements \Reflector
|
|||||||
*/
|
*/
|
||||||
public function __construct($content)
|
public function __construct($content)
|
||||||
{
|
{
|
||||||
$this->parsedContents = preg_split(
|
$this->contents = trim($content);
|
||||||
'/\{(\@.*)\}/uS',
|
|
||||||
$this->contents = trim($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]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,6 +56,17 @@ class LongDescription implements \Reflector
|
|||||||
*/
|
*/
|
||||||
public function getParsedContents()
|
public function getParsedContents()
|
||||||
{
|
{
|
||||||
|
if (null === $this->parsedContents) {
|
||||||
|
$this->parsedContents = preg_split(
|
||||||
|
'/\{(\@.*)\}/uS', $this->contents,
|
||||||
|
null, PREG_SPLIT_DELIM_CAPTURE
|
||||||
|
);
|
||||||
|
for ($i=1, $l = count($this->parsedContents); $i<$l; $i += 2) {
|
||||||
|
$this->parsedContents[$i] = Tag::createInstance(
|
||||||
|
$this->parsedContents[$i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $this->parsedContents;
|
return $this->parsedContents;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,16 +101,6 @@ class LongDescription implements \Reflector
|
|||||||
return trim($result);
|
return trim($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of tags mentioned in the text.
|
|
||||||
*
|
|
||||||
* @return \phpDocumentor\Reflection\DocBlock\Tags[]
|
|
||||||
*/
|
|
||||||
public function getTags()
|
|
||||||
{
|
|
||||||
return $this->tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a string representation of this object.
|
* Builds a string representation of this object.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user