blob: 877884955bba39b74780d35a313d1efe761c8055 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Hook\Common;
use Icinga\Application\ClassLoader;
use Icinga\Application\Icinga;
use Icinga\Application\Modules\Module;
trait HookUtils
{
final public function __construct()
{
$this->init();
}
/**
* Initialize this hook
*
* Override this in your concrete implementation for any initialization at construction time.
*/
protected function init()
{
}
/**
* Get the module this hook belongs to
*
* @return Module
*/
final public function getModule(): Module
{
$moduleName = ClassLoader::extractModuleName(static::class);
return Icinga::app()->getModuleManager()
->getModule($moduleName);
}
}
|