monitoring/lib: Add translate parameter to MonitoredObject::getType()
This commit is contained in:
parent
331c01c371
commit
b585b92196
|
@ -580,11 +580,27 @@ abstract class MonitoredObject implements Filterable
|
|||
/**
|
||||
* Get the type of the object
|
||||
*
|
||||
* @param bool $translate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
public function getType($translate = false)
|
||||
{
|
||||
return $this->type;
|
||||
if ($translate !== false) {
|
||||
switch ($this->type) {
|
||||
case self::TYPE_HOST:
|
||||
$type = mt('montiroing', 'host');
|
||||
break;
|
||||
case self::TYPE_SERVICE:
|
||||
$type = mt('monitoring', 'service');
|
||||
break;
|
||||
default:
|
||||
throw new InvalidArgumentException('Invalid type ' . $this->type);
|
||||
}
|
||||
} else {
|
||||
$type = $this->type;
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue