monitoring/lib: Add translate parameter to MonitoredObject::getType()

This commit is contained in:
Eric Lippmann 2015-09-04 13:01:49 +02:00
parent 331c01c371
commit b585b92196

View File

@ -580,11 +580,27 @@ abstract class MonitoredObject implements Filterable
/** /**
* Get the type of the object * Get the type of the object
* *
* @param bool $translate
*
* @return string * @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;
} }
/** /**