Skip to content

Commit

Permalink
refactor: allow to pass an array of path
Browse files Browse the repository at this point in the history
  • Loading branch information
warlof committed Mar 23, 2020
1 parent 40182f0 commit 7f1e40f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/Providers/AbstractSeatPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,22 @@ final public function registerPermissions(string $permissions_path, string $scop
/**
* Register new path to annotations dictionary used by Swagger API Documentation.
*
* @param string $path
* @param string|string[] $paths
*/
final public function registerApiAnnotationsPath(string $path)
final public function registerApiAnnotationsPath($paths)
{
// ensure current annotation setting is an array of path or transform into it
$current_annotations = config('l5-swagger.paths.annotations', []);

if (! is_array($current_annotations))
$current_annotations = [$current_annotations];

if (! is_array($paths))
$paths = [$paths];

// merge paths together and update config
config([
'l5-swagger.paths.annotations' => array_unique(array_merge($current_annotations, [
$path,
])),
'l5-swagger.paths.annotations' => array_unique(array_merge($current_annotations, $paths)),
]);
}
}

0 comments on commit 7f1e40f

Please sign in to comment.