File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -356,9 +356,11 @@ public function getParamExample(array $param): string
356356 switch ($ type ) {
357357 case self ::TYPE_NUMBER :
358358 case self ::TYPE_INTEGER :
359- case self ::TYPE_ARRAY :
360359 $ output .= $ example ;
361360 break ;
361+ case self ::TYPE_ARRAY :
362+ $ output .= $ this ->isPermissionString ($ example ) ? $ this ->getPermissionExample ($ example ) : $ example ;
363+ break ;
362364 case self ::TYPE_OBJECT :
363365 $ output .= $ this ->jsonToAssoc (json_decode ($ example , true ));
364366 break ;
@@ -377,6 +379,15 @@ public function getParamExample(array $param): string
377379 return $ output ;
378380 }
379381
382+ public function getPermissionExample (string $ example ): string
383+ {
384+ $ permissions = [];
385+ foreach ($ this ->extractPermissionParts ($ example ) as $ permission ) {
386+ $ permissions [] = 'Permission:: ' . $ permission ['action ' ] . '(Role:: ' . $ permission ['role ' ] . '()) ' ;
387+ }
388+ return '[ ' . implode (', ' , $ permissions ) . '] ' ;
389+ }
390+
380391 /**
381392 * Converts JSON Object To PHP Native Assoc Array
382393 *
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ use {{ spec.title | caseUcfirst }}\Enums\{{parameter.enumName | caseUcfirst}};
2121{% endif % }
2222{% endif % }
2323{% endfor % }
24+ {% if method . parameters . all | hasPermissionParam % }
25+ use {{ spec.title | caseUcfirst }}\Permission ;
26+ use {{ spec.title | caseUcfirst }}\Role ;
27+ {% endif % }
2428
2529$client = (new Client ())
2630 {% ~ if method . auth | length > 0 % }
You can’t perform that action at this time.
0 commit comments