feat: improve module management
All checks were successful
JS Unit Tests / test (pull_request) Successful in 39s
Build Test / build (pull_request) Successful in 44s
PHP Unit Tests / test (pull_request) Successful in 53s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-02-22 00:40:38 -05:00
parent f44fd85dcc
commit c687bd0795
12 changed files with 391 additions and 28 deletions

View File

@@ -9,10 +9,7 @@ use KTXF\Module\ModuleConsoleInterface;
use KTXF\Module\ModuleInstanceInterface;
/**
* Module is a unified wrapper that combines both the ModuleInterface instance
* (from filesystem) and ModuleEntry (from database) into a single object.
*
* This provides a single source of truth for all module information.
* Module is a unified wrapper that combines the filesystem module instance and the database module entry.
*/
class ModuleObject implements JsonSerializable
{
@@ -32,6 +29,9 @@ class ModuleObject implements JsonSerializable
return [
'id' => $this->id(),
'handle' => $this->handle(),
'label' => $this->label(),
'description' => $this->description(),
'author' => $this->author(),
'version' => $this->version(),
'namespace' => $this->namespace(),
'installed' => $this->installed(),
@@ -86,6 +86,21 @@ class ModuleObject implements JsonSerializable
return null;
}
public function label(): string
{
return $this->instance?->label() ?? '';
}
public function description(): string
{
return $this->instance?->description() ?? '';
}
public function author(): string
{
return $this->instance?->author() ?? '';
}
public function version(): string
{
// Prefer current version from filesystem