Implemented nested inline tag parsing;

Added unit tests for LongDescription.php;
Added the "src" folder as white listed for code coverage in the PHPUnit configuration;
Fixed the @covers annotation inside the CoversTagTest.php (isn't this ironic?).
This commit is contained in:
Vasil Rangelov
2012-11-10 11:49:23 +02:00
parent 36b46b9769
commit 4bb2c04673
4 changed files with 212 additions and 3 deletions
@@ -61,7 +61,34 @@ class LongDescription implements \Reflector
{
if (null === $this->parsedContents) {
$this->parsedContents = preg_split(
'/\{(\@.*?)\}/uS',
'/\{
# We want the whole tag line, but without the inline tag
# delimiters.
(\@
# The content should not be captured, or it will appear
# in the result separately.
(?:
# Match nested inline tags.
# Because we did not catch the tag delimiters
# earlier, we must be explicit with them here.
\{(?1)?\}
|
# "{@}" is not a valid inline tag. This ensures that
# having it occur inside an inline tag does not trip
# us up.
\{\@\}
|
# If we are not dealing with a nested inline tag,
# get the character, as long as it is not a closing
# tag delimiter.
# This is an alternative way of non-greedy matching.
[^\}]
)+ # We need to keep doing these checks for every
# character, since we never know where an inline tag
# is going to start at. The "+" ensures we are not
# treating "{@}" as a valid inline tag.
)
\}/xuS',
$this->contents,
null,
PREG_SPLIT_DELIM_CAPTURE
@@ -129,4 +156,4 @@ class LongDescription implements \Reflector
{
return 'Not yet implemented';
}
}
}