/** * Render a command * * @param IcingaCommand $command * * @return IcingaApiCommand */ public function render(IcingaCommand $command) { $renderMethod = 'render' . $command->getName(); if (!method_exists($this, $renderMethod)) { die($renderMethod); } return $this->{$renderMethod}($command); }
/** * Render a command * * @param IcingaCommand $command * @param int|null $now * * @return string */ public function render(IcingaCommand $command, $now = null) { $renderMethod = 'render' . $command->getName(); if (!method_exists($this, $renderMethod)) { die($renderMethod); } if ($now === null) { $now = time(); } return sprintf('[%u] %s', $now, $this->escape($this->{$renderMethod}($command))); }