Browse Source

index description

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
8b63ffb1a2
2 changed files with 8 additions and 5 deletions
  1. 7
    4
      src/Doc/Business/LuDocBusiness.php
  2. 1
    1
      src/Doc/Templates/index.html.twig

+ 7
- 4
src/Doc/Business/LuDocBusiness.php View File

@@ -11,7 +11,6 @@ namespace Luticate\Doc\Business;
11 11
 use Luticate\Utils\LuRoute;
12 12
 use Luticate\Utils\LuRouteDbo;
13 13
 use ReflectionMethod;
14
-use Twig_Autoloader;
15 14
 use Twig_Environment;
16 15
 use Twig_Loader_Filesystem;
17 16
 
@@ -91,10 +90,16 @@ class LuDocBusiness
91 90
             $business_tiwg["routes"] = [];
92 91
 
93 92
             foreach ($businesses as $business) {
93
+                $reflection = new ReflectionMethod($business->getBusinessClass(), $business->getBusinessMethod());
94
+                $description = $reflection->getDocComment();
95
+                if ($description === false) {
96
+                    $description = "No description available";
97
+                }
94 98
                 $business_tiwg["routes"][] = [
95 99
                     "method" => $business->getMethod(),
96 100
                     "url" => $business->getUrl(),
97
-                    "businessMethod" => $business->getBusinessMethod()
101
+                    "businessMethod" => $business->getBusinessMethod(),
102
+                    "description" => $description
98 103
                 ];
99 104
             }
100 105
             $businesses_tiwg[] = $business_tiwg;
@@ -105,8 +110,6 @@ class LuDocBusiness
105 110
         $template = $twig->loadTemplate("index.html.twig");
106 111
         $content = $template->render(array("businesses" => $businesses_tiwg));
107 112
         echo $content;
108
-
109
-
110 113
         exit;
111 114
     }
112 115
 

+ 1
- 1
src/Doc/Templates/index.html.twig View File

@@ -164,7 +164,7 @@
164 164
             <tr>
165 165
                 <td class="api-name"><a href="{{ business.name_hyphen }}/{{ route.businessMethod }}">{{ route.method }} {{ route.url }}</a></td>
166 166
                 <td class="api-documentation">
167
-                    <p>...</p>
167
+                    <p>{{ route.description }}</p>
168 168
                 </td>
169 169
             </tr>
170 170
             {% endfor %}

Loading…
Cancel
Save