@@ -56,7 +56,8 @@ public function processRoute(Route $route, array $rulesToApply = [])
5656 'description ' => $ docBlock ['long ' ],
5757 'methods ' => $ this ->getMethods ($ route ),
5858 'uri ' => $ this ->getUri ($ route ),
59- 'parameters ' => $ this ->getParametersFromDocBlock ($ docBlock ['tags ' ]),
59+ 'bodyParameters ' => $ this ->getBodyParametersFromDocBlock ($ docBlock ['tags ' ]),
60+ 'queryParameters ' => $ this ->getQueryParametersFromDocBlock ($ docBlock ['tags ' ]),
6061 'authenticated ' => $ this ->getAuthStatusFromDocBlock ($ docBlock ['tags ' ]),
6162 'response ' => $ content ,
6263 'showresponse ' => ! empty ($ content ),
@@ -71,7 +72,7 @@ public function processRoute(Route $route, array $rulesToApply = [])
7172 *
7273 * @return array
7374 */
74- protected function getParametersFromDocBlock (array $ tags )
75+ protected function getBodyParametersFromDocBlock (array $ tags )
7576 {
7677 $ parameters = collect ($ tags )
7778 ->filter (function ($ tag ) {
@@ -103,6 +104,40 @@ protected function getParametersFromDocBlock(array $tags)
103104 return $ parameters ;
104105 }
105106
107+ /**
108+ * @param array $tags
109+ *
110+ * @return array
111+ */
112+ protected function getQueryParametersFromDocBlock (array $ tags )
113+ {
114+ $ parameters = collect ($ tags )
115+ ->filter (function ($ tag ) {
116+ return $ tag instanceof Tag && $ tag ->getName () === 'queryParam ' ;
117+ })
118+ ->mapWithKeys (function ($ tag ) {
119+ preg_match ('/(.+?)\s+(required\s+)?(.*)/ ' , $ tag ->getContent (), $ content );
120+ if (empty ($ content )) {
121+ // this means only name was supplied
122+ list ($ name ) = preg_split ('/\s+/ ' , $ tag ->getContent ());
123+ $ required = false ;
124+ $ description = '' ;
125+ } else {
126+ list ($ _ , $ name , $ required , $ description ) = $ content ;
127+ $ description = trim ($ description );
128+ if ($ description == 'required ' && empty (trim ($ required ))) {
129+ $ required = $ description ;
130+ $ description = '' ;
131+ }
132+ $ required = trim ($ required ) == 'required ' ? true : false ;
133+ }
134+
135+ return [$ name => compact ('description ' , 'required ' )];
136+ })->toArray ();
137+
138+ return $ parameters ;
139+ }
140+
106141 /**
107142 * @param array $tags
108143 *
0 commit comments