Skip to content

Commit 9aba233

Browse files
committed
added method to get available modules
1 parent f1fd4e3 commit 9aba233

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/FileRepository.php

+24
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,30 @@ public function getOrdered($direction = 'asc') : array
308308
return $modules;
309309
}
310310

311+
/**
312+
* Get all available modules.
313+
*
314+
* @return array
315+
*/
316+
public function getAvailable()
317+
{
318+
$paths = $this->getScanPaths();
319+
320+
$modules = [];
321+
322+
foreach ($paths as $key => $path) {
323+
$manifests = $this->getFiles()->glob("{$path}/module.json");
324+
325+
is_array($manifests) || $manifests = [];
326+
327+
foreach ($manifests as $manifest) {
328+
$modules[] = Json::make($manifest)->get('alias');
329+
}
330+
}
331+
332+
return $modules;
333+
}
334+
311335
/**
312336
* Get a module path.
313337
*

0 commit comments

Comments
 (0)