@@ -141,6 +141,7 @@ protected function generatePath()
141141
142142 $ this ->docs ['paths ' ][$ this ->uri ][$ this ->method ] = [
143143 'description ' => "$ methodDescription {$ this ->uri }" ,
144+ 'summary ' => '' ,
144145 'tags ' => [],
145146 'responses ' => [
146147 '200 ' => [
@@ -175,7 +176,11 @@ protected function getFormRules()
175176
176177 $ parsedAction = Str::parseCallback ($ this ->action );
177178
178- $ parameters = (new ReflectionMethod ($ parsedAction [0 ], $ parsedAction [1 ]))->getParameters ();
179+ $ reflector = (new ReflectionMethod ($ parsedAction [0 ], $ parsedAction [1 ]));
180+ $ parameters = $ reflector ->getParameters ();
181+ $ docComment = $ reflector ->getDocComment ();
182+
183+ $ this ->addDescription ($ docComment );
179184
180185 foreach ($ parameters as $ parameter ) {
181186 $ class = (string ) $ parameter ->getType ();
@@ -186,6 +191,35 @@ protected function getFormRules()
186191 }
187192 }
188193
194+ protected function addDescription ($ docComment )
195+ {
196+ $ docDomment = $ this ->getDescription ($ docComment );
197+ $ this ->docs ['paths ' ][$ this ->uri ][$ this ->method ]['description ' ] = $ docDomment ;
198+ }
199+
200+ protected function getDescription ($ docComment )
201+ {
202+ $ docCommentParsed = trim (str_replace (array ('/ ' , '* ' ), '' , substr ($ docComment , 0 , strpos ($ docComment , '@ ' ))));
203+ $ docComment = trim (preg_replace ('/\s+/ ' , ' ' , $ docCommentParsed ));
204+
205+ return $ docComment ;
206+ }
207+
208+ protected function addSummary ($ actionName )
209+ {
210+ $ actionName = $ this ->getActionName ($ actionName );
211+ $ this ->docs ['paths ' ][$ this ->uri ][$ this ->method ]['summary ' ] = $ actionName ;
212+ }
213+
214+ protected function getActionName ($ actionName )
215+ {
216+ $ actionNameSubString = substr ($ actionName , strpos ($ actionName , '@ ' )+1 );
217+ $ actionNameArray = preg_split ('/(?=[A-Z])/ ' , ucfirst ($ actionNameSubString ));
218+ $ actionName = trim (implode (' ' , $ actionNameArray ));
219+
220+ return $ actionName ;
221+ }
222+
189223 protected function addTags ($ controllerArray )
190224 {
191225 $ tagName = $ this ->getControllerName ($ controllerArray );
0 commit comments