Hook: Add class suffix for base class testing

refs #6928
This commit is contained in:
Marius Hein 2014-08-27 11:13:41 +02:00
parent 87a5967501
commit e0d7c3855d
1 changed files with 10 additions and 1 deletions

View File

@ -41,6 +41,15 @@ class Hook
*/
public static $BASE_NS = 'Icinga\\Web\\Hook\\';
/**
* Append this string to base class
*
* All base classes renamed to *Hook
*
* @var string
*/
public static $classSuffix = 'Hook';
/**
* Reset object state
*/
@ -114,7 +123,7 @@ class Hook
*/
private static function assertValidHook($instance, $name)
{
$base_class = self::$BASE_NS . ucfirst($name);
$base_class = self::$BASE_NS . ucfirst($name) . self::$classSuffix;
if (!$instance instanceof $base_class) {
throw new ProgrammingError(
'%s is not an instance of %s',