From 97055a0419e49cf49bf557649477abf0ce2cb535 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 9 Mar 2017 16:26:22 +0100 Subject: [PATCH] Affichage de la description retour --- .../views/scripts/documentation/service.phtml | 11 ++--- library/Scores/Ws/Doc.php | 42 ++++++++++--------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/application/views/scripts/documentation/service.phtml b/application/views/scripts/documentation/service.phtml index b2ad4c26..2663fb96 100644 --- a/application/views/scripts/documentation/service.phtml +++ b/application/views/scripts/documentation/service.phtml @@ -25,11 +25,11 @@
    serviceMethods as $method) {?> -
  1. - - Détail -
  2. - +
  3. + + Détail +
  4. +
@@ -60,6 +60,7 @@
Retour
+

docReturn($method['return'], $this->serviceTypes);?>
diff --git a/library/Scores/Ws/Doc.php b/library/Scores/Ws/Doc.php index 943e6af5..03aff05b 100644 --- a/library/Scores/Ws/Doc.php +++ b/library/Scores/Ws/Doc.php @@ -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.= ''.$ref[2].''; break; case 'mysql': $urlMysql = $view->url(array( - 'controller' => 'ref', - 'action' => 'table', - 'q' => $ref[3], + 'controller' => 'ref', + 'action' => 'table', + 'q' => $ref[3], ), null, true); $comment.= ''.$ref[2].''; 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;