瀏覽代碼

detailed page template update

tags/0.1.0
Robin Thoni 9 年之前
父節點
當前提交
c93e9714eb
共有 1 個文件被更改,包括 21 次插入2 次删除
  1. 21
    2
      src/Doc/Business/LuDocBusiness.php

+ 21
- 2
src/Doc/Business/LuDocBusiness.php 查看文件

@@ -146,6 +146,7 @@ class LuDocBusiness
146 146
 
147 147
         $reflection = new ReflectionMethod($business->getBusinessClass(), $business->getBusinessMethod());
148 148
         $description = $reflection->getDocComment();
149
+        $docParser = null;
149 150
         if ($description === false) {
150 151
             $description = "No description available";
151 152
         }
@@ -154,11 +155,29 @@ class LuDocBusiness
154 155
             $description = $docParser->description;
155 156
         }
156 157
 
158
+        $parameters = [];
159
+        foreach ($reflection->getParameters() as $param) {
160
+            $p = [];
161
+
162
+            $p["name"] = $param->getName();
163
+            if (!is_null($docParser) && isset($docParser->all_params[$param->getName()])) {
164
+                $p["description"] = $docParser->all_params[$param->getName()];
165
+                $p["type"] = "Unknown";
166
+                $p["annotations"] = "";
167
+            }
168
+            else {
169
+                $p["description"] = $description;
170
+                $p["type"] = "Unknown";
171
+                $p["annotations"] = "";
172
+            }
173
+
174
+            $parameters[] = $p;
175
+        }
157 176
 
158 177
         self::printTwig("method.html", array(
159
-            "description" => $description,
178
+            "description" => str_replace("\n", "<br />", $description),
160 179
             "url" => $business->getUrl(),
161 180
             "method" => $business->getMethod(),
162
-            "parameters" => []));
181
+            "parameters" => $parameters));
163 182
     }
164 183
 }

Loading…
取消
儲存