From f67dfb05dbb734cdb00def845de46e7ca7fd3ff5 Mon Sep 17 00:00:00 2001 From: keith kirk Date: Thu, 25 Jul 2013 13:47:54 -0700 Subject: [PATCH] adds the ability to modify the `documentation` property inside custom extractor handlers --- Annotation/ApiDoc.php | 8 ++++++++ Extractor/ApiDocExtractor.php | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Annotation/ApiDoc.php b/Annotation/ApiDoc.php index 9b22792..fc27b9f 100644 --- a/Annotation/ApiDoc.php +++ b/Annotation/ApiDoc.php @@ -266,6 +266,14 @@ class ApiDoc $this->documentation = $documentation; } + /** + * @return string + */ + public function getDocumentation() + { + return $this->documentation; + } + /** * @return Boolean */ diff --git a/Extractor/ApiDocExtractor.php b/Extractor/ApiDocExtractor.php index 720a593..e571574 100644 --- a/Extractor/ApiDocExtractor.php +++ b/Extractor/ApiDocExtractor.php @@ -239,6 +239,9 @@ class ApiDocExtractor // create a new annotation $annotation = clone $annotation; + // doc + $annotation->setDocumentation($this->commentExtractor->getDocCommentText($method)); + // parse annotations $this->parseAnnotations($annotation, $route, $method); @@ -247,7 +250,7 @@ class ApiDocExtractor // description if (null === $annotation->getDescription()) { - $comments = explode("\n", $this->commentExtractor->getDocCommentText($method)); + $comments = explode("\n", $annotation->getDocumentation()); // just set the first line $comment = trim($comments[0]); $comment = preg_replace("#\n+#", ' ', $comment); @@ -259,9 +262,6 @@ class ApiDocExtractor } } - // doc - $annotation->setDocumentation($this->commentExtractor->getDocCommentText($method)); - // input (populates 'parameters' for the formatters) if (null !== $input = $annotation->getInput()) { $parameters = array();