generated from Nodarx/template
refactor(module): register integrations through runtime contexts
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
+18
-22
@@ -14,8 +14,9 @@ use KTXC\User\Event\UserCreatedEvent;
|
||||
use KTXC\User\Event\UserDeletingEvent;
|
||||
use KTXF\Event\DeliveryMode;
|
||||
use KTXF\Event\EventListenerRegistrarInterface;
|
||||
use KTXF\Module\ModuleBrowserInterface;
|
||||
use KTXF\Module\ModuleConsoleInterface;
|
||||
use KTXF\Module\Configuration\BrowserModuleContextInterface;
|
||||
use KTXF\Module\Configuration\ConsoleModuleContextInterface;
|
||||
use KTXF\Module\Configuration\ModuleContextInterface;
|
||||
use KTXF\Module\ModuleInstanceAbstract;
|
||||
use KTXF\Resource\Provider\ProviderInterface;
|
||||
use KTXM\ProviderImap\Console\ConnectCommand;
|
||||
@@ -30,7 +31,7 @@ use KTXM\ProviderImap\Providers\Provider as MailProvider;
|
||||
*
|
||||
* Registers the IMAP mail provider with the Ktrix provider manager.
|
||||
*/
|
||||
class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, ModuleBrowserInterface
|
||||
class Module extends ModuleInstanceAbstract
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ProviderManager $providerManager,
|
||||
@@ -82,26 +83,21 @@ class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, M
|
||||
$this->providerManager->register(ProviderInterface::TYPE_MAIL, 'imap', MailProvider::class);
|
||||
}
|
||||
|
||||
public function registerCI(): array
|
||||
public function configure(ModuleContextInterface $context): void
|
||||
{
|
||||
return [
|
||||
DiscoverCommand::class,
|
||||
ConnectCommand::class,
|
||||
DisconnectCommand::class,
|
||||
TestCommand::class,
|
||||
];
|
||||
}
|
||||
if ($context instanceof BrowserModuleContextInterface) {
|
||||
$context->registerModule($this, 'ProviderImap', 'static/module.mjs');
|
||||
}
|
||||
|
||||
public function registerBI(): array
|
||||
{
|
||||
return [
|
||||
'handle' => $this->handle(),
|
||||
'namespace' => 'ProviderImap',
|
||||
'version' => $this->version(),
|
||||
'label' => $this->label(),
|
||||
'author' => $this->author(),
|
||||
'description' => $this->description(),
|
||||
'boot' => 'static/module.mjs',
|
||||
];
|
||||
if ($context instanceof ConsoleModuleContextInterface) {
|
||||
foreach ([
|
||||
DiscoverCommand::class,
|
||||
ConnectCommand::class,
|
||||
DisconnectCommand::class,
|
||||
TestCommand::class,
|
||||
] as $command) {
|
||||
$context->registerCommand($command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user