mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Fix extractor, markdown formatter, and tests
This commit is contained in:
parent
4b1990b688
commit
fce0f5d5a6
@ -227,14 +227,14 @@ class ApiDocExtractor
|
|||||||
{
|
{
|
||||||
$comment = $reflected->getDocComment();
|
$comment = $reflected->getDocComment();
|
||||||
|
|
||||||
|
// Remove PHPDoc
|
||||||
|
$comment = preg_replace('/^\s+\* @[\w0-9]+.*/msi', '', $comment);
|
||||||
|
|
||||||
// let's clean the doc block
|
// let's clean the doc block
|
||||||
$comment = str_replace('/**', '', $comment);
|
$comment = str_replace('/**', '', $comment);
|
||||||
$comment = str_replace('*/', '', $comment);
|
$comment = str_replace('*/', '', $comment);
|
||||||
$comment = preg_replace('/^\s*\* ?/m', '', $comment);
|
$comment = preg_replace('/^\s*\* ?/m', '', $comment);
|
||||||
|
|
||||||
// Remove everything (and including) first annotation
|
|
||||||
$comment = preg_replace('/@[\w0-9]+\(.*/msi', '', $comment);
|
|
||||||
|
|
||||||
return trim($comment);
|
return trim($comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,10 @@ class MarkdownFormatter extends AbstractFormatter
|
|||||||
$markdown .= "\n\n";
|
$markdown .= "\n\n";
|
||||||
|
|
||||||
if (isset($data['documentation']) && !empty($data['documentation'])) {
|
if (isset($data['documentation']) && !empty($data['documentation'])) {
|
||||||
$markdown .= $data['documentation'];
|
if (isset($data['description']) && 0 === strcmp($data['description'], $data['documentation'])) {
|
||||||
$markdown .= "\n\n";
|
$markdown .= $data['documentation'];
|
||||||
|
$markdown .= "\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['requirements']) && !empty($data['requirements'])) {
|
if (isset($data['requirements']) && !empty($data['requirements'])) {
|
||||||
|
@ -126,11 +126,6 @@ _Action without HTTP verb_
|
|||||||
|
|
||||||
_This method is useful to test if the getDocComment works. And, it supports multilines until the first '@' char._
|
_This method is useful to test if the getDocComment works. And, it supports multilines until the first '@' char._
|
||||||
|
|
||||||
#### Documentation ####
|
|
||||||
|
|
||||||
This method is useful to test if the getDocComment works.
|
|
||||||
And, it supports multilines until the first '@' char.
|
|
||||||
|
|
||||||
#### Requirements ####
|
#### Requirements ####
|
||||||
|
|
||||||
**id**
|
**id**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user