From 7f1e40ff44f3cec7152da2194a5a375da6714a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Leuilliot?= Date: Mon, 23 Mar 2020 23:47:15 +0100 Subject: [PATCH] refactor: allow to pass an array of path --- app/Providers/AbstractSeatPlugin.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Providers/AbstractSeatPlugin.php b/app/Providers/AbstractSeatPlugin.php index 65deee5..97f21d2 100644 --- a/app/Providers/AbstractSeatPlugin.php +++ b/app/Providers/AbstractSeatPlugin.php @@ -181,9 +181,9 @@ 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', []); @@ -191,11 +191,12 @@ final public function registerApiAnnotationsPath(string $path) 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)), ]); } }