22
33namespace Mtrajano \LaravelSwagger ;
44
5- use ReflectionMethod ;
6- use Illuminate \Support \Str ;
7- use Illuminate \Routing \Route ;
85use Illuminate \Foundation \Http \FormRequest ;
6+ use Illuminate \Routing \Route ;
7+ use Illuminate \Support \Str ;
98use phpDocumentor \Reflection \DocBlockFactory ;
9+ use ReflectionMethod ;
1010
1111class Generator
1212{
@@ -53,7 +53,9 @@ public function generate()
5353 foreach ($ methods as $ method ) {
5454 $ this ->method = strtolower ($ method );
5555
56- if (in_array ($ this ->method , $ this ->config ['ignoredMethods ' ])) continue ;
56+ if (in_array ($ this ->method , $ this ->config ['ignoredMethods ' ])) {
57+ continue ;
58+ }
5759
5860 $ this ->generatePath ();
5961 }
@@ -111,18 +113,18 @@ protected function getRouteUri(Route $route)
111113 protected function generatePath ()
112114 {
113115 $ actionInstance = is_string ($ this ->action ) ? $ this ->getActionClassInstance ($ this ->action ) : null ;
114- $ docBlock = $ actionInstance ? ($ actionInstance ->getDocComment () ?: "" ) : "" ;
116+ $ docBlock = $ actionInstance ? ($ actionInstance ->getDocComment () ?: '' ) : '' ;
115117
116- list ( $ isDeprecated , $ summary , $ description) = $ this ->parseActionDocBlock ($ docBlock );
118+ [ $ isDeprecated , $ summary , $ description] = $ this ->parseActionDocBlock ($ docBlock );
117119
118120 $ this ->docs ['paths ' ][$ this ->uri ][$ this ->method ] = [
119121 'summary ' => $ summary ,
120122 'description ' => $ description ,
121123 'deprecated ' => $ isDeprecated ,
122124 'responses ' => [
123125 '200 ' => [
124- 'description ' => 'OK '
125- ]
126+ 'description ' => 'OK ' ,
127+ ],
126128 ],
127129 ];
128130
@@ -148,7 +150,9 @@ protected function addActionParameters()
148150
149151 protected function getFormRules ()
150152 {
151- if (!is_string ($ this ->action )) return false ;
153+ if (!is_string ($ this ->action )) {
154+ return false ;
155+ }
152156
153157 $ parameters = $ this ->getActionClassInstance ($ this ->action )->getParameters ();
154158
@@ -175,15 +179,15 @@ protected function getParameterGenerator($rules)
175179
176180 private function getActionClassInstance (string $ action )
177181 {
178- list ( $ class , $ method) = Str::parseCallback ($ action );
182+ [ $ class , $ method] = Str::parseCallback ($ action );
179183
180184 return new ReflectionMethod ($ class , $ method );
181185 }
182186
183187 private function parseActionDocBlock (string $ docBlock )
184188 {
185189 if (empty ($ docBlock ) || !$ this ->config ['parseDocBlock ' ]) {
186- return [false , "" , "" ];
190+ return [false , '' , '' ];
187191 }
188192
189193 try {
@@ -195,8 +199,8 @@ private function parseActionDocBlock(string $docBlock)
195199 $ description = (string ) $ parsedComment ->getDescription ();
196200
197201 return [$ isDeprecated , $ summary , $ description ];
198- } catch (\Exception $ e ) {
199- return [false , "" , "" ];
202+ } catch (\Exception $ e ) {
203+ return [false , '' , '' ];
200204 }
201205 }
202- }
206+ }
0 commit comments