Affichage de la description retour

This commit is contained in:
Michael RICOIS 2017-03-09 16:26:22 +01:00
parent c1b1686296
commit 97055a0419
2 changed files with 28 additions and 25 deletions

View File

@ -25,11 +25,11 @@
<div class="panel-body">
<ol>
<?php foreach ($this->serviceMethods as $method) {?>
<li>
<b><?php echo $method['name'];?></b>
<a href="#<?php echo $method['name'];?>"><i>Détail</i></a>
</li>
<?php } ?>
<li>
<b><?php echo $method['name'];?></b>
<a href="#<?php echo $method['name'];?>"><i>Détail</i></a>
</li>
<?php }?>
</ol>
</div>
</div>
@ -60,6 +60,7 @@
<h5>Retour</h5>
<div class="bs-callout bs-callout-php">
<?php if ($method['returnDesc'] != '') {?><?=$method['returnDesc']?><br/><br/><?php }?>
<?=$this->docReturn($method['return'], $this->serviceTypes);?>
</div>

View File

@ -39,8 +39,7 @@ class Scores_Ws_Doc
private function parseService()
{
$class = new Zend_Server_Reflection();
$methods = $class->reflectClass($this->serviceClass)
->getMethods();
$methods = $class->reflectClass($this->serviceClass)->getMethods();
$methodsElement = array();
foreach ($methods as $method) {
$prototype = null;
@ -56,9 +55,9 @@ class Scores_Ws_Doc
$paramsElement = array();
foreach ($prototype->getParameters() as $param) {
$paramElement = array(
'type' => $param->getType(),
'name' => $param->getName(),
'description' => $param->getDescription(),
'type' => $param->getType(),
'name' => $param->getName(),
'description' => $param->getDescription(),
);
if ($param->isOptional()) {
@ -68,11 +67,14 @@ class Scores_Ws_Doc
$paramsElement[] = $paramElement;
}
$return = $prototype->getReturnValue();
$methodElement = array(
'name' => $method->getName(),
'desc' => $method->getDescription(),
'params' => $paramsElement,
'return' => $prototype->getReturnType(),
'name' => $method->getName(),
'desc' => $method->getDescription(),
'params' => $paramsElement,
'return' => $prototype->getReturnType(),
'returnDesc' => $return->getDescription(),
);
$methodsElement[] = $methodElement;
@ -101,8 +103,8 @@ class Scores_Ws_Doc
$docBlock = preg_replace('/\n/', '', $property->getDocComment());
if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+\s+(?:\*|@)/m', $docBlock, $docBlockMatches)) {
$comment.= preg_replace(
array('/\r/', '/\*/' ),
array('', ''), $docBlockMatches[1]
array('/\r/', '/\*/' ),
array('', ''), $docBlockMatches[1]
);
}
@ -147,17 +149,17 @@ class Scores_Ws_Doc
switch ($ref[1]) {
case 'fichier':
$urlFichier = $view->url(array(
'controller' => 'ref',
'action' => 'fichier',
'q' => $ref[3],
'controller' => 'ref',
'action' => 'fichier',
'q' => $ref[3],
), null, true);
$comment.= '<a href="'.$urlFichier.'">'.$ref[2].'</a>';
break;
case 'mysql':
$urlMysql = $view->url(array(
'controller' => 'ref',
'action' => 'table',
'q' => $ref[3],
'controller' => 'ref',
'action' => 'table',
'q' => $ref[3],
), null, true);
$comment.= '<a href="'.$urlMysql.'">'.$ref[2].'</a>';
break;
@ -166,9 +168,9 @@ class Scores_Ws_Doc
}
}
$paramElement = array(
'name' => $name,
'type' => $type,
'description' => trim($comment)
'name' => $name,
'type' => $type,
'description' => trim($comment)
);
}
$paramsElement[] = $paramElement;