Skip to content

Commit

Permalink
added method to get available modules
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Oct 25, 2023
1 parent f1fd4e3 commit 9aba233
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,30 @@ public function getOrdered($direction = 'asc') : array
return $modules;
}

/**
* Get all available modules.
*
* @return array
*/
public function getAvailable()
{
$paths = $this->getScanPaths();

$modules = [];

foreach ($paths as $key => $path) {
$manifests = $this->getFiles()->glob("{$path}/module.json");

is_array($manifests) || $manifests = [];

foreach ($manifests as $manifest) {
$modules[] = Json::make($manifest)->get('alias');
}
}

return $modules;
}

/**
* Get a module path.
*
Expand Down

0 comments on commit 9aba233

Please sign in to comment.