Introduce Limble module with core interfaces, helper classes, and initial implementation.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace classes;
|
||||
|
||||
require_once WD . '/modules/limble/limble_c.php';
|
||||
require_once WD . '/modules/limble/limble_helpers.php';
|
||||
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
use Exception;
|
||||
use interfaces\limble_i;
|
||||
use limble\helpers\limble_tasks;
|
||||
use limble\limble_c;
|
||||
use limble\limble_helpers;
|
||||
|
||||
class limble implements limble_i
|
||||
{
|
||||
/**
|
||||
* The configuration of the module
|
||||
* @var limble_c
|
||||
*/
|
||||
public limble_c $config;
|
||||
/**
|
||||
* The task helper for the module
|
||||
* @var limble_helpers
|
||||
*/
|
||||
public limble_helpers $helpers;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->config = new limble_c();
|
||||
$this->helpers = new limble_helpers();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception If the module is not enabled
|
||||
*/
|
||||
public function requireModuleEnabled(): void
|
||||
{
|
||||
if (!(bool)$this->config->enabled->getVariableValue()) {
|
||||
throw new Exception('Limble module is not enabled');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the task helper for the module
|
||||
* @return limble_tasks
|
||||
*/
|
||||
public function getTasks(): limble_tasks
|
||||
{
|
||||
return new $this->helpers->tasks();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace interfaces;
|
||||
require_once WD . '/interfaces/universal_module_i.php';
|
||||
|
||||
use limble\helpers\limble_tasks;
|
||||
|
||||
interface limble_i extends universal_module_i
|
||||
{
|
||||
/**
|
||||
* Get the tasks helper for the limble module
|
||||
* @return limble_tasks
|
||||
*/
|
||||
public function getTasks(): limble_tasks;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace interfaces;
|
||||
|
||||
interface universal_module_i
|
||||
{
|
||||
/**
|
||||
* Require the module to be enabled
|
||||
* @return void
|
||||
* @throws Exception If the module is not enabled
|
||||
*/
|
||||
public function requireModuleEnabled(): void;
|
||||
}
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
namespace interfaces;
|
||||
|
||||
use Exception;
|
||||
|
||||
interface xlvask_i
|
||||
interface xlvask_i extends universal_module_i
|
||||
{
|
||||
/**
|
||||
* Require the xlvask module to be enabled
|
||||
* @return void
|
||||
* @throws Exception If the module is not enabled
|
||||
*/
|
||||
public function requireModuleEnabled(): void;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace limble\helpers;
|
||||
|
||||
class limble_tasks
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace limble;
|
||||
|
||||
|
||||
require_once WD . '/modules/limble/helpers/limble_tasks.php';
|
||||
|
||||
use limble\helpers\limble_tasks;
|
||||
|
||||
class limble_helpers
|
||||
{
|
||||
/**
|
||||
* The task helper
|
||||
* @var string $tasks
|
||||
*/
|
||||
public string $tasks = limble_tasks::class;
|
||||
}
|
||||
Reference in New Issue
Block a user