From d6ceb9ad11ba745fe13a6cb00645bf6b5754cd57 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 25 Mar 2024 14:27:46 +0100 Subject: [PATCH] Macro: Fix typo and simplify the code --- .../monitoring/library/Monitoring/Object/Macro.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Object/Macro.php b/modules/monitoring/library/Monitoring/Object/Macro.php index eed52b59b..4e2687cce 100644 --- a/modules/monitoring/library/Monitoring/Object/Macro.php +++ b/modules/monitoring/library/Monitoring/Object/Macro.php @@ -62,7 +62,7 @@ class Macro */ public static function resolveMacro($macro, $object) { - if (isset(self::$icingaMacros[$macro]) && isset($object->{self::$icingaMacros[$macro]})) { + if (isset(self::$icingaMacros[$macro], $object->{self::$icingaMacros[$macro]})) { return $object->{self::$icingaMacros[$macro]}; } @@ -83,9 +83,14 @@ class Macro } $value = null; - Logger::debug('Unable to resolve macro "%s" on object "%s". An error occured: %s', $macro, $objectName, $e); + Logger::debug( + 'Unable to resolve macro "%s" on object "%s". An error occurred: %s', + $macro, + $objectName, + $e + ); } - return $value !== null ? $value : $macro; + return $value ?? $macro; } }