feat: improve module management
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user