parent
54002cb3e5
commit
881267d829
|
@ -323,14 +323,14 @@ class Perfdata
|
|||
case 3:
|
||||
$this->rawCriticalThreshold = trim($parts[2]);
|
||||
$this->criticalThreshold = self::convert(
|
||||
ThresholdRange::fromString($this->rawCriticalThreshold ?: '~:'),
|
||||
ThresholdRange::fromString($this->rawCriticalThreshold),
|
||||
$this->unit
|
||||
);
|
||||
// Fallthrough
|
||||
case 2:
|
||||
$this->rawWarningThreshold = trim($parts[1]);
|
||||
$this->warningThreshold = self::convert(
|
||||
ThresholdRange::fromString($this->rawWarningThreshold ?: '~:'),
|
||||
ThresholdRange::fromString($this->rawWarningThreshold),
|
||||
$this->unit
|
||||
);
|
||||
}
|
||||
|
|
|
@ -36,10 +36,14 @@ class ThresholdRange
|
|||
*
|
||||
* @return ThresholdRange
|
||||
*/
|
||||
public static function fromString($rawRange)
|
||||
public static function fromString($rawRange = '')
|
||||
{
|
||||
$range = new static();
|
||||
|
||||
if ($rawRange === '') {
|
||||
return $range;
|
||||
}
|
||||
|
||||
$rawRange = ltrim($rawRange);
|
||||
if (substr($rawRange, 0, 1) === '@') {
|
||||
$range->setInverted();
|
||||
|
|
Loading…
Reference in New Issue