Просмотр исходного кода

detailed page template update

tags/0.1.0
Robin Thoni 9 лет назад
Родитель
Сommit
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
 }

Загрузка…
Отмена
Сохранить