Move serializer to seperate class

This commit is contained in:
Barry vd. Heuvel
2013-05-26 22:36:31 +02:00
parent d57128e65c
commit cbb14bab1e
2 changed files with 132 additions and 30 deletions
+10 -30
View File
@@ -229,12 +229,12 @@ class DocBlock implements \Reflector
$this->tags = $result;
}
public function getDescription(){
public function getText(){
$short = $this->getShortDescription();
$long = $this->getLongDescription()->getContents();
if($long){
return $short . "\n" . $long;
return $short . "\n\n" . $long;
}else{
return $short;
}
@@ -243,11 +243,11 @@ class DocBlock implements \Reflector
/**
* Set the short and long description.
*
* @param $docblock
* @param string $docblock
* @return $this
*/
public function setDescription($docblock){
list($short, $long) = $this->splitDocBlock($docblock);
public function setText($comment){
list($short, $long) = $this->splitDocBlock($comment);
$this->short_description = $short;
$this->long_description = new DocBlock\Description($long, $this);
return $this;
@@ -344,14 +344,14 @@ class DocBlock implements \Reflector
return false;
}
/**
* Appends a tag at the end of the list of tags.
*
*
* @param Tag $tag The tag to add.
*
*
* @return Tag The newly added tag.
*
*
* @throws \LogicException When the tag belongs to a different DocBlock.
*/
public function appendTag(Tag $tag)
@@ -359,7 +359,7 @@ class DocBlock implements \Reflector
if (null === $tag->getDocBlock()) {
$tag->setDocBlock($this);
}
if ($tag->getDocBlock() === $this) {
$this->tags[] = $tag;
} else {
@@ -371,26 +371,6 @@ class DocBlock implements \Reflector
return $tag;
}
/**
* Generate a DocBlock Comment
*
* @return string
*/
public function getDocComment($indentation = ''){
$description = str_replace("\n", "\n$indentation * ", $this->getDescription());
$comment = "$indentation/**\n$indentation * $description\n$indentation *\n";
/** @var Tag $tag */
foreach ($this->getTags() as $tag) {
$comment .= $indentation.' * @'. $tag->getName() . " " . $tag->getContent() . "\n";
}
$comment .= $indentation.' */';
return $comment;
}
/**
* Builds a string representation of this object.