private $title;
/**
- * @var string
+ * @var int
* @see Psr\Log\LogLevel
*/
private $level;
private $help;
/**
+ * @var string
+ * crm-i css class
+ */
+ private $icon;
+
+ /**
+ * Class constructor.
+ *
* @param string $name
* Symbolic name for the check.
* @param string $message
*
* @see Psr\Log\LogLevel
*/
- public function __construct($name, $message, $title, $level = \Psr\Log\LogLevel::WARNING) {
+ public function __construct($name, $message, $title, $level = \Psr\Log\LogLevel::WARNING, $icon = NULL) {
$this->name = $name;
$this->message = $message;
$this->title = $title;
$level = CRM_Utils_Check::severityMap($level);
}
$this->level = $level;
+ $this->icon = $icon;
}
/**
+ * Get name.
+ *
* @return string
*/
public function getName() {
}
/**
+ * Get message.
+ *
* @return string
*/
public function getMessage() {
}
/**
+ * Get level.
+ *
* @return string
* @see Psr\Log\LogLevel
*/
}
/**
- * Set optional additional help text
+ * Set optional additional help text.
+ *
* @param string $help
*/
public function addHelp($help) {
}
/**
+ * Convert to array.
+ *
* @return array
*/
public function toArray() {
'message' => $this->message,
'title' => $this->title,
'severity' => $this->level,
+ 'is_visible' => (int) $this->isVisible(),
+ 'icon' => $this->icon,
);
if (!empty($this->help)) {
$array['help'] = $this->help;
return $array;
}
+ /**
+ * Check if message is visible or has been hidden by the user.
+ *
+ * @return bool
+ */
+ public function isVisible() {
+ return !CRM_Utils_Check::checkHushSnooze($this);
+ }
+
}