JobHook: provide a new hook for hookable jobs

This commit is contained in:
Thomas Gelf 2016-04-21 13:22:49 +02:00
parent 9c283e8bb6
commit cf1093ef54

View File

@ -0,0 +1,27 @@
<?php
namespace Icinga\Module\Director\Hook;
abstract class JobHook
{
protected $settings = array();
public function getName()
{
$parts = explode('\\', get_class($this));
$class = preg_replace('/Job$/', '', array_pop($parts));
if (array_shift($parts) === 'Icinga' && array_shift($parts) === 'Module') {
$module = array_shift($parts);
if ($module !== 'Director') {
return sprintf('%s (%s)', $class, $module);
}
}
return $class;
}
abstract public run();
abstract public function isPending();
}