Переглянути джерело

index description

tags/0.1.0
Robin Thoni 8 роки тому
джерело
коміт
8b63ffb1a2

+ 7
- 4
src/Doc/Business/LuDocBusiness.php Переглянути файл

11
 use Luticate\Utils\LuRoute;
11
 use Luticate\Utils\LuRoute;
12
 use Luticate\Utils\LuRouteDbo;
12
 use Luticate\Utils\LuRouteDbo;
13
 use ReflectionMethod;
13
 use ReflectionMethod;
14
-use Twig_Autoloader;
15
 use Twig_Environment;
14
 use Twig_Environment;
16
 use Twig_Loader_Filesystem;
15
 use Twig_Loader_Filesystem;
17
 
16
 
91
             $business_tiwg["routes"] = [];
90
             $business_tiwg["routes"] = [];
92
 
91
 
93
             foreach ($businesses as $business) {
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
                 $business_tiwg["routes"][] = [
98
                 $business_tiwg["routes"][] = [
95
                     "method" => $business->getMethod(),
99
                     "method" => $business->getMethod(),
96
                     "url" => $business->getUrl(),
100
                     "url" => $business->getUrl(),
97
-                    "businessMethod" => $business->getBusinessMethod()
101
+                    "businessMethod" => $business->getBusinessMethod(),
102
+                    "description" => $description
98
                 ];
103
                 ];
99
             }
104
             }
100
             $businesses_tiwg[] = $business_tiwg;
105
             $businesses_tiwg[] = $business_tiwg;
105
         $template = $twig->loadTemplate("index.html.twig");
110
         $template = $twig->loadTemplate("index.html.twig");
106
         $content = $template->render(array("businesses" => $businesses_tiwg));
111
         $content = $template->render(array("businesses" => $businesses_tiwg));
107
         echo $content;
112
         echo $content;
108
-
109
-
110
         exit;
113
         exit;
111
     }
114
     }
112
 
115
 

+ 1
- 1
src/Doc/Templates/index.html.twig Переглянути файл

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

Завантаження…
Відмінити
Зберегти