From a841b0956d03c5f032f92b45d8cd51917ab28698 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 9 Sep 2014 16:35:06 +0200 Subject: [PATCH] monitoring/commands: Do not require command objects to return the command string There will be command renderer instead. refs #6593 --- .../Monitoring/Command/IcingaCommand.php | 29 ++----------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Command/IcingaCommand.php b/modules/monitoring/library/Monitoring/Command/IcingaCommand.php index dd8dd97fe..d88f8dba0 100644 --- a/modules/monitoring/library/Monitoring/Command/IcingaCommand.php +++ b/modules/monitoring/library/Monitoring/Command/IcingaCommand.php @@ -10,35 +10,12 @@ namespace Icinga\Module\Monitoring\Command; abstract class IcingaCommand { /** - * Get the command string + * Get the name of the command * * @return string */ - abstract public function getCommandString(); - - /** - * Escape a command string - * - * @param string $commandString - * - * @return string - */ - public function escape($commandString) + public function getName() { - return str_replace(array("\r", "\n"), array('\r', '\n'), $commandString); - } - - /** - * Get the command as string with the current timestamp as the command submission time - * - * @return string - */ - public function __toString() - { - return sprintf( - '[%u] %s', - time(), - $this->escape($this->getCommandString()) - ); + return substr_replace(end(explode('\\', get_called_class())), '', -7); // Remove 'Command' Suffix } }