Add test for DocBlock class

This commit is contained in:
Mike van Riel
2015-06-13 18:01:00 +02:00
committed by Mike van Riel
parent b87a111eb2
commit 5749b814fb
4 changed files with 160 additions and 325 deletions
+49 -56
View File
@@ -13,8 +13,7 @@
namespace phpDocumentor\Reflection;
use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Location;
use phpDocumentor\Reflection\Types\Context;
final class DocBlock
{
@@ -40,12 +39,6 @@ final class DocBlock
private $isTemplateEnd = false;
/**
* Parses the given docblock and populates the member fields.
*
* The constructor may also receive namespace information such as the
* current namespace and aliases. This information is used by some tags
* (e.g. return, param, etc.) to turn a relative Type into a FQCN.
*
* @param string $summary
* @param DocBlock\Description $description
* @param DocBlock\Tag[] $tags
@@ -77,6 +70,42 @@ final class DocBlock
$this->isTemplateStart = $isTemplateStart;
}
/**
* @return string
*/
public function getSummary()
{
return $this->summary;
}
/**
* @return DocBlock\Description
*/
public function getDescription()
{
return $this->description;
}
/**
* Returns the current context.
*
* @return Context
*/
public function getContext()
{
return $this->context;
}
/**
* Returns the current location.
*
* @return Location
*/
public function getLocation()
{
return $this->location;
}
/**
* Returns whether this DocBlock is the start of a Template section.
*
@@ -115,54 +144,6 @@ final class DocBlock
return $this->isTemplateEnd;
}
/**
* Returns the current context.
*
* @return Context
*/
public function getContext()
{
return $this->context;
}
/**
* Returns the current location.
*
* @return Location
*/
public function getLocation()
{
return $this->location;
}
/**
* @return string
*/
public function getSummary()
{
return $this->summary;
}
/**
* @return DocBlock\Description
*/
public function getDescription()
{
return $this->description;
}
/**
* Adds a tag to this DocBlock.
*
* @param Tag $tag The tag to add.
*
* @return void
*/
public function addTag(Tag $tag)
{
$this->tags[] = $tag;
}
/**
* Returns the tags for this DocBlock.
*
@@ -215,4 +196,16 @@ final class DocBlock
return false;
}
/**
* Adds a tag to this DocBlock.
*
* @param Tag $tag The tag to add.
*
* @return void
*/
private function addTag(Tag $tag)
{
$this->tags[] = $tag;
}
}