72 lines
1.5 KiB
PHP
72 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace classes;
|
|
|
|
require_once WD . '/modules/limble/limble_c.php';
|
|
require_once WD . '/modules/limble/limble_helpers.php';
|
|
require_once WD . '/modules/limble/classes/limble_endpoints.php';
|
|
|
|
|
|
/**
|
|
* Actions
|
|
*/
|
|
|
|
|
|
use Exception;
|
|
use interfaces\limble_i;
|
|
use limble\classes\limble_endpoints;
|
|
use limble\helpers\limble_tasks;
|
|
use limble\limble_c;
|
|
use limble\limble_helpers;
|
|
|
|
class limble extends limble_endpoints 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();
|
|
}
|
|
|
|
/**
|
|
* Require the webhooks to be enabled
|
|
* @throws Exception
|
|
*/
|
|
public function requireWebhooksEnabled(): void
|
|
{
|
|
if (!(bool)$this->config->webhooks_enabled->getVariableValue()) {
|
|
throw new Exception('Limble webhooks are not enabled');
|
|
}
|
|
}
|
|
} |