Skip to content

Commit

Permalink
monitoring/commands: Do not require command objects to return the com…
Browse files Browse the repository at this point in the history
…mand string

There will be command renderer instead.

refs #6593
  • Loading branch information
lippserd committed Sep 9, 2014
1 parent 0e7ca59 commit a841b09
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions modules/monitoring/library/Monitoring/Command/IcingaCommand.php
Expand Up @@ -10,35 +10,12 @@
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)
{
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()
public function getName()
{
return sprintf(
'[%u] %s',
time(),
$this->escape($this->getCommandString())
);
return substr_replace(end(explode('\\', get_called_class())), '', -7); // Remove 'Command' Suffix
}
}

0 comments on commit a841b09

Please sign in to comment.