name = $name; $this->message = $message; $this->title = $title; // Handle non-integer severity levels. if (!CRM_Utils_Rule::integer($level)) { $level = CRM_Utils_Check::severityMap($level); } $this->level = $level; $this->icon = $icon; } /** * Get name. * * @return string */ public function getName() { return $this->name; } /** * Get message. * * @return string */ public function getMessage() { return $this->message; } /** * @return string */ public function getTitle() { return $this->title; } /** * Get level. * * @return string * @see Psr\Log\LogLevel */ public function getLevel() { return $this->level; } /** * Alias for Level * @return string */ public function getSeverity() { return $this->getLevel(); } /** * Set optional additional help text. * * @param string $help */ public function addHelp($help) { $this->help = $help; } /** * Convert to array. * * @return array */ public function toArray() { $array = array( 'name' => $this->name, 'message' => $this->message, 'title' => $this->title, 'severity' => $this->level, 'is_visible' => $this->isVisible, 'icon' => $this->icon, ); if (!empty($this->help)) { $array['help'] = $this->help; } return $array; } /** * Getter for is visible. * * @return bool */ public function isVisible() { return $this->isVisible; } /** * Seter for is visible. * * @param bool $isVisible */ public function setVisible($isVisible) { $this->isVisible = $isVisible ? 1 : 0; } }