/**
  * @param int $level
  * @return mixed
  */
 public function setLevel($level)
 {
     $levels = EventStateHost::getStates();
     if (isset($levels[$level])) {
         $this->level = $level;
     } else {
         throw new \InvalidArgumentException('Nivel no disponible');
     }
 }
Ejemplo n.º 2
0
 /**
  * Devuelve el nombre del estado
  *
  * @param EventInterface $item
  * @param null $state
  * @return bool|string
  */
 public static function getStateName(EventInterface $item, $state = null)
 {
     $state = is_null($state) ? $item->getState() : intval($state);
     switch ($item->getType()) {
         case Event::TYPE_HOST:
             return Language::t(EventStateHost::getStateName($state));
         case Event::TYPE_SERVICE:
             return Language::t(EventStateService::getStateName($state));
         case Event::TYPE_TRIGGER:
             return Language::t(EventStateTrigger::getStateName($state));
     }
     return false;
 }