/** * Checks a configuration. * * @see paAlert */ public function getAlertOutput(paAlert $alert) { $pluginAssetsPath = $this->config['plugin']['assets_path']; switch ($alert->getStatus()) { case paAlert::ALERT: case paAlert::CRIT: case paAlert::ERR: $color = '#fd3900'; $image = $pluginAssetsPath . '/images/alert.png'; $alt = 'fatal'; break; case paAlert::WARNING: $color = '#6a9ee6'; $image = $pluginAssetsPath . '/images/warning.png'; $alt = 'warning'; break; case paAlert::NOTICE: case paAlert::INFO: $color = '#60b111'; $image = $pluginAssetsPath . '/images/check.png'; $alt = 'ok'; break; default: throw new RuntimeException(sprintf('The "%d" alert status is not handled ! It must be implemented in the sfProjectAnalyseTask::getAlertOutput() function.', $alert->getStatus()), -1); break; } return sprintf(' <div style="background-color: %s; padding: 4px; margin: 3px; border: 1px #ddd solid; font-size: 18px"> <div style="float: left"><img alt="%s" style="width: 60%%; vertical-align: middle; margin-right: 10px" src="%s" /></div> <div style="float: left; margin-top: 7px; text-align: left;">%s%s</div> <div style="clear: both"></div> </div>', $color, $alt, $image, $alert->getMessage(), $alert->hasHelp() ? '<div style="background-color: #fff; padding:5px">What to do: ' . $alert->getHelp() . '</div>' : ''); }